@aventurevc/aventure-cli 0.8.101 → 0.8.102
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/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +1 -1
- package/dist/chunks/{aventure-cli-Cgi9A10T.js → aventure-cli-nlLwkfK-.js} +1 -1
- package/dist/chunks/{dist-DkwVqTBF.js → dist-BwoQAovO.js} +2 -2
- package/dist/chunks/{oauth-bearer-credential-CWRNxpBl.js → oauth-bearer-credential-DakRQtRh.js} +2 -2
- package/dist/chunks/{oauth-login-C_mFqytY.js → oauth-login-CdPhd9Z7.js} +1 -1
- package/dist/chunks/oauth-login-DWy0fOjd.js +1 -0
- package/dist/chunks/openapi-commands-Del1oTGC.js +1 -0
- package/dist/chunks/provider-catalog-CSEE3tpJ.js +1 -0
- package/dist/chunks/text-field-TULdxZpH.js +3 -0
- package/dist/chunks/{text-response-KHaR7Uds.js → text-response-CHjRh0mF.js} +2 -2
- package/package.json +3 -3
- package/dist/chunks/oauth-login-_sG7EUms.js +0 -1
- package/dist/chunks/openapi-commands-BBTGZzqJ.js +0 -1
- package/dist/chunks/provider-catalog-BC52jIIF.js +0 -1
- package/dist/chunks/text-field-DnJHvuL4.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{da as e,di as t,li as n,vi as r,yi as i}from"../chunks/dist-
|
|
2
|
+
import{da as e,di as t,li as n,vi as r,yi as i}from"../chunks/dist-BwoQAovO.js";import{_ as a,t as o}from"../chunks/oauth-bearer-credential-DakRQtRh.js";import{i as s}from"../chunks/text-field-TULdxZpH.js";import{c,i as l,t as u}from"../chunks/openapi-commands-Del1oTGC.js";var d=process.argv.slice(2);l(d)&&t(!1),d.includes(`--all-fields`)&&s(!0);try{if(i(),c(d,u)===`optional`)try{await o(),await a()}catch(e){n({component:r().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:e})}await import(`../chunks/aventure-cli-nlLwkfK-.js`)}catch(t){if(!(t instanceof e))throw t;process.stderr.write(`${t.message}\n`),process.exitCode=t.exitCode}export{};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "MCP_GENERATION_CONTRACT",
|
|
4
|
-
"generatedAt": "2026-10-
|
|
4
|
+
"generatedAt": "2026-10-08T00:45:39.938Z",
|
|
5
5
|
"totalOperations": 140,
|
|
6
6
|
"note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
|
|
7
7
|
"operations": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ai as e,Ci as t,Di as n,E as r,Ei as i,Mi as a,O as o,Si as s,T as c,Ti as l,_ as u,a as d,b as f,bi as p,c as m,ca as h,d as g,fa as _,g as v,gi as ee,i as te,ji as y,ki as ne,l as re,la as b,li as ie,m as ae,n as oe,o as se,r as ce,si as le,u as ue,ua as de,vi as x,w as fe,y as pe}from"./dist-DkwVqTBF.js";import{M as me,O as he,i as S,o as ge,v as _e,w as C,y as w}from"./person-owner-BJgNYLKX.js";import{A as ve,C as ye,D as be,E as xe,M as Se,N as Ce,O as T,S as we,T as Te,_ as Ee,a as De,b as Oe,c as ke,h as Ae,i as je,k as Me,l as Ne,o as Pe,p as Fe,s as Ie,t as Le,u as Re,v as ze,x as Be,y as Ve}from"./oauth-bearer-credential-CWRNxpBl.js";import{c as He,d as Ue,h as We,m as Ge,o as Ke,p as qe,s as Je,u as Ye}from"./text-field-DnJHvuL4.js";import{a as Xe,c as Ze,d as Qe,f as $e,g as et,h as tt,l as nt,m as rt,n as it,o as E,p as at,r as D,s as ot,t as O,u as st}from"./openapi-commands-BBTGZzqJ.js";import{a as ct,c as lt,d as ut,i as k,l as dt,m as ft,n as pt,o as mt,r as ht,s as gt,t as _t}from"./text-response-KHaR7Uds.js";import{n as vt,r as yt,t as bt}from"./oauth-login-C_mFqytY.js";import{spawnSync as xt}from"node:child_process";import{basename as St,dirname as A,resolve as j,sep as M}from"node:path";import{copyFileSync as Ct,existsSync as wt,lstatSync as Tt,mkdirSync as Et,mkdtempSync as Dt,readFileSync as Ot,readlinkSync as kt,realpathSync as At,renameSync as jt,rmdirSync as Mt,unlinkSync as Nt,writeFileSync as Pt}from"node:fs";import N,{stderr as P,stdin as Ft}from"node:process";import{TextDecoder as It,inspect as Lt}from"node:util";import{homedir as Rt,hostname as zt,platform as Bt}from"node:os";import{fileURLToPath as Vt}from"node:url";import{readFile as Ht}from"node:fs/promises";import{setTimeout as Ut}from"node:timers/promises";import{webcrypto as Wt}from"node:crypto";import{createInterface as Gt}from"node:readline/promises";function Kt(t,n,r){let i={...r};for(let r of n.parameter){let n=r.envName;if(n===void 0)continue;let a=process.env[n]?.trim();if(a===void 0||a.length===0)continue;let o=i[r.optionKey];if(o!==void 0&&(typeof o!=`string`||o!==a))return{...e(`${t} ${r.flag.split(` `)[0]??r.name} conflicts with ${n}; omit the flag or use ${a}.`),data:i};o===void 0&&(i[r.optionKey]=a)}return y(`Environment-bound options applied`,i)}function qt(e,t,n){if(!I(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!cn(n,r.name))continue;let a=sn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function Jt(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function Yt(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return fn(e,t,n);for(let[r,i]of n.entries()){let n=fn(e,t,i,r);if(!n.ok)return n}return y(`Body value assigned`,null)}function Xt(e,t,n,r){return fn(e,t,r,n)}function Zt(e){let t=[];for(let n of e.split(`.`)){let e=mn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Qt(e,t){let n=Zt(t);if(n===null)return null;let r=on(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:an(r)}:null}function $t(t,n){if(F(t.name)||t.schemaType===`array`)return y(`Repeated body option selected`,typeof n==`string`?[n]:n);if(!Array.isArray(n))return y(`Scalar body option selected`,n);let r=t.flag.split(` `)[0]??t.name;return n.length===1?y(`Scalar body option selected`,n[0]):e(`${r} was already given; pass it once.`)}var en=/^(?<row>\d+):(?<item>.*)$/su;function tn(e,t){let n=Zt(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=en.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function nn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Zt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function rn(t,n,r,i){for(let a of n.parameter){let n=r[a.optionKey];if(n===void 0)continue;let o=Qt(i,a.name);if(o===null)continue;if(o.firstHole!==null)return e(`${t} has no ${o.path}[] row ${o.firstHole} — number ${o.path}[] rows from 0 with no gaps.`);if(a.schemaType!==`array`||o.rowCount<=1||tn(a,n)!==null)continue;let s=a.flag.split(` `)[0]??a.name;return e(`${s} fills one ${o.path}[] row's list, so ${t} cannot also build ${o.rowCount} ${o.path}[] rows from direct options — prefix each value with its 0-based ${o.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function an(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function on(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function sn(e,t){if(!F(t))return on(e,t.split(`.`))}function cn(e,t){return un(e,t.split(`.`))}function ln(e,t,n){if(!I(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&cn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function un(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=mn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>un(e,r)):un(a,r)}function F(e){return e.split(`.`).some(e=>mn(e).isArray)}function dn(e,t){return e.parameter.length===0||!I(t)?null:gn(t,[],hn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fn(t,n,r,i=0){let a=n.split(`.`),o=t;for(let[t,s]of a.entries()){let c=mn(s),l=t===a.length-1,u=pn(o,c,n,l,r,i);if(!u.ok||u.data===null)return e(u.summary,u.warnings);if(l)return y(`Body value assigned`,null);o=u.data}return e(`${n} is not a valid body option path.`)}function pn(t,n,r,i,a,o){let s=()=>e(`${r} cannot be combined with another body option at ${n.key}.`),c=t[n.key];if(n.isArray){if(c!==void 0&&!Array.isArray(c))return s();let e=c??[];if(c===void 0&&(t[n.key]=e),i)return e[o]===void 0?(e[o]=a,y(`Body value assigned`,t)):s();let r=e[o];if(r===void 0){let t={};return e[o]=t,y(`Body path created`,t)}return I(r)?y(`Body path stepped`,r):s()}if(i)return c===void 0?(t[n.key]=a,y(`Body value assigned`,t)):s();if(c===void 0){let e={};return t[n.key]=e,y(`Body path created`,e)}return I(c)?y(`Body path stepped`,c):s()}function mn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function hn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function gn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=gn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!_n(a,n)){if(!vn(e))continue;return{path:a,suggestion:yn(e,n)}}let o=gn(i,e,n);if(o!==null)return o}return null}function _n(e,t){return t.prefix.has(e)||t.leaf.has(e)}function vn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function yn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:bn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function bn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function xn(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Ge(e)),t.description=m(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?kn(r,i):r===void 0?i===void 0?0:1:-1})}function Sn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Cn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function wn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Dn(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Tn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function En(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?We(n):`${We(n)} Required JSON paths: ${r.join(`, `)}.`}function Dn(e,t){let n=Ue(t.description,void 0),r=e.kind!==`multipart`&&F(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${On(e,t)}`}function On(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Zt(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function kn(e,t){return qe(e)-qe(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function An(t){let n;try{n=t===`-`?await jn():await Ht(t,`utf8`)}catch(n){return e(`Could not read input: ${n.message}`,[`path=${t}`])}try{if(n.trim().length===0)return y(`No input provided`,null);let e=JSON.parse(n);return y(`Input parsed`,e)}catch(t){return e(`Input is not valid JSON: ${t.message}`)}}async function jn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var Mn=`--content-type`;function Nn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(Mn)){let t=i.map(({contentType:e})=>e);e.addOption(new b(`${Mn} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Fn(i)))}if($n(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new b(`--from-file <path>`,En(n,n.requiredPath)).argParser(Ln(`--from-file`)))}let a=Sn(i).filter(e=>r(L(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>kn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new b(Cn(t),i.length>1?wn(t):Dn(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?Tn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Pn):F(r.name)||r.schemaType===`array`?a.argParser(In):a.argParser(Ln(r.flag)),e.addOption(a),a.envVar!==void 0&&e.on(`optionEnv:${a.name()}`,()=>{let t=e.opts()[r.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(r.optionKey,t.trim(),`env`)})}Qn(e,t,a)}function Pn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Fn(e){return(t,n)=>{if(n!==void 0)throw new _(`${Mn} was already given; pass it once.`);let r=o(e,t);if(!r.ok)throw new _(r.summary);return t}}function In(e,t){return[...t??[],e]}function Ln(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new _(`${t} was already given; pass it once.`);return e}}async function Rn(t,n){let r=Qe(t,n),i=o(t.requestBody??[],r);if(!i.ok||i.data===null)return e(i.summary,i.warnings);let a=i.data;if(a===void 0)return y(`No body`,void 0);let s=zn(t,a,n);if(s!==null)return e(s);let c=Kt(t.operationId,a,n);if(!c.ok)return e(c.summary,c.warnings);n=c.data;let l=Bn(a,n);if(l!==null)return e(l);let u=await Wn(n);if(!u.ok)return e(u.summary,u.warnings);let d=ln(t.requestBody??[],a,u.data);if(d!==null)return e(d);let f=Un(t.operationId,a,u.data);if(!f.ok)return f;let p=qt(t.operationId,a,u.data);if(p!==null)return e(p);let m=Gn(t.operationId,a,n);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return a.required?e(Zn(t.operationId,a)):y(`No body`,void 0);let h=qn(t.operationId,a,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(a.schemaType===`array`&&!Array.isArray(h.data))return e(`${t.operationId} requires a JSON array body.`);if(a.parameter.length>0&&!I(h.data)){let n=a.kind===`multipart`?` keyed by multipart part name`:` body`;return e(`${t.operationId} requires a JSON object${n}.`)}let g=Hn(a,h.data);if(g.length>0)return e(`${t.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,v=I(_)?Jt(a).filter(e=>!cn(_,e)):[];return v.length>0?e(Vn(t.operationId,a,v)):h}function zn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${L(t)} requires ${Mn} ${i.join(` or `)}.`}return null}function Bn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Vn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Hn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!cn(t,e.name)).map(L):[]}function Un(t,n,r){let i=dn(n,r);if(i===null)return y(`Body file paths validated`,null);let a=i.suggestion===void 0?``:` Use ${i.suggestion}.`;return e(`${t} --from-file contains unknown JSON path ${i.path}.${a}`)}async function Wn(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return y(`No body file`,void 0);let r=await An(n);if(!r.ok)return e(r.summary,r.warnings);let i=a.safeParse(r.data);return i.success?y(`Input parsed`,i.data):e(`Input is not valid JSON value: ${i.error.message}`)}function Gn(t,n,r){let i={},a=!1;for(let t of n.parameter){let o=$t(t,r[t.optionKey]);if(!o.ok||o.data===null)return e(o.summary,o.warnings);let s=o.data;if(s===void 0)continue;let c=Kn(n,r,i,t,s);if(!c.ok)return e(c.summary,c.warnings);a=!0}if(!a)return y(`No direct body options`,void 0);let o=rn(t,n,r,i);return o===null?y(`Direct body options parsed`,i):o}function Kn(t,n,r,i,a){let o=tn(i,a);if(o===null){let t=Yn(i,a);return t.ok?Yt(r,i.name,t.data,i.schemaType===`array`):e(t.summary,t.warnings)}if(o.plain.length>0)return e(`${L(i)} mixes row-form values with plain value(s): ${o.plain.join(`, `)} — prefix every value with its 0-based ${o.container}[] row index, as 0:value.`);let s=nn(t,n,o.container);for(let t of o.rows.keys())if(!(t<s))return e(`${L(i)} names ${o.container}[] row ${t}, but these options build at most ${s} ${o.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[t,n]of o.rows){let a=[];for(let t of n){let n=Xn(i.name,i.itemSchemaType,t);if(!n.ok)return e(n.summary,n.warnings);a.push(n.data)}let o=Xt(r,i.name,t,a);if(!o.ok)return o}return y(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function qn(t,n,r,i){if(r===void 0)return y(`Direct body parsed`,i);if(i===void 0)return y(`Input parsed`,r);if(I(r)&&I(i))try{return y(`Input parsed`,Jn(n,r,i))}catch(n){return e(`${t} ${n.message}`)}return e(`${t} cannot combine --from-file with direct body options unless the file body is an object.`)}function Jn(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(I(n)&&I(a))i[t]=Jn(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:ct.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function Yn(e,t){if(typeof t==`boolean`)return y(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return Xn(e.name,e.schemaType,t??``);let n=[],r=F(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=Xn(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return y(`Body value parsed`,n)}function Xn(t,n,r){if(n===`boolean`)return r===`true`?y(`Body value parsed`,!0):r===`false`?y(`Body value parsed`,!1):e(`${t} must be true or false.`);if(n===`number`||n===`integer`){let i=r.trim(),a=Number(i);return i===``||!Number.isFinite(a)?e(`${t} must be a finite ${n}.`):n===`integer`&&!Number.isInteger(a)?e(`${t} must be an integer.`):y(`Body value parsed`,a)}return y(`Body value parsed`,r)}function Zn(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(L).join(`, `)}`;let r=Jt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function Qn(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Mn,location:`body`}),$n(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),xn(e.options,r)}function $n(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function er(e){let t=ne(e);return lr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function tr(e){let t=ne(e);lr(t);let n=_t(t.data,t.summary),r=[];if(t.ok&&n!==null){let e=nr(t);r.push(n.endsWith(`
|
|
1
|
+
import{Ai as e,Ci as t,Di as n,E as r,Ei as i,Mi as a,O as o,Si as s,T as c,Ti as l,_ as u,a as d,b as f,bi as p,c as m,ca as h,d as g,fa as _,g as v,gi as ee,i as te,ji as y,ki as ne,l as re,la as b,li as ie,m as ae,n as oe,o as se,r as ce,si as le,u as ue,ua as de,vi as x,w as fe,y as pe}from"./dist-BwoQAovO.js";import{M as me,O as he,i as S,o as ge,v as _e,w as C,y as w}from"./person-owner-BJgNYLKX.js";import{A as ve,C as ye,D as be,E as xe,M as Se,N as Ce,O as T,S as we,T as Te,_ as Ee,a as De,b as Oe,c as ke,h as Ae,i as je,k as Me,l as Ne,o as Pe,p as Fe,s as Ie,t as Le,u as Re,v as ze,x as Be,y as Ve}from"./oauth-bearer-credential-DakRQtRh.js";import{c as He,d as Ue,h as We,m as Ge,o as Ke,p as qe,s as Je,u as Ye}from"./text-field-TULdxZpH.js";import{a as Xe,c as Ze,d as Qe,f as $e,g as et,h as tt,l as nt,m as rt,n as it,o as E,p as at,r as D,s as ot,t as O,u as st}from"./openapi-commands-Del1oTGC.js";import{a as ct,c as lt,d as ut,i as k,l as dt,m as ft,n as pt,o as mt,r as ht,s as gt,t as _t}from"./text-response-CHjRh0mF.js";import{n as vt,r as yt,t as bt}from"./oauth-login-CdPhd9Z7.js";import{spawnSync as xt}from"node:child_process";import{basename as St,dirname as A,resolve as j,sep as M}from"node:path";import{copyFileSync as Ct,existsSync as wt,lstatSync as Tt,mkdirSync as Et,mkdtempSync as Dt,readFileSync as Ot,readlinkSync as kt,realpathSync as At,renameSync as jt,rmdirSync as Mt,unlinkSync as Nt,writeFileSync as Pt}from"node:fs";import N,{stderr as P,stdin as Ft}from"node:process";import{TextDecoder as It,inspect as Lt}from"node:util";import{homedir as Rt,hostname as zt,platform as Bt}from"node:os";import{fileURLToPath as Vt}from"node:url";import{readFile as Ht}from"node:fs/promises";import{setTimeout as Ut}from"node:timers/promises";import{webcrypto as Wt}from"node:crypto";import{createInterface as Gt}from"node:readline/promises";function Kt(t,n,r){let i={...r};for(let r of n.parameter){let n=r.envName;if(n===void 0)continue;let a=process.env[n]?.trim();if(a===void 0||a.length===0)continue;let o=i[r.optionKey];if(o!==void 0&&(typeof o!=`string`||o!==a))return{...e(`${t} ${r.flag.split(` `)[0]??r.name} conflicts with ${n}; omit the flag or use ${a}.`),data:i};o===void 0&&(i[r.optionKey]=a)}return y(`Environment-bound options applied`,i)}function qt(e,t,n){if(!I(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!cn(n,r.name))continue;let a=sn(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function Jt(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function Yt(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return fn(e,t,n);for(let[r,i]of n.entries()){let n=fn(e,t,i,r);if(!n.ok)return n}return y(`Body value assigned`,null)}function Xt(e,t,n,r){return fn(e,t,r,n)}function Zt(e){let t=[];for(let n of e.split(`.`)){let e=mn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Qt(e,t){let n=Zt(t);if(n===null)return null;let r=on(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:an(r)}:null}function $t(t,n){if(F(t.name)||t.schemaType===`array`)return y(`Repeated body option selected`,typeof n==`string`?[n]:n);if(!Array.isArray(n))return y(`Scalar body option selected`,n);let r=t.flag.split(` `)[0]??t.name;return n.length===1?y(`Scalar body option selected`,n[0]):e(`${r} was already given; pass it once.`)}var en=/^(?<row>\d+):(?<item>.*)$/su;function tn(e,t){let n=Zt(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=en.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function nn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Zt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function rn(t,n,r,i){for(let a of n.parameter){let n=r[a.optionKey];if(n===void 0)continue;let o=Qt(i,a.name);if(o===null)continue;if(o.firstHole!==null)return e(`${t} has no ${o.path}[] row ${o.firstHole} — number ${o.path}[] rows from 0 with no gaps.`);if(a.schemaType!==`array`||o.rowCount<=1||tn(a,n)!==null)continue;let s=a.flag.split(` `)[0]??a.name;return e(`${s} fills one ${o.path}[] row's list, so ${t} cannot also build ${o.rowCount} ${o.path}[] rows from direct options — prefix each value with its 0-based ${o.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function an(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function on(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function sn(e,t){if(!F(t))return on(e,t.split(`.`))}function cn(e,t){return un(e,t.split(`.`))}function ln(e,t,n){if(!I(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&cn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function un(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=mn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>un(e,r)):un(a,r)}function F(e){return e.split(`.`).some(e=>mn(e).isArray)}function dn(e,t){return e.parameter.length===0||!I(t)?null:gn(t,[],hn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fn(t,n,r,i=0){let a=n.split(`.`),o=t;for(let[t,s]of a.entries()){let c=mn(s),l=t===a.length-1,u=pn(o,c,n,l,r,i);if(!u.ok||u.data===null)return e(u.summary,u.warnings);if(l)return y(`Body value assigned`,null);o=u.data}return e(`${n} is not a valid body option path.`)}function pn(t,n,r,i,a,o){let s=()=>e(`${r} cannot be combined with another body option at ${n.key}.`),c=t[n.key];if(n.isArray){if(c!==void 0&&!Array.isArray(c))return s();let e=c??[];if(c===void 0&&(t[n.key]=e),i)return e[o]===void 0?(e[o]=a,y(`Body value assigned`,t)):s();let r=e[o];if(r===void 0){let t={};return e[o]=t,y(`Body path created`,t)}return I(r)?y(`Body path stepped`,r):s()}if(i)return c===void 0?(t[n.key]=a,y(`Body value assigned`,t)):s();if(c===void 0){let e={};return t[n.key]=e,y(`Body path created`,e)}return I(c)?y(`Body path stepped`,c):s()}function mn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function hn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function gn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=gn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!_n(a,n)){if(!vn(e))continue;return{path:a,suggestion:yn(e,n)}}let o=gn(i,e,n);if(o!==null)return o}return null}function _n(e,t){return t.prefix.has(e)||t.leaf.has(e)}function vn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function yn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:bn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function bn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function xn(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(Ge(e)),t.description=m(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?kn(r,i):r===void 0?i===void 0?0:1:-1})}function Sn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Cn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function wn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Dn(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Tn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function En(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?We(n):`${We(n)} Required JSON paths: ${r.join(`, `)}.`}function Dn(e,t){let n=Ue(t.description,void 0),r=e.kind!==`multipart`&&F(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${On(e,t)}`}function On(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Zt(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function kn(e,t){return qe(e)-qe(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function An(t){let n;try{n=t===`-`?await jn():await Ht(t,`utf8`)}catch(n){return e(`Could not read input: ${n.message}`,[`path=${t}`])}try{if(n.trim().length===0)return y(`No input provided`,null);let e=JSON.parse(n);return y(`Input parsed`,e)}catch(t){return e(`Input is not valid JSON: ${t.message}`)}}async function jn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var Mn=`--content-type`;function Nn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(Mn)){let t=i.map(({contentType:e})=>e);e.addOption(new b(`${Mn} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Fn(i)))}if($n(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new b(`--from-file <path>`,En(n,n.requiredPath)).argParser(Ln(`--from-file`)))}let a=Sn(i).filter(e=>r(L(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>kn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new b(Cn(t),i.length>1?wn(t):Dn(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?Tn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Pn):F(r.name)||r.schemaType===`array`?a.argParser(In):a.argParser(Ln(r.flag)),e.addOption(a),a.envVar!==void 0&&e.on(`optionEnv:${a.name()}`,()=>{let t=e.opts()[r.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(r.optionKey,t.trim(),`env`)})}Qn(e,t,a)}function Pn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Fn(e){return(t,n)=>{if(n!==void 0)throw new _(`${Mn} was already given; pass it once.`);let r=o(e,t);if(!r.ok)throw new _(r.summary);return t}}function In(e,t){return[...t??[],e]}function Ln(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new _(`${t} was already given; pass it once.`);return e}}async function Rn(t,n){let r=Qe(t,n),i=o(t.requestBody??[],r);if(!i.ok||i.data===null)return e(i.summary,i.warnings);let a=i.data;if(a===void 0)return y(`No body`,void 0);let s=zn(t,a,n);if(s!==null)return e(s);let c=Kt(t.operationId,a,n);if(!c.ok)return e(c.summary,c.warnings);n=c.data;let l=Bn(a,n);if(l!==null)return e(l);let u=await Wn(n);if(!u.ok)return e(u.summary,u.warnings);let d=ln(t.requestBody??[],a,u.data);if(d!==null)return e(d);let f=Un(t.operationId,a,u.data);if(!f.ok)return f;let p=qt(t.operationId,a,u.data);if(p!==null)return e(p);let m=Gn(t.operationId,a,n);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return a.required?e(Zn(t.operationId,a)):y(`No body`,void 0);let h=qn(t.operationId,a,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(a.schemaType===`array`&&!Array.isArray(h.data))return e(`${t.operationId} requires a JSON array body.`);if(a.parameter.length>0&&!I(h.data)){let n=a.kind===`multipart`?` keyed by multipart part name`:` body`;return e(`${t.operationId} requires a JSON object${n}.`)}let g=Hn(a,h.data);if(g.length>0)return e(`${t.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,v=I(_)?Jt(a).filter(e=>!cn(_,e)):[];return v.length>0?e(Vn(t.operationId,a,v)):h}function zn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${L(t)} requires ${Mn} ${i.join(` or `)}.`}return null}function Bn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Vn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Hn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!cn(t,e.name)).map(L):[]}function Un(t,n,r){let i=dn(n,r);if(i===null)return y(`Body file paths validated`,null);let a=i.suggestion===void 0?``:` Use ${i.suggestion}.`;return e(`${t} --from-file contains unknown JSON path ${i.path}.${a}`)}async function Wn(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return y(`No body file`,void 0);let r=await An(n);if(!r.ok)return e(r.summary,r.warnings);let i=a.safeParse(r.data);return i.success?y(`Input parsed`,i.data):e(`Input is not valid JSON value: ${i.error.message}`)}function Gn(t,n,r){let i={},a=!1;for(let t of n.parameter){let o=$t(t,r[t.optionKey]);if(!o.ok||o.data===null)return e(o.summary,o.warnings);let s=o.data;if(s===void 0)continue;let c=Kn(n,r,i,t,s);if(!c.ok)return e(c.summary,c.warnings);a=!0}if(!a)return y(`No direct body options`,void 0);let o=rn(t,n,r,i);return o===null?y(`Direct body options parsed`,i):o}function Kn(t,n,r,i,a){let o=tn(i,a);if(o===null){let t=Yn(i,a);return t.ok?Yt(r,i.name,t.data,i.schemaType===`array`):e(t.summary,t.warnings)}if(o.plain.length>0)return e(`${L(i)} mixes row-form values with plain value(s): ${o.plain.join(`, `)} — prefix every value with its 0-based ${o.container}[] row index, as 0:value.`);let s=nn(t,n,o.container);for(let t of o.rows.keys())if(!(t<s))return e(`${L(i)} names ${o.container}[] row ${t}, but these options build at most ${s} ${o.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[t,n]of o.rows){let a=[];for(let t of n){let n=Xn(i.name,i.itemSchemaType,t);if(!n.ok)return e(n.summary,n.warnings);a.push(n.data)}let o=Xt(r,i.name,t,a);if(!o.ok)return o}return y(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function qn(t,n,r,i){if(r===void 0)return y(`Direct body parsed`,i);if(i===void 0)return y(`Input parsed`,r);if(I(r)&&I(i))try{return y(`Input parsed`,Jn(n,r,i))}catch(n){return e(`${t} ${n.message}`)}return e(`${t} cannot combine --from-file with direct body options unless the file body is an object.`)}function Jn(e,t,n,r=``){let i={...t};for(let[t,a]of Object.entries(n)){let n=i[t],o=`${r}${t}`;if(I(n)&&I(a))i[t]=Jn(e,n,a,`${o}.`);else if(n===void 0||n===a)i[t]=a;else throw Error(`sets JSON key '${o}' both in --from-file and with ${e.parameter.find(({name:e})=>e===o)?.flag.split(` `)[0]??`body options`} — set it in one place${Array.isArray(n)?`: move the per-item fields inside the matching '${o}[]' object(s) in the file body`:ct.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function Yn(e,t){if(typeof t==`boolean`)return y(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return Xn(e.name,e.schemaType,t??``);let n=[],r=F(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=Xn(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return y(`Body value parsed`,n)}function Xn(t,n,r){if(n===`boolean`)return r===`true`?y(`Body value parsed`,!0):r===`false`?y(`Body value parsed`,!1):e(`${t} must be true or false.`);if(n===`number`||n===`integer`){let i=r.trim(),a=Number(i);return i===``||!Number.isFinite(a)?e(`${t} must be a finite ${n}.`):n===`integer`&&!Number.isInteger(a)?e(`${t} must be an integer.`):y(`Body value parsed`,a)}return y(`Body value parsed`,r)}function Zn(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(L).join(`, `)}`;let r=Jt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function Qn(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Mn,location:`body`}),$n(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),xn(e.options,r)}function $n(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function er(e){let t=ne(e);return lr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function tr(e){let t=ne(e);lr(t);let n=_t(t.data,t.summary),r=[];if(t.ok&&n!==null){let e=nr(t);r.push(n.endsWith(`
|
|
2
2
|
`)?n.slice(0,-1):n),r.push(...e),process.stdout.write(pt(r.join(`
|
|
3
3
|
`),!0,!0,e.length));return}let i=t.ok?`OK`:`FAIL`;r.push(`[${i}] ${t.summary}`),!t.ok&&t.problem!==void 0&&r.push(...ar(t.problem)),r.push(...nr(t)),process.stdout.write(pt(r.join(`
|
|
4
4
|
`),!0))}function nr(e){let t=[];e.ids.length>0&&t.push(` ids: ${e.ids.join(`, `)}`);for(let[n,r]of Object.entries(e.counts))t.push(` ${n}: ${r}`);for(let n of e.references)t.push(` ref: ${n}`);if(e.truncation!==void 0){let n=e.truncation.omitted.join(`, `);t.push(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${n}`,` recovery: ${e.truncation.recovery}`)}for(let n of e.warnings)t.push(` warn: ${n}`);return t}function R(e,t){if(e.mode===`data`||e.mode===`data-full`){let n=e.mode===`data`?ne(t):t;lr(n),process.stdout.write(`${JSON.stringify(n.ok&&n.truncated!==!0?rr(n.data):n)}\n`),n.ok||(process.exitCode=1);return}let n=e.mode===`json`?er(t):t;e.mode===`text`&&tr(n),n.ok||(process.exitCode=1)}function rr(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function ir(e,t){let n=ht(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
|