@aventurevc/aventure-cli 0.8.79 → 0.8.80
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-gIKw38Bn.js → aventure-cli-b77ujbYh.js} +1 -1
- package/dist/chunks/{client-D2xVR3vB.js → client-Crj4ZlqG.js} +1 -1
- package/dist/chunks/{oauth-bearer-credential-DuuqWL6b.js → oauth-bearer-credential-BCAM49rO.js} +2 -2
- package/dist/chunks/oauth-login-C24wzgmD.js +1 -0
- package/dist/chunks/{oauth-login-O_m33YmN.js → oauth-login-Dx0-i5Kr.js} +1 -1
- package/dist/chunks/openapi-commands-CcltxKpW.js +1 -0
- package/dist/chunks/provider-catalog-C7Q6SSmn.js +1 -0
- package/dist/chunks/text-field-Dg2MUYnB.js +3 -0
- package/dist/chunks/{text-response-MHwEl0Wj.js → text-response--7xESGBO.js} +1 -1
- package/package.json +3 -3
- package/dist/chunks/oauth-login-ID3f1Wnq.js +0 -1
- package/dist/chunks/openapi-commands-BtQf7g2h.js +0 -1
- package/dist/chunks/provider-catalog-Cnvq-UNM.js +0 -1
- package/dist/chunks/text-field-DEhUx5G3.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{_i as e,ci as t,gi as n,la as r,ui as i}from"../chunks/client-
|
|
2
|
+
import{_i as e,ci as t,gi as n,la as r,ui as i}from"../chunks/client-Crj4ZlqG.js";import{t as a,v as o}from"../chunks/oauth-bearer-credential-BCAM49rO.js";import{i as s}from"../chunks/text-field-Dg2MUYnB.js";import{c,i as l,t as u}from"../chunks/openapi-commands-CcltxKpW.js";var d=process.argv.slice(2);l(d)&&i(!1),d.includes(`--all-fields`)&&s(!0);try{if(e(),c(d,u)===`optional`)try{await a(),await o()}catch(e){t({component:n().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:e})}await import(`../chunks/aventure-cli-b77ujbYh.js`)}catch(e){if(!(e instanceof r))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "MCP_GENERATION_CONTRACT",
|
|
4
|
-
"generatedAt": "2026-10-06T22:
|
|
4
|
+
"generatedAt": "2026-10-06T22:58:45.259Z",
|
|
5
5
|
"totalOperations": 136,
|
|
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,C as t,Ci as n,D as r,Di as i,Oi as a,S as o,Ti as s,a as c,b as l,bi as u,c as d,ca as f,ci as p,d as m,f as h,gi as g,i as _,ki as v,l as y,m as b,mi as ee,n as te,o as x,oa as ne,oi as re,p as ie,r as ae,sa as S,u as oe,ua as se,v as ce,vi as C,wi as le,xi as ue,y as de}from"./client-D2xVR3vB.js";import{M as fe,O as pe,i as w,o as me,v as he,w as T,y as E}from"./person-owner-BJgNYLKX.js";import{A as ge,C as _e,D as ve,M as D,N as ye,O as be,S as xe,T as Se,a as Ce,b as we,c as Te,d as Ee,g as De,j as Oe,k as ke,l as Ae,m as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./oauth-bearer-credential-DuuqWL6b.js";import{c as Ve,d as He,h as Ue,m as We,o as Ge,p as Ke,s as qe,u as Je}from"./text-field-DEhUx5G3.js";import{a as Ye,c as Xe,d as Ze,f as Qe,g as $e,h as et,l as tt,m as nt,n as rt,o as O,p as it,r as k,s as at,t as A,u as ot}from"./openapi-commands-BtQf7g2h.js";import{a as st,f as ct,i as lt,l as ut,n as dt,o as ft,r as j,s as pt,t as mt}from"./text-response-MHwEl0Wj.js";import{n as ht,r as gt,t as _t}from"./oauth-login-O_m33YmN.js";import{spawnSync as vt}from"node:child_process";import{basename as yt,dirname as M,resolve as N,sep as bt}from"node:path";import{copyFileSync as xt,existsSync as St,lstatSync as Ct,mkdirSync as wt,mkdtempSync as Tt,readFileSync as Et,readlinkSync as Dt,realpathSync as Ot,renameSync as kt,rmdirSync as At,unlinkSync as jt,writeFileSync as Mt}from"node:fs";import P,{stderr as F,stdin as Nt}from"node:process";import{TextDecoder as Pt,inspect as Ft}from"node:util";import{fileURLToPath as It}from"node:url";import{readFile as Lt}from"node:fs/promises";import{setTimeout as Rt}from"node:timers/promises";import{webcrypto as zt}from"node:crypto";import{homedir as Bt,hostname as Vt,platform as Ht}from"node:os";import{createInterface as Ut}from"node:readline/promises";function Wt(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let o=r[n.optionKey];if(o!==void 0&&(typeof o!=`string`||o!==i))return{...a(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};o===void 0&&(r[n.optionKey]=i)}return v(`Environment-bound options applied`,r)}function Gt(e,t,n){if(!L(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||!on(n,r.name))continue;let a=an(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 Kt(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 qt(e,t,n,r=!1){if(r||!I(t)||!Array.isArray(n))return un(e,t,n);for(let[r,i]of n.entries()){let n=un(e,t,i,r);if(!n.ok)return n}return v(`Body value assigned`,null)}function Jt(e,t,n,r){return un(e,t,r,n)}function Yt(e){let t=[];for(let n of e.split(`.`)){let e=fn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Xt(e,t){let n=Yt(t);if(n===null)return null;let r=rn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:nn(r)}:null}function Zt(e,t){if(I(e.name)||e.schemaType===`array`)return v(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return v(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?v(`Scalar body option selected`,t[0]):a(`${n} was already given; pass it once.`)}var Qt=/^(?<row>\d+):(?<item>.*)$/su;function $t(e,t){let n=Yt(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=Qt.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 en(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Yt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function tn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let o=Xt(r,i.name);if(o===null)continue;if(o.firstHole!==null)return a(`${e} has no ${o.path}[] row ${o.firstHole} — number ${o.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||o.rowCount<=1||$t(i,t)!==null)continue;let s=i.flag.split(` `)[0]??i.name;return a(`${s} fills one ${o.path}[] row's list, so ${e} 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 nn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function rn(e,t){let n=e;for(let e of t){if(!L(n))return;n=n[e]??null}return n}function an(e,t){if(!I(t))return rn(e,t.split(`.`))}function on(e,t){return cn(e,t.split(`.`))}function sn(e,t,n){if(!L(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)&&on(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function cn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=fn(n);if(!L(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>cn(e,r)):cn(a,r)}function I(e){return e.split(`.`).some(e=>fn(e).isArray)}function ln(e,t){return e.parameter.length===0||!L(t)?null:mn(t,[],pn(e.parameter))}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function un(e,t,n,r=0){let i=t.split(`.`),o=e;for(let[e,s]of i.entries()){let c=fn(s),l=e===i.length-1,u=dn(o,c,t,l,n,r);if(!u.ok||u.data===null)return a(u.summary,u.warnings);if(l)return v(`Body value assigned`,null);o=u.data}return a(`${t} is not a valid body option path.`)}function dn(e,t,n,r,i,o){let s=()=>a(`${n} cannot be combined with another body option at ${t.key}.`),c=e[t.key];if(t.isArray){if(c!==void 0&&!Array.isArray(c))return s();let n=c??[];if(c===void 0&&(e[t.key]=n),r)return n[o]===void 0?(n[o]=i,v(`Body value assigned`,e)):s();let a=n[o];if(a===void 0){let e={};return n[o]=e,v(`Body path created`,e)}return L(a)?v(`Body path stepped`,a):s()}if(r)return c===void 0?(e[t.key]=i,v(`Body value assigned`,e)):s();if(c===void 0){let n={};return e[t.key]=n,v(`Body path created`,n)}return L(c)?v(`Body path stepped`,c):s()}function fn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function pn(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 mn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=mn(r,t,n);if(e!==null)return e}return null}if(!L(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!hn(a,n)){if(!gn(e))continue;return{path:a,suggestion:_n(e,n)}}let o=mn(i,e,n);if(o!==null)return o}return null}function hn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function gn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function _n(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:vn(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 vn(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 yn(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(We(e)),t.description=d(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?Dn(r,i):r===void 0?i===void 0?0:1:-1})}function bn(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 xn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Sn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Tn(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 Cn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function wn(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?Ue(n):`${Ue(n)} Required JSON paths: ${r.join(`, `)}.`}function Tn(e,t){let n=He(t.description,void 0),r=e.kind!==`multipart`&&I(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}.`:``}${En(e,t)}`}function En(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Yt(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 Dn(e,t){return Ke(e)-Ke(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function On(e){let t;try{t=e===`-`?await kn():await Lt(e,`utf8`)}catch(t){return a(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return v(`No input provided`,null);let e=JSON.parse(t);return v(`Input parsed`,e)}catch(e){return a(`Input is not valid JSON: ${e.message}`)}}async function kn(){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 An=`--content-type`;function jn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(An)){let t=i.map(({contentType:e})=>e);e.addOption(new S(`${An} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Nn(i)))}if(Qn(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new S(`--from-file <path>`,wn(n,n.requiredPath)).argParser(Fn(`--from-file`)))}let a=bn(i).filter(e=>r(R(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>Dn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new S(xn(t),i.length>1?Sn(t):Tn(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?Cn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Mn):I(r.name)||r.schemaType===`array`?a.argParser(Pn):a.argParser(Fn(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`)})}Zn(e,t,a)}function Mn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Nn(e){return(t,n)=>{if(n!==void 0)throw new se(`${An} was already given; pass it once.`);let i=r(e,t);if(!i.ok)throw new se(i.summary);return t}}function Pn(e,t){return[...t??[],e]}function Fn(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new se(`${t} was already given; pass it once.`);return e}}async function In(e,t){let n=Ze(e,t),i=r(e.requestBody??[],n);if(!i.ok||i.data===null)return a(i.summary,i.warnings);let o=i.data;if(o===void 0)return v(`No body`,void 0);let s=Ln(e,o,t);if(s!==null)return a(s);let c=Wt(e.operationId,o,t);if(!c.ok)return a(c.summary,c.warnings);t=c.data;let l=Rn(o,t);if(l!==null)return a(l);let u=await Hn(t);if(!u.ok)return a(u.summary,u.warnings);let d=sn(e.requestBody??[],o,u.data);if(d!==null)return a(d);let f=Vn(e.operationId,o,u.data);if(!f.ok)return f;let p=Gt(e.operationId,o,u.data);if(p!==null)return a(p);let m=Un(e.operationId,o,t);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return o.required?a(Xn(e.operationId,o)):v(`No body`,void 0);let h=Gn(e.operationId,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(o.schemaType===`array`&&!Array.isArray(h.data))return a(`${e.operationId} requires a JSON array body.`);if(o.parameter.length>0&&!L(h.data)){let t=o.kind===`multipart`?` keyed by multipart part name`:` body`;return a(`${e.operationId} requires a JSON object${t}.`)}let g=Bn(o,h.data);if(g.length>0)return a(`${e.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=L(_)?Kt(o).filter(e=>!on(_,e)):[];return y.length>0?a(zn(e.operationId,o,y)):h}function Ln(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`${R(t)} requires ${An} ${i.join(` or `)}.`}return null}function Rn(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 zn(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 Bn(e,t){return L(t)?e.parameter.filter(e=>e.required&&!on(t,e.name)).map(R):[]}function Vn(e,t,n){let r=ln(t,n);if(r===null)return v(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return a(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Hn(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return v(`No body file`,void 0);let r=await On(n);if(!r.ok)return a(r.summary,r.warnings);let i=e.safeParse(r.data);return i.success?v(`Input parsed`,i.data):a(`Input is not valid JSON value: ${i.error.message}`)}function Un(e,t,n){let r={},i=!1;for(let e of t.parameter){let o=Zt(e,n[e.optionKey]);if(!o.ok||o.data===null)return a(o.summary,o.warnings);let s=o.data;if(s===void 0)continue;let c=Wn(t,n,r,e,s);if(!c.ok)return a(c.summary,c.warnings);i=!0}if(!i)return v(`No direct body options`,void 0);let o=tn(e,t,n,r);return o===null?v(`Direct body options parsed`,r):o}function Wn(e,t,n,r,i){let o=$t(r,i);if(o===null){let e=Jn(r,i);return e.ok?qt(n,r.name,e.data,r.schemaType===`array`):a(e.summary,e.warnings)}if(o.plain.length>0)return a(`${R(r)} 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=en(e,t,o.container);for(let e of o.rows.keys())if(!(e<s))return a(`${R(r)} names ${o.container}[] row ${e}, 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[e,t]of o.rows){let i=[];for(let e of t){let t=Yn(r.name,r.itemSchemaType,e);if(!t.ok)return a(t.summary,t.warnings);i.push(t.data)}let o=Jt(n,r.name,e,i);if(!o.ok)return o}return v(`Body value assigned`,null)}var R=e=>e.flag.split(` `)[0]??e.name;function Gn(e,t,n){if(t===void 0)return v(`Direct body parsed`,n);if(n===void 0)return v(`Input parsed`,t);if(L(t)&&L(n))try{return v(`Input parsed`,Kn(t,n))}catch(t){return a(`${e} ${t.message}`)}return a(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function Kn(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(Array.isArray(t)&&Array.isArray(r))throw Error(`cannot combine --from-file array '${e}' with array body options at the same key — move the per-item fields inside the matching '${e}[]' object(s) in the file body.`);if(t!==void 0&&qn(t)!==qn(r))throw Error(`cannot combine --from-file ${qn(t)} '${e}' with ${qn(r)} body option(s) at the same key — align the file body shape with the schema.`);n[e]=L(t)&&L(r)?Kn(t,r):r}return n}function qn(e){return Array.isArray(e)?`array`:L(e)?`object`:`scalar`}function Jn(e,t){if(typeof t==`boolean`)return v(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return Yn(e.name,e.schemaType,t??``);let n=[],r=I(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=Yn(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return v(`Body value parsed`,n)}function Yn(e,t,n){if(t===`boolean`)return n===`true`?v(`Body value parsed`,!0):n===`false`?v(`Body value parsed`,!1):a(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?a(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?a(`${e} must be an integer.`):v(`Body value parsed`,i)}return v(`Body value parsed`,n)}function Xn(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(R).join(`, `)}`;let r=Kt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(R).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function Zn(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:An,location:`body`}),Qn(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),yn(e.options,r)}function Qn(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function $n(e){let t=i(e);return cr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function er(e){let t=i(e);cr(t);let n=mt(t.data,t.summary);if(t.ok&&n!==null){process.stdout.write(n.endsWith(`
|
|
1
|
+
import{Ai as e,C as t,Ci as n,D as r,Di as i,Oi as a,S as o,Ti as s,a as c,b as l,bi as u,c as d,ca as f,ci as p,d as m,f as h,gi as g,i as _,ki as v,l as y,m as b,mi as ee,n as te,o as x,oa as ne,oi as re,p as ie,r as ae,sa as S,u as oe,ua as se,v as ce,vi as C,wi as le,xi as ue,y as de}from"./client-Crj4ZlqG.js";import{M as fe,O as pe,i as w,o as me,v as he,w as T,y as E}from"./person-owner-BJgNYLKX.js";import{A as ge,C as _e,D as ve,M as D,N as ye,O as be,S as xe,T as Se,a as Ce,b as we,c as Te,d as Ee,g as De,j as Oe,k as ke,l as Ae,m as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./oauth-bearer-credential-BCAM49rO.js";import{c as Ve,d as He,h as Ue,m as We,o as Ge,p as Ke,s as qe,u as Je}from"./text-field-Dg2MUYnB.js";import{a as Ye,c as Xe,d as Ze,f as Qe,g as $e,h as et,l as tt,m as nt,n as rt,o as O,p as it,r as k,s as at,t as A,u as ot}from"./openapi-commands-CcltxKpW.js";import{a as st,f as ct,i as lt,l as ut,n as dt,o as ft,r as j,s as pt,t as mt}from"./text-response--7xESGBO.js";import{n as ht,r as gt,t as _t}from"./oauth-login-Dx0-i5Kr.js";import{spawnSync as vt}from"node:child_process";import{basename as yt,dirname as M,resolve as N,sep as bt}from"node:path";import{copyFileSync as xt,existsSync as St,lstatSync as Ct,mkdirSync as wt,mkdtempSync as Tt,readFileSync as Et,readlinkSync as Dt,realpathSync as Ot,renameSync as kt,rmdirSync as At,unlinkSync as jt,writeFileSync as Mt}from"node:fs";import P,{stderr as F,stdin as Nt}from"node:process";import{TextDecoder as Pt,inspect as Ft}from"node:util";import{fileURLToPath as It}from"node:url";import{readFile as Lt}from"node:fs/promises";import{setTimeout as Rt}from"node:timers/promises";import{webcrypto as zt}from"node:crypto";import{homedir as Bt,hostname as Vt,platform as Ht}from"node:os";import{createInterface as Ut}from"node:readline/promises";function Wt(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let o=r[n.optionKey];if(o!==void 0&&(typeof o!=`string`||o!==i))return{...a(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};o===void 0&&(r[n.optionKey]=i)}return v(`Environment-bound options applied`,r)}function Gt(e,t,n){if(!L(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||!on(n,r.name))continue;let a=an(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 Kt(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 qt(e,t,n,r=!1){if(r||!I(t)||!Array.isArray(n))return un(e,t,n);for(let[r,i]of n.entries()){let n=un(e,t,i,r);if(!n.ok)return n}return v(`Body value assigned`,null)}function Jt(e,t,n,r){return un(e,t,r,n)}function Yt(e){let t=[];for(let n of e.split(`.`)){let e=fn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Xt(e,t){let n=Yt(t);if(n===null)return null;let r=rn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:nn(r)}:null}function Zt(e,t){if(I(e.name)||e.schemaType===`array`)return v(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return v(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?v(`Scalar body option selected`,t[0]):a(`${n} was already given; pass it once.`)}var Qt=/^(?<row>\d+):(?<item>.*)$/su;function $t(e,t){let n=Yt(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=Qt.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 en(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Yt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function tn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let o=Xt(r,i.name);if(o===null)continue;if(o.firstHole!==null)return a(`${e} has no ${o.path}[] row ${o.firstHole} — number ${o.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||o.rowCount<=1||$t(i,t)!==null)continue;let s=i.flag.split(` `)[0]??i.name;return a(`${s} fills one ${o.path}[] row's list, so ${e} 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 nn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function rn(e,t){let n=e;for(let e of t){if(!L(n))return;n=n[e]??null}return n}function an(e,t){if(!I(t))return rn(e,t.split(`.`))}function on(e,t){return cn(e,t.split(`.`))}function sn(e,t,n){if(!L(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)&&on(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function cn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=fn(n);if(!L(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>cn(e,r)):cn(a,r)}function I(e){return e.split(`.`).some(e=>fn(e).isArray)}function ln(e,t){return e.parameter.length===0||!L(t)?null:mn(t,[],pn(e.parameter))}function L(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function un(e,t,n,r=0){let i=t.split(`.`),o=e;for(let[e,s]of i.entries()){let c=fn(s),l=e===i.length-1,u=dn(o,c,t,l,n,r);if(!u.ok||u.data===null)return a(u.summary,u.warnings);if(l)return v(`Body value assigned`,null);o=u.data}return a(`${t} is not a valid body option path.`)}function dn(e,t,n,r,i,o){let s=()=>a(`${n} cannot be combined with another body option at ${t.key}.`),c=e[t.key];if(t.isArray){if(c!==void 0&&!Array.isArray(c))return s();let n=c??[];if(c===void 0&&(e[t.key]=n),r)return n[o]===void 0?(n[o]=i,v(`Body value assigned`,e)):s();let a=n[o];if(a===void 0){let e={};return n[o]=e,v(`Body path created`,e)}return L(a)?v(`Body path stepped`,a):s()}if(r)return c===void 0?(e[t.key]=i,v(`Body value assigned`,e)):s();if(c===void 0){let n={};return e[t.key]=n,v(`Body path created`,n)}return L(c)?v(`Body path stepped`,c):s()}function fn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function pn(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 mn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=mn(r,t,n);if(e!==null)return e}return null}if(!L(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!hn(a,n)){if(!gn(e))continue;return{path:a,suggestion:_n(e,n)}}let o=mn(i,e,n);if(o!==null)return o}return null}function hn(e,t){return t.prefix.has(e)||t.leaf.has(e)}function gn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function _n(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:vn(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 vn(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 yn(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(We(e)),t.description=d(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?Dn(r,i):r===void 0?i===void 0?0:1:-1})}function bn(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 xn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Sn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Tn(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 Cn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function wn(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?Ue(n):`${Ue(n)} Required JSON paths: ${r.join(`, `)}.`}function Tn(e,t){let n=He(t.description,void 0),r=e.kind!==`multipart`&&I(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}.`:``}${En(e,t)}`}function En(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Yt(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 Dn(e,t){return Ke(e)-Ke(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function On(e){let t;try{t=e===`-`?await kn():await Lt(e,`utf8`)}catch(t){return a(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return v(`No input provided`,null);let e=JSON.parse(t);return v(`Input parsed`,e)}catch(e){return a(`Input is not valid JSON: ${e.message}`)}}async function kn(){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 An=`--content-type`;function jn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(An)){let t=i.map(({contentType:e})=>e);e.addOption(new S(`${An} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Nn(i)))}if(Qn(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new S(`--from-file <path>`,wn(n,n.requiredPath)).argParser(Fn(`--from-file`)))}let a=bn(i).filter(e=>r(R(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>Dn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new S(xn(t),i.length>1?Sn(t):Tn(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?Cn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Mn):I(r.name)||r.schemaType===`array`?a.argParser(Pn):a.argParser(Fn(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`)})}Zn(e,t,a)}function Mn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Nn(e){return(t,n)=>{if(n!==void 0)throw new se(`${An} was already given; pass it once.`);let i=r(e,t);if(!i.ok)throw new se(i.summary);return t}}function Pn(e,t){return[...t??[],e]}function Fn(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new se(`${t} was already given; pass it once.`);return e}}async function In(e,t){let n=Ze(e,t),i=r(e.requestBody??[],n);if(!i.ok||i.data===null)return a(i.summary,i.warnings);let o=i.data;if(o===void 0)return v(`No body`,void 0);let s=Ln(e,o,t);if(s!==null)return a(s);let c=Wt(e.operationId,o,t);if(!c.ok)return a(c.summary,c.warnings);t=c.data;let l=Rn(o,t);if(l!==null)return a(l);let u=await Hn(t);if(!u.ok)return a(u.summary,u.warnings);let d=sn(e.requestBody??[],o,u.data);if(d!==null)return a(d);let f=Vn(e.operationId,o,u.data);if(!f.ok)return f;let p=Gt(e.operationId,o,u.data);if(p!==null)return a(p);let m=Un(e.operationId,o,t);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return o.required?a(Xn(e.operationId,o)):v(`No body`,void 0);let h=Gn(e.operationId,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(o.schemaType===`array`&&!Array.isArray(h.data))return a(`${e.operationId} requires a JSON array body.`);if(o.parameter.length>0&&!L(h.data)){let t=o.kind===`multipart`?` keyed by multipart part name`:` body`;return a(`${e.operationId} requires a JSON object${t}.`)}let g=Bn(o,h.data);if(g.length>0)return a(`${e.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=L(_)?Kt(o).filter(e=>!on(_,e)):[];return y.length>0?a(zn(e.operationId,o,y)):h}function Ln(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`${R(t)} requires ${An} ${i.join(` or `)}.`}return null}function Rn(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 zn(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 Bn(e,t){return L(t)?e.parameter.filter(e=>e.required&&!on(t,e.name)).map(R):[]}function Vn(e,t,n){let r=ln(t,n);if(r===null)return v(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return a(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Hn(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return v(`No body file`,void 0);let r=await On(n);if(!r.ok)return a(r.summary,r.warnings);let i=e.safeParse(r.data);return i.success?v(`Input parsed`,i.data):a(`Input is not valid JSON value: ${i.error.message}`)}function Un(e,t,n){let r={},i=!1;for(let e of t.parameter){let o=Zt(e,n[e.optionKey]);if(!o.ok||o.data===null)return a(o.summary,o.warnings);let s=o.data;if(s===void 0)continue;let c=Wn(t,n,r,e,s);if(!c.ok)return a(c.summary,c.warnings);i=!0}if(!i)return v(`No direct body options`,void 0);let o=tn(e,t,n,r);return o===null?v(`Direct body options parsed`,r):o}function Wn(e,t,n,r,i){let o=$t(r,i);if(o===null){let e=Jn(r,i);return e.ok?qt(n,r.name,e.data,r.schemaType===`array`):a(e.summary,e.warnings)}if(o.plain.length>0)return a(`${R(r)} 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=en(e,t,o.container);for(let e of o.rows.keys())if(!(e<s))return a(`${R(r)} names ${o.container}[] row ${e}, 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[e,t]of o.rows){let i=[];for(let e of t){let t=Yn(r.name,r.itemSchemaType,e);if(!t.ok)return a(t.summary,t.warnings);i.push(t.data)}let o=Jt(n,r.name,e,i);if(!o.ok)return o}return v(`Body value assigned`,null)}var R=e=>e.flag.split(` `)[0]??e.name;function Gn(e,t,n){if(t===void 0)return v(`Direct body parsed`,n);if(n===void 0)return v(`Input parsed`,t);if(L(t)&&L(n))try{return v(`Input parsed`,Kn(t,n))}catch(t){return a(`${e} ${t.message}`)}return a(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function Kn(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(Array.isArray(t)&&Array.isArray(r))throw Error(`cannot combine --from-file array '${e}' with array body options at the same key — move the per-item fields inside the matching '${e}[]' object(s) in the file body.`);if(t!==void 0&&qn(t)!==qn(r))throw Error(`cannot combine --from-file ${qn(t)} '${e}' with ${qn(r)} body option(s) at the same key — align the file body shape with the schema.`);n[e]=L(t)&&L(r)?Kn(t,r):r}return n}function qn(e){return Array.isArray(e)?`array`:L(e)?`object`:`scalar`}function Jn(e,t){if(typeof t==`boolean`)return v(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return Yn(e.name,e.schemaType,t??``);let n=[],r=I(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=Yn(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return v(`Body value parsed`,n)}function Yn(e,t,n){if(t===`boolean`)return n===`true`?v(`Body value parsed`,!0):n===`false`?v(`Body value parsed`,!1):a(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?a(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?a(`${e} must be an integer.`):v(`Body value parsed`,i)}return v(`Body value parsed`,n)}function Xn(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(R).join(`, `)}`;let r=Kt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(R).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function Zn(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:An,location:`body`}),Qn(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),yn(e.options,r)}function Qn(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function $n(e){let t=i(e);return cr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function er(e){let t=i(e);cr(t);let n=mt(t.data,t.summary);if(t.ok&&n!==null){process.stdout.write(n.endsWith(`
|
|
2
2
|
`)?n:`${n}\n`),tr(t);return}let r=t.ok?`OK`:`FAIL`;process.stdout.write(`[${r}] ${t.summary}\n`),!t.ok&&t.problem!==void 0&&ir(t.problem),tr(t)}function tr(e){e.ids.length>0&&process.stdout.write(` ids: ${e.ids.join(`, `)}\n`);for(let[t,n]of Object.entries(e.counts))process.stdout.write(` ${t}: ${n}\n`);for(let t of e.references)process.stdout.write(` ref: ${t}\n`);if(e.truncation!==void 0){let t=e.truncation.omitted.join(`, `);process.stdout.write(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${t}\n`),process.stdout.write(` recovery: ${e.truncation.recovery}\n`)}for(let t of e.warnings)process.stdout.write(` warn: ${t}\n`)}function z(e,t){if(e.mode===`data`||e.mode===`data-full`){let n=e.mode===`data`?i(t):t;cr(n),process.stdout.write(`${JSON.stringify(n.ok&&n.truncated!==!0?nr(n.data):n)}\n`),n.ok||(process.exitCode=1);return}let n=e.mode===`json`?$n(t):t;e.mode===`text`&&er(n),n.ok||(process.exitCode=1)}function nr(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 rr(e,t){let n=dt(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
|
|
3
3
|
`),process.exitCode=1;return}(e===`text`?process.stdout:process.stderr).write(n)}function ir(e){typeof e.code==`string`&&process.stdout.write(` code: ${e.code}\n`),typeof e.detail==`string`&&process.stdout.write(` detail: ${e.detail}\n`),typeof e.hint==`string`&&process.stdout.write(` hint: ${e.hint}\n`),typeof e.suggestion==`string`&&process.stdout.write(` suggestion: ${e.suggestion}\n`);let t=Object.entries(e.suggestions??{});if(t.length>0){let e=t.map(([e,t])=>`${e}=${t}`).join(`; `);process.stdout.write(` suggestions: ${e}\n`)}typeof e.requiredRole==`string`&&process.stdout.write(` requiredRole: ${e.requiredRole}\n`),ar(e),or(`unknownParameters`,e.unknownParameters),or(`validParameters`,e.validParameters),sr(e.resolution)}function ar(e){let t=[];typeof e.limitType==`string`&&t.push(`limitType=${e.limitType}`),typeof e.used==`number`&&t.push(`used=${e.used}`),typeof e.limit==`number`&&t.push(`limit=${e.limit}`),typeof e.remaining==`number`&&t.push(`remaining=${e.remaining}`),typeof e.resetAt==`string`&&t.push(`resetAt=${e.resetAt}`),typeof e.windowSeconds==`number`&&t.push(`windowSeconds=${e.windowSeconds}`),typeof e.retryAfterSeconds==`number`&&t.push(`retryAfterSeconds=${e.retryAfterSeconds}`),t.length>0&&process.stdout.write(` meter: ${t.join(` `)}\n`)}function or(e,t){t!=null&&t.length>0&&process.stdout.write(` ${e}: ${t.join(`, `)}\n`)}function sr(e){if(e==null)return;let t=[`action=${e.action}`];typeof e.parameter==`string`&&t.push(`parameter=${e.parameter}`),typeof e.fieldPath==`string`&&t.push(`fieldPath=${e.fieldPath}`),typeof e.endpoint==`string`&&t.push(`endpoint=${e.endpoint}`),e.acceptedValue!==null&&e.acceptedValue!==void 0&&e.acceptedValue.length>0&&t.push(`acceptedValue=${e.acceptedValue.join(`, `)}`),typeof e.retryable==`boolean`&&t.push(`retryable=${e.retryable}`),process.stdout.write(` resolution: ${t.join(` `)}\n`)}function cr(e){e.ok&&e.warnings.length===0||p({component:g().bin[0],event:e.ok?`command_warning`:`command_failed`,message:e.warnings.length>0?e.warnings.join(` | `):e.summary,fields:{warningCount:e.warnings.length,summary:e.summary}})}function lr(e,t,n=g().bin[0]){let r=e.limit===void 0?void 0:Number(e.limit);if(r!==void 0&&(e.limit?.trim()===``||!Number.isInteger(r)||r<0))return a(`Invalid --limit value: ${JSON.stringify(e.limit)} (expected a non-negative integer)`,["Pass a non-negative integer, e.g. `--limit 20`."]);let i=ut(e.q??``,pt(t,n).filter(t=>pr(t,e)),e=>({...e,cliPath:e.cli.path,enumParameter:e.flags.map(({choices:e,location:t})=>({values:e,direct:t!==`body`})),parameterName:e.flags.flatMap(({wireName:e,optionKey:t})=>[e,t]),directParameterName:e.flags.filter(({location:e})=>e!==`body`).map(({wireName:e})=>e),parameterDescription:[e.body.description,...e.flags.map(({description:e})=>e)]})).map(({item:e})=>e),o=i.slice(0,r);return v(`Operation catalog matches`,{operation:o,count:{totalOperations:t.length,matched:i.length,returned:o.length}})}function ur(e,t,n=g().bin[0]){let r=pt(t,n),i=e.operationId===void 0?dr(r,e.command):r.find(t=>t.operationId===e.operationId);if(i===void 0){let i=vr(e.command??``),o=r.map(e=>e.cli.command).filter(e=>e.startsWith(`${n} ${i} `));if(o.length>0)return a(`${i} is a command group; show one of its subcommands.`,[`Run \`${n} command-catalog show --command "<subcommand>"\` with one of:`,...o]);let s=i.split(` `),c=new Set([...[...s.keys()].map(e=>s.slice(e+1).join(` `)),...s.slice(1).map((e,t)=>s.toSpliced(t,2,`${s[t]}-${e}`).join(` `))]),l=lr({q:e.command??e.operationId},t,n),u=[...r.filter(({cli:e})=>e.path.length>1&&c.has(e.path.join(` `))).toSorted((e,t)=>t.cli.path.length-e.cli.path.length),...l.data?.operation??[]];return a(`Generated operation not found`,[...[...new Set(u.map(({cli:e,operationId:t})=>`${e.command} (operationId ${t})`))].slice(0,3).map(e=>`closest: ${e}`),`List candidates with \`${n} command-catalog search "<text>"\`.`])}return v(`Generated operation detail`,{operation:i,usage:hr(i,r)})}function dr(e,t){if(t===void 0)return;let{bin:n}=g(),r=vr(t,n);return e.find(e=>vr(e.cli.command,n)===r)}var fr=(e,t)=>e===void 0||e===`all`||e===`any`||e===String(t);function pr(e,t){return(t.root===void 0||mr(e,t.root))&&fr(t.scope,e.scope)&&fr(t.mutates,e.mutates)&&fr(t.destructive,e.destructive)&&fr(t.intent,e.intent)&&fr(t.method,e.method)}function mr(e,t){let n=ct(t);return n.length===0||ct(e.cli.path.at(0)??``)===n}function hr(e,t){let n=lt(e);return[`cli: ${e.cli.command}`,`${e.method} ${e.path}`,`operationId: ${e.operationId}`,`resource: ${e.resource}`,`intent: ${e.intent}`,`scope: ${e.scope}`,`mutates: ${e.mutates}`,`destructive: ${e.destructive}`,`mcpTool: ${e.mcpTool??`unavailable (CLI-only operation)`}`,e.body.hasBody?`body: kind=${e.body.kind??`unknown`} required=${e.body.required} requiredPath=${e.body.requiredPath.join(`,`)}`:`body: none`,...[!0,!1].flatMap(e=>[`path`,`query`,`header`,`body`].map(t=>_r(`${e?`required`:`optional`} ${t} flags`,n.filter(n=>n.required===e&&n.location===t)))),...ft(e,t),...gr(e.errorResponse),``,e.summary,e.description].filter(e=>e.length>0).join(`
|
|
4
4
|
`)}function gr(e){return e.length===0?[]:[`Errors:`,...e.map(({status:e,description:t})=>` ${e} ${t}`)]}function _r(e,t){return`${e}: ${t.length===0?`none`:t.map(e=>e.name).join(` `)}`}function vr(e,t=g().bin){let[n=``,...r]=e.trim().split(/\s+/u);return(t.includes(n)?r:[n,...r]).join(` `)}var yr=`dist/aventure-cli/command-catalog.compact.txt`,br=` · `,xr=`-`;function Sr(e=g().bin[0]){return N(Cr(M(It(import.meta.url)),e),yr)}function Cr(e,t){let n=e;for(;;){if(St(N(n,`package.json`)))return n;let r=M(n);if(r===n)throw Error(`No package.json above ${e}; ${t} is not in a package layout.`);n=r}}function wr(e,t){let n=t.join(` `).trim();return n.length===0?e:{...e,q:e.q===void 0?n:`${e.q} ${n}`}}function Tr(e,t,n,r=g().bin[0]){let i=lr(e,t,r);if(!i.ok||i.data===null){z({mode:n},i);return}Dr({opts:e,mode:n,data:i.data,defaultFormat:`lines`,rendered:kr(i.data,Or(e.format,`lines`)),summary:`Generated operation matches`})}function Er(e,t,n,r=g().bin[0]){let i=ur(e,t,r);if(!i.ok||i.data===null){z({mode:n},i);return}Dr({opts:e,mode:n,data:i.data,defaultFormat:`usage`,rendered:Ar(i.data,Or(e.format,`usage`)),summary:`Generated operation detail`})}function Dr(e){let t=e.mode,n=Or(e.opts.format,e.defaultFormat),r=e.opts.text===!0||e.opts.allFields===!0;if(e.opts.output===void 0&&r&&(n===`json`||n===`ndjson`)){z({mode:t},a(`--text or --all-fields cannot be combined with --format json or ndjson`,[`Omit the text flag for machine output, or use --format lines, compact, or text.`]));return}let i=e.opts.output===void 0&&t===`text`&&`count`in e.data&&e.data.count.matched===0&&(r||e.opts.format===void 0||n===`text`)?`No generated operations matched.`:e.rendered,o=i.endsWith(`
|