@aventurevc/aventure-cli 0.8.185 → 0.8.186
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-g54kxG8S.js → aventure-cli-CkS2Nrdy.js} +1 -1
- package/dist/chunks/{contract-CQeFe7mk.js → contract-BGHL_lBv.js} +1 -1
- package/dist/chunks/{dist-Ce24grer.js → dist-CXpQ87Pz.js} +1 -1
- package/dist/chunks/oauth-bearer-credential-Cwn03TGq.js +1 -0
- package/dist/chunks/{oauth-bearer-credential-4hGvDZoQ.js → oauth-bearer-credential-DU8FTqw7.js} +2 -2
- package/dist/chunks/{oauth-login-BiXKKdqF.js → oauth-login-BvM3PU4d.js} +1 -1
- package/dist/chunks/oauth-login-c3frMYua.js +1 -0
- package/dist/chunks/output-mode-BlKnxa9F.js +1 -0
- package/dist/chunks/{output-mode-BW9Jfk5x.js → output-mode-vMKFzwSx.js} +1 -1
- package/dist/chunks/output-spill-DNpXqseL.js +1 -0
- package/dist/chunks/provider-catalog-B7G8OXYn.js +1 -0
- package/package.json +3 -3
- package/dist/chunks/oauth-bearer-credential-DJ2PA6d4.js +0 -1
- package/dist/chunks/oauth-login-BLRUSc5A.js +0 -1
- package/dist/chunks/output-mode-QxmCrOJw.js +0 -1
- package/dist/chunks/output-spill-CvlQjh5i.js +0 -1
- package/dist/chunks/provider-catalog-BxkTk-Lo.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-C5C6Bsga.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-
|
|
2
|
+
import{enableCompileCache as e}from"node:module";e();var{CommanderError:t}=await import(`../chunks/commander-Cj79cOD4.js`),{logWarn:n,setStderrLogging:r}=await import(`../chunks/logging-C5C6Bsga.js`),{readRuntimePackage:i}=await import(`../chunks/package-N5oYCiVc.js`),{locateRuntimeManifest:a}=await import(`../chunks/runtime-identity-Bva_KyCh.js`),{materializeCliOAuthBearerCredential:o,materializeSavedCliOAuthBearerCredential:s}=await import(`../chunks/oauth-bearer-credential-Cwn03TGq.js`),{materializeCliApiKeyBearerCredential:c}=await import(`../chunks/api-key-bearer-credential-B-1UINE8.js`),{commandAuthMaterializationMode:l}=await import(`../chunks/startup-auth-BCJtMtHx.js`),{setTextAllFields:u}=await import(`../chunks/text-field-CxrRvM47.js`),{cliMachineOutputSelected:d}=await import(`../chunks/output-mode-BlKnxa9F.js`),{GENERATED_OPENAPI_COMMAND_SPECS:f}=await import(`../chunks/openapi-commands-C0WAjaN3.js`),p=process.argv.slice(2);d(p)&&r(!1),p.includes(`--all-fields`)&&u(!0);try{a();let e=l(p,f);if(e===`stored`||e===`optional`)try{await(e===`stored`?s():o()),await c()}catch(e){n({component:i().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:e})}await import(`../chunks/aventure-cli-CkS2Nrdy.js`)}catch(e){if(!(e instanceof t))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-
|
|
4
|
+
"generatedAt": "2026-10-15T17:28:03.301Z",
|
|
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{a as e,n as t,o as n,r,t as i}from"./commander-BB7CDPLs.js";import{i as a,o}from"./logging-CDCaRpiW.js";import{i as s,o as c,r as l,s as u,t as d,u as f}from"./env-YDNggcP1.js";import{M as p,O as m,i as h,o as g,v as ee,w as _,y as v}from"./person-owner-BJgNYLKX.js";import{Ar as te,Br as ne,Mr as re,Or as ie,Pr as ae,jr as oe,kr as se,zr as ce}from"./dist-Ce24grer.js";import{c as y,d as le,i as b,r as ue}from"./result-envelope-D5wNfKzB.js";import{a as x,n as de,r as fe,t as pe}from"./package-DPDX5zmx.js";import{_ as me,b as he,c as ge,i as _e,s as ve,t as ye,v as be,y as xe}from"./tool-policy-D7R8FUUe.js";import{i as Se,r as Ce}from"./response-problem-DEZ2kyCp.js";import{n as we,r as Te}from"./output-spill-CvlQjh5i.js";import{a as Ee,c as De,d as Oe,g as ke,i as Ae,l as je,n as S,o as Me,p as Ne,r as Pe,s as Fe,u as Ie,x as Le,y as Re}from"./contract-CQeFe7mk.js";import{a as ze,c as Be,i as Ve,l as He,n as Ue,s as We,t as Ge}from"./cli-help-policy-RGOSoZ1Z.js";import{S as Ke,_ as qe,a as Je,g as C,h as Ye,i as Xe,m as Ze,n as Qe,p as $e,r as et,s as tt,t as nt,v as rt,x as w,y as it}from"./api-key-bearer-credential-BYpoThef.js";import{a as at,c as ot,d as st,g as ct,l as lt,m as ut,o as dt,s as ft,t as pt,u as mt}from"./oauth-bearer-credential-4hGvDZoQ.js";import{n as ht,r as gt,t as _t}from"./oauth-login-BiXKKdqF.js";import{a as vt,c as yt,d as bt,i as xt,l as St,n as Ct,o as wt,s as Tt,t as Et,u as Dt}from"./startup-auth-BJ3mNNZp.js";import{n as Ot,t as T}from"./openapi-commands-K3hFzG4D.js";import{i as E,r as kt,t as D}from"./output-mode-BW9Jfk5x.js";import{spawnSync as At}from"node:child_process";import{basename as O,dirname as k,relative as jt,resolve as A,sep as Mt}from"node:path";import{copyFileSync as Nt,existsSync as j,lstatSync as Pt,mkdirSync as M,mkdtempSync as Ft,readFileSync as It,readdirSync as Lt,readlinkSync as Rt,realpathSync as zt,renameSync as Bt,symlinkSync as Vt,writeFileSync as Ht}from"node:fs";import N,{stderr as P,stdin as Ut}from"node:process";import{TextDecoder as Wt,inspect as Gt}from"node:util";import{homedir as Kt,hostname as qt,platform as Jt}from"node:os";import{fileURLToPath as Yt}from"node:url";import{setTimeout as Xt}from"node:timers/promises";import{randomUUID as Zt,webcrypto as Qt}from"node:crypto";import{readFile as $t}from"node:fs/promises";import{createInterface as en}from"node:readline/promises";function tn(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 a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{...b(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return y(`Environment-bound options applied`,r)}function nn(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||!_n(n,r.name))continue;let a=gn(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 rn(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 an(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return xn(e,t,n);for(let[r,i]of n.entries()){let n=xn(e,t,i,r);if(!n.ok)return n}return y(`Body value assigned`,null)}function on(e,t,n,r){return xn(e,t,r,n)}function sn(e){let t=[];for(let n of e.split(`.`)){let e=Cn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function cn(e,t){let n=sn(t);if(n===null)return null;let r=hn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:mn(r)}:null}function ln(e,t){if(F(e.name)||e.schemaType===`array`)return y(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return y(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?y(`Scalar body option selected`,t[0]):b(`${n} was already given; pass it once.`)}var un=/^(?<row>\d+):(?<item>.*)$/su;function dn(e,t){let n=sn(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=un.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 fn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&sn(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function pn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=cn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return b(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||dn(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return b(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function mn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function hn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function gn(e,t){if(!F(t))return hn(e,t.split(`.`))}function _n(e,t){return yn(e,t.split(`.`))}function vn(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)&&_n(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function yn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Cn(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=>yn(e,r)):yn(a,r)}function F(e){return e.split(`.`).some(e=>Cn(e).isArray)}function bn(e,t){return e.parameter.length===0||!I(t)?null:Tn(t,[],wn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Cn(o),c=e===i.length-1,l=Sn(a,s,t,c,n,r);if(!l.ok||l.data===null)return b(l.summary,l.warnings);if(c)return y(`Body value assigned`,null);a=l.data}return b(`${t} is not a valid body option path.`)}function Sn(e,t,n,r,i,a){let o=()=>b(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,y(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,y(`Body path created`,e)}return I(c)?y(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,y(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,y(`Body path created`,n)}return I(s)?y(`Body path stepped`,s):o()}function Cn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function wn(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 Tn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Tn(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(!En(a,n)){if(!Dn(e))continue;let t=On(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=Tn(i,e,n);if(o!==null)return o}return null}function En(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Dn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function On(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:kn(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 kn(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}var An=e=>Array.isArray(e)&&!Object.isFrozen(e);function jn(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(Be(e)),t.description=ae(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!An(e))throw Error(`Commander option list is frozen; generated option help cannot be ordered.`);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?zn(r,i):r===void 0?i===void 0?0:1:-1})}function Mn(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 Nn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Pn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Ln(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 Fn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function In(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?He(n):`${He(n)} Required JSON paths: ${r.join(`, `)}.`}function Ln(e,t){let n=ze(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}.`:``}${Rn(e,t)}`}function Rn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=sn(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 zn(e,t){return We(e)-We(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Bn(e){let t;try{t=e===`-`?await Vn():await $t(e,`utf8`)}catch(t){return b(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return y(`No input provided`,null);let e=JSON.parse(t);return y(`Input parsed`,e)}catch(e){return b(`Input is not valid JSON: ${e.message}`)}}async function Vn(){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 Hn=`--content-type`;function Un(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Hn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Hn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Gn(a)))}if(lr(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,In(r,r.requiredPath)).argParser(qn(`--from-file`)))}let o=Mn(a).filter(e=>i(L(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>zn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Nn(n),a.length>1?Pn(n):Ln(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Fn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Wn):F(i.name)||i.schemaType===`array`?o.argParser(Kn):o.argParser(qn(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}cr(e,n,o)}function Wn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Gn(e){return(t,r)=>{if(r!==void 0)throw new n(`${Hn} was already given; pass it once.`);let i=me(e,t);if(!i.ok)throw new n(i.summary);return t}}function Kn(e,t){return[...t??[],e]}function qn(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function Jn(e,t){let n=wt(e,t),r=me(e.requestBody??[],n);if(!r.ok||r.data===null)return b(r.summary,r.warnings);let i=r.data;if(i===void 0)return y(`No body`,void 0);let a=Yn(e,i,t);if(a!==null)return b(a);let o=tn(e.operationId,i,t);if(!o.ok)return b(o.summary,o.warnings);t=o.data;let s=Xn(i,t);if(s!==null)return b(s);let c=await er(t);if(!c.ok)return b(c.summary,c.warnings);let l=vn(e.requestBody??[],i,c.data);if(l!==null)return b(l);let u=$n(e.operationId,i,c.data);if(!u.ok)return u;let d=nn(e.operationId,i,c.data);if(d!==null)return b(d);let f=tr(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?b(sr(e.operationId,i)):y(`No body`,void 0);let p=rr(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return b(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!I(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return b(`${e.operationId} requires a JSON object${t}.`)}let m=Qn(i,p.data);if(m.length>0)return b(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,g=I(h)?rn(i).filter(e=>!_n(h,e)):[];return g.length>0?b(Zn(e.operationId,i,g)):p}function Yn(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 ${Hn} ${i.join(` or `)}.`}return null}function Xn(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 Qn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!_n(t,e.name)).map(L):[]}function $n(e,t,n){let r=bn(t,n);if(r===null)return y(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return b(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function er(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return y(`No body file`,void 0);let n=await Bn(t);if(!n.ok)return b(n.summary,n.warnings);let r=le.safeParse(n.data);return r.success?y(`Input parsed`,r.data):b(`Input is not valid JSON value: ${r.error.message}`)}function tr(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=ln(e,n[e.optionKey]);if(!a.ok||a.data===null)return b(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=nr(t,n,r,e,o);if(!s.ok)return b(s.summary,s.warnings);i=!0}if(!i)return y(`No direct body options`,void 0);let a=pn(e,t,n,r);return a===null?y(`Direct body options parsed`,r):a}function nr(e,t,n,r,i){let a=dn(r,i);if(a===null){let e=ar(r,i);return e.ok?an(n,r.name,e.data,r.schemaType===`array`):b(e.summary,e.warnings)}if(a.plain.length>0)return b(`${L(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=fn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return b(`${L(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.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 a.rows){let i=[];for(let e of t){let t=or(r.name,r.itemSchemaType,e);if(!t.ok)return b(t.summary,t.warnings);i.push(t.data)}let a=on(n,r.name,e,i);if(!a.ok)return a}return y(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function rr(e,t,n,r){if(n===void 0)return y(`Direct body parsed`,r);if(r===void 0)return y(`Input parsed`,n);if(I(n)&&I(r))try{return y(`Input parsed`,ir(t,n,r))}catch(t){return b(`${e} ${t instanceof Error?t.message:String(t)}`)}return b(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function ir(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]=ir(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`:Me.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function ar(e,t){if(typeof t==`boolean`)return y(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return or(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=or(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return y(`Body value parsed`,n)}function or(e,t,n){if(t===`boolean`)return n===`true`?y(`Body value parsed`,!0):n===`false`?y(`Body value parsed`,!1):b(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?b(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?b(`${e} must be an integer.`):y(`Body value parsed`,i)}return y(`Body value parsed`,n)}function sr(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=rn(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 cr(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Hn,location:`body`}),lr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),jn(e.options,r)}function lr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function ur(e){let t=ue(e,Pe(e,T));return yr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function dr(e){let t=ue(e,Pe(e,T));yr(t);let n=Ae(T,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=fr(t);r.push(n.endsWith(`
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./commander-BB7CDPLs.js";import{i as a,o}from"./logging-CDCaRpiW.js";import{i as s,o as c,r as l,s as u,t as d,u as f}from"./env-YDNggcP1.js";import{M as p,O as m,i as h,o as g,v as ee,w as _,y as v}from"./person-owner-BJgNYLKX.js";import{Ar as te,Br as ne,Mr as re,Or as ie,Pr as ae,jr as oe,kr as se,zr as ce}from"./dist-CXpQ87Pz.js";import{c as y,d as le,i as b,r as ue}from"./result-envelope-D5wNfKzB.js";import{a as x,n as de,r as fe,t as pe}from"./package-DPDX5zmx.js";import{_ as me,b as he,c as ge,i as _e,s as ve,t as ye,v as be,y as xe}from"./tool-policy-D7R8FUUe.js";import{i as Se,r as Ce}from"./response-problem-DEZ2kyCp.js";import{n as we,r as Te}from"./output-spill-DNpXqseL.js";import{a as Ee,c as De,d as Oe,g as ke,i as Ae,l as je,n as S,o as Me,p as Ne,r as Pe,s as Fe,u as Ie,x as Le,y as Re}from"./contract-BGHL_lBv.js";import{a as ze,c as Be,i as Ve,l as He,n as Ue,s as We,t as Ge}from"./cli-help-policy-RGOSoZ1Z.js";import{S as Ke,_ as qe,a as Je,g as C,h as Ye,i as Xe,m as Ze,n as Qe,p as $e,r as et,s as tt,t as nt,v as rt,x as w,y as it}from"./api-key-bearer-credential-BYpoThef.js";import{a as at,c as ot,d as st,g as ct,l as lt,m as ut,o as dt,s as ft,t as pt,u as mt}from"./oauth-bearer-credential-DU8FTqw7.js";import{n as ht,r as gt,t as _t}from"./oauth-login-BvM3PU4d.js";import{a as vt,c as yt,d as bt,i as xt,l as St,n as Ct,o as wt,s as Tt,t as Et,u as Dt}from"./startup-auth-BJ3mNNZp.js";import{n as Ot,t as T}from"./openapi-commands-K3hFzG4D.js";import{i as E,r as kt,t as D}from"./output-mode-vMKFzwSx.js";import{spawnSync as At}from"node:child_process";import{basename as O,dirname as k,relative as jt,resolve as A,sep as Mt}from"node:path";import{copyFileSync as Nt,existsSync as j,lstatSync as Pt,mkdirSync as M,mkdtempSync as Ft,readFileSync as It,readdirSync as Lt,readlinkSync as Rt,realpathSync as zt,renameSync as Bt,symlinkSync as Vt,writeFileSync as Ht}from"node:fs";import N,{stderr as P,stdin as Ut}from"node:process";import{TextDecoder as Wt,inspect as Gt}from"node:util";import{homedir as Kt,hostname as qt,platform as Jt}from"node:os";import{fileURLToPath as Yt}from"node:url";import{setTimeout as Xt}from"node:timers/promises";import{randomUUID as Zt,webcrypto as Qt}from"node:crypto";import{readFile as $t}from"node:fs/promises";import{createInterface as en}from"node:readline/promises";function tn(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 a=r[n.optionKey];if(a!==void 0&&(typeof a!=`string`||a!==i))return{...b(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};a===void 0&&(r[n.optionKey]=i)}return y(`Environment-bound options applied`,r)}function nn(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||!_n(n,r.name))continue;let a=gn(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 rn(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 an(e,t,n,r=!1){if(r||!F(t)||!Array.isArray(n))return xn(e,t,n);for(let[r,i]of n.entries()){let n=xn(e,t,i,r);if(!n.ok)return n}return y(`Body value assigned`,null)}function on(e,t,n,r){return xn(e,t,r,n)}function sn(e){let t=[];for(let n of e.split(`.`)){let e=Cn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function cn(e,t){let n=sn(t);if(n===null)return null;let r=hn(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:mn(r)}:null}function ln(e,t){if(F(e.name)||e.schemaType===`array`)return y(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return y(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?y(`Scalar body option selected`,t[0]):b(`${n} was already given; pass it once.`)}var un=/^(?<row>\d+):(?<item>.*)$/su;function dn(e,t){let n=sn(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=un.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 fn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&sn(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function pn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let a=cn(r,i.name);if(a===null)continue;if(a.firstHole!==null)return b(`${e} has no ${a.path}[] row ${a.firstHole} — number ${a.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||a.rowCount<=1||dn(i,t)!==null)continue;let o=i.flag.split(` `)[0]??i.name;return b(`${o} fills one ${a.path}[] row's list, so ${e} cannot also build ${a.rowCount} ${a.path}[] rows from direct options — prefix each value with its 0-based ${a.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function mn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function hn(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function gn(e,t){if(!F(t))return hn(e,t.split(`.`))}function _n(e,t){return yn(e,t.split(`.`))}function vn(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)&&_n(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function yn(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=Cn(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=>yn(e,r)):yn(a,r)}function F(e){return e.split(`.`).some(e=>Cn(e).isArray)}function bn(e,t){return e.parameter.length===0||!I(t)?null:Tn(t,[],wn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function xn(e,t,n,r=0){let i=t.split(`.`),a=e;for(let[e,o]of i.entries()){let s=Cn(o),c=e===i.length-1,l=Sn(a,s,t,c,n,r);if(!l.ok||l.data===null)return b(l.summary,l.warnings);if(c)return y(`Body value assigned`,null);a=l.data}return b(`${t} is not a valid body option path.`)}function Sn(e,t,n,r,i,a){let o=()=>b(`${n} cannot be combined with another body option at ${t.key}.`),s=e[t.key];if(t.isArray){if(s!==void 0&&!Array.isArray(s))return o();let n=s??[];if(s===void 0&&(e[t.key]=n),r)return n[a]===void 0?(n[a]=i,y(`Body value assigned`,e)):o();let c=n[a];if(c===void 0){let e={};return n[a]=e,y(`Body path created`,e)}return I(c)?y(`Body path stepped`,c):o()}if(r)return s===void 0?(e[t.key]=i,y(`Body value assigned`,e)):o();if(s===void 0){let n={};return e[t.key]=n,y(`Body path created`,n)}return I(s)?y(`Body path stepped`,s):o()}function Cn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function wn(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 Tn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=Tn(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(!En(a,n)){if(!Dn(e))continue;let t=On(e,n);return{path:a,...t===void 0?{}:{suggestion:t}}}let o=Tn(i,e,n);if(o!==null)return o}return null}function En(e,t){return t.prefix.has(e)||t.leaf.has(e)}function Dn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function On(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:kn(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 kn(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}var An=e=>Array.isArray(e)&&!Object.isFrozen(e);function jn(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(Be(e)),t.description=ae(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}if(!An(e))throw Error(`Commander option list is frozen; generated option help cannot be ordered.`);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?zn(r,i):r===void 0?i===void 0?0:1:-1})}function Mn(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 Nn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function Pn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Ln(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 Fn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function In(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?He(n):`${He(n)} Required JSON paths: ${r.join(`, `)}.`}function Ln(e,t){let n=ze(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}.`:``}${Rn(e,t)}`}function Rn(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=sn(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 zn(e,t){return We(e)-We(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function Bn(e){let t;try{t=e===`-`?await Vn():await $t(e,`utf8`)}catch(t){return b(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return y(`No input provided`,null);let e=JSON.parse(t);return y(`Input parsed`,e)}catch(e){return b(`Input is not valid JSON: ${e.message}`)}}async function Vn(){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 Hn=`--content-type`;function Un(e,n,r){let i=e=>!r?.has(e)&&(r?.add(e),!0),a=n.requestBody??[];if(a.length>1&&i(Hn)){let n=a.map(({contentType:e})=>e);e.addOption(new t(`${Hn} <media-type>`,`Select the request body encoding, never an uploaded file's media type; omit for ${n[0]}.`).choices(n).argParser(Gn(a)))}if(lr(n)&&i(`--from-file`)){let r=a[0];if(r===void 0)throw Error(`${n.operationId} has no request body`);e.addOption(new t(`--from-file <path>`,In(r,r.requiredPath)).argParser(qn(`--from-file`)))}let o=Mn(a).filter(e=>i(L(e.variant[0].parameter)));for(let n of o.toSorted((e,t)=>zn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:r,parameter:i}=n.variant[0],o=new t(Nn(n),a.length>1?Pn(n):Ln(r,i));a.length===1&&i.envName!==void 0&&o.env(i.envName);let s=a.length===1?Fn(r,i.optionKey):[];s.length>0&&o.conflicts(s),a.length>1?o.argParser(Wn):F(i.name)||i.schemaType===`array`?o.argParser(Kn):o.argParser(qn(i.flag)),e.addOption(o),o.envVar!==void 0&&e.on(`optionEnv:${o.name()}`,()=>{let t=e.opts()[i.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(i.optionKey,t.trim(),`env`)})}cr(e,n,o)}function Wn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Gn(e){return(t,r)=>{if(r!==void 0)throw new n(`${Hn} was already given; pass it once.`);let i=me(e,t);if(!i.ok)throw new n(i.summary);return t}}function Kn(e,t){return[...t??[],e]}function qn(e){let t=e.split(/\s+/u)[0]??e;return(e,r)=>{if(r!==void 0)throw new n(`${t} was already given; pass it once.`);return e}}async function Jn(e,t){let n=wt(e,t),r=me(e.requestBody??[],n);if(!r.ok||r.data===null)return b(r.summary,r.warnings);let i=r.data;if(i===void 0)return y(`No body`,void 0);let a=Yn(e,i,t);if(a!==null)return b(a);let o=tn(e.operationId,i,t);if(!o.ok)return b(o.summary,o.warnings);t=o.data;let s=Xn(i,t);if(s!==null)return b(s);let c=await er(t);if(!c.ok)return b(c.summary,c.warnings);let l=vn(e.requestBody??[],i,c.data);if(l!==null)return b(l);let u=$n(e.operationId,i,c.data);if(!u.ok)return u;let d=nn(e.operationId,i,c.data);if(d!==null)return b(d);let f=tr(e.operationId,i,t);if(!f.ok)return f;if(c.data===void 0&&f.data===void 0)return i.required?b(sr(e.operationId,i)):y(`No body`,void 0);let p=rr(e.operationId,i,c.data,f.data);if(!p.ok||p.data===void 0)return p;if(i.schemaType===`array`&&!Array.isArray(p.data))return b(`${e.operationId} requires a JSON array body.`);if(i.parameter.length>0&&!I(p.data)){let t=i.kind===`multipart`?` keyed by multipart part name`:` body`;return b(`${e.operationId} requires a JSON object${t}.`)}let m=Qn(i,p.data);if(m.length>0)return b(`${e.operationId} requires body option(s): ${m.join(`, `)}`);let h=p.data,g=I(h)?rn(i).filter(e=>!_n(h,e)):[];return g.length>0?b(Zn(e.operationId,i,g)):p}function Yn(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 ${Hn} ${i.join(` or `)}.`}return null}function Xn(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 Qn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!_n(t,e.name)).map(L):[]}function $n(e,t,n){let r=bn(t,n);if(r===null)return y(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return b(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function er(e){let t=typeof e.fromFile==`string`?e.fromFile:void 0;if(t===void 0)return y(`No body file`,void 0);let n=await Bn(t);if(!n.ok)return b(n.summary,n.warnings);let r=le.safeParse(n.data);return r.success?y(`Input parsed`,r.data):b(`Input is not valid JSON value: ${r.error.message}`)}function tr(e,t,n){let r={},i=!1;for(let e of t.parameter){let a=ln(e,n[e.optionKey]);if(!a.ok||a.data===null)return b(a.summary,a.warnings);let o=a.data;if(o===void 0)continue;let s=nr(t,n,r,e,o);if(!s.ok)return b(s.summary,s.warnings);i=!0}if(!i)return y(`No direct body options`,void 0);let a=pn(e,t,n,r);return a===null?y(`Direct body options parsed`,r):a}function nr(e,t,n,r,i){let a=dn(r,i);if(a===null){let e=ar(r,i);return e.ok?an(n,r.name,e.data,r.schemaType===`array`):b(e.summary,e.warnings)}if(a.plain.length>0)return b(`${L(r)} mixes row-form values with plain value(s): ${a.plain.join(`, `)} — prefix every value with its 0-based ${a.container}[] row index, as 0:value.`);let o=fn(e,t,a.container);for(let e of a.rows.keys())if(!(e<o))return b(`${L(r)} names ${a.container}[] row ${e}, but these options build at most ${o} ${a.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 a.rows){let i=[];for(let e of t){let t=or(r.name,r.itemSchemaType,e);if(!t.ok)return b(t.summary,t.warnings);i.push(t.data)}let a=on(n,r.name,e,i);if(!a.ok)return a}return y(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function rr(e,t,n,r){if(n===void 0)return y(`Direct body parsed`,r);if(r===void 0)return y(`Input parsed`,n);if(I(n)&&I(r))try{return y(`Input parsed`,ir(t,n,r))}catch(t){return b(`${e} ${t instanceof Error?t.message:String(t)}`)}return b(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function ir(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]=ir(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`:Me.test(o)?`; keep multi-line text in the --from-file body`:``}.`)}return i}function ar(e,t){if(typeof t==`boolean`)return y(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return or(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=or(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return y(`Body value parsed`,n)}function or(e,t,n){if(t===`boolean`)return n===`true`?y(`Body value parsed`,!0):n===`false`?y(`Body value parsed`,!1):b(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?b(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?b(`${e} must be an integer.`):y(`Body value parsed`,i)}return y(`Body value parsed`,n)}function sr(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=rn(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 cr(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Hn,location:`body`}),lr(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),jn(e.options,r)}function lr(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function ur(e){let t=ue(e,Pe(e,T));return yr(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function dr(e){let t=ue(e,Pe(e,T));yr(t);let n=Ae(T,t.data,t.summary),r=[];if(t.ok&&n!==null){let e=fr(t);r.push(n.endsWith(`
|
|
2
2
|
`)?n.slice(0,-1):n),r.push(...e),process.stdout.write(Le(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(...hr(t.problem)),r.push(...fr(t)),process.stdout.write(Le(r.join(`
|
|
4
4
|
`),!0))}function fr(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){let n=Te(t);if(e.mode===`data`||e.mode===`data-full`){let t=e.mode===`data`?ue(n,pr(n)):n;yr(t),process.stdout.write(`${JSON.stringify(t.ok&&t.truncated!==!0?we(t.data):t)}\n`),t.ok||(process.exitCode=1);return}let r=e.mode===`json`?ur(n):n;e.mode===`text`&&dr(r),r.ok||(process.exitCode=1)}function pr(e){let t=Pe(e,T);if(t.write===!0||!e.ok)return t;let n=t.exactRecovery??`Refetch a narrower result: use ids/references, a more specific list read (e.g. entities relationships list, entities people list, or news list --owner-entity-id), filters, or smaller pages with page and size.`;return{...t,exactRecovery:`--data printed this truncated result envelope (truncated: true), not the bare payload, so payload paths read as null; rerun with --to-file <path> for the whole payload, or --data-full in a bounded program. ${n}`}}function mr(e,t){let n=Ee(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./commander-BB7CDPLs.js";import{C as t,O as n,T as r,i,l as a,n as o,o as s,p as c,t as l,u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{Fr as m}from"./dist-
|
|
1
|
+
import{n as e}from"./commander-BB7CDPLs.js";import{C as t,O as n,T as r,i,l as a,n as o,o as s,p as c,t as l,u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{Fr as m}from"./dist-CXpQ87Pz.js";import{a as ee,c as h,d as g,i as _}from"./result-envelope-D5wNfKzB.js";import{a as te}from"./package-DPDX5zmx.js";import{S as ne,a as re,c as ie,d as ae,f as oe,l as se,n as ce,o as le,s as v}from"./tool-policy-D7R8FUUe.js";import{a as ue,n as de,r as y,t as fe}from"./text-field-BoNdbrtA.js";import{C as b,D as pe,E as me,O as he,S as ge,T as _e,_ as ve,a as ye,b as be,c as xe,d as Se,f as Ce,g as we,h as Te,i as Ee,k as De,l as Oe,m as ke,n as Ae,o as je,p 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"./detail-DIjiKrvq.js";import{a as Ve,o as He}from"./cli-help-policy-RGOSoZ1Z.js";import{Buffer as x}from"node:buffer";var S=s([`HIGH`,`MEDIUM`,`LOW`]),Ue=s([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),We=Object.assign(r([Ue,f()]),{enum:Ue.enum}),Ge=p({excerpt:f(),sourceId:f(),sourceType:We,sourceVersion:f().nullish()}),Ke=p({instruction:f(),operationId:f(),stepKey:f().optional()}),qe=p({body:f(),expectation:f(),method:a(f()),override:f(),reject:a(f()),typeCatalog:f()}),Je=p({cliCommand:f(),mcpTool:f().nullish(),step:Ke,writeGuidance:qe.nullish()}),Ye=s([`ENTITY`,`TEXT`,`WRITER_BRIEF`]),Xe=Object.assign(r([Ye,f()]),{enum:Ye.enum}),Ze=p({allowedValue:f().nullish(),description:f(),key:f(),type:Xe}),Qe=p({catalogRevision:c().optional(),gateId:a(f()).optional(),input:a(Ze),step:a(Je),taskKey:f().optional()}),C=s([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),$e=p({candidate:a(Ge),operationId:f().nullish(),outcome:C,probability:d().nullish(),taskKey:f().nullish(),taskPlan:Qe.nullish()}),et=p({answer:f(),citation:a(Ge),confidence:S,resolution:$e.nullish()});function w(e,t,n=t.inputName){if(t.in===`body`)return n;let r=ft.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?dt(ct(n!==`id`&&n!==`slug`?n:`${it(e.path)}${st(n)}`),t):r.inputName}function tt(e,t,n=ot(e)){return nt(at(e,t),new Set(n))}function nt(e,t){if(!t.has(e))return e;let n=`body${st(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function rt(e,t,n){return`${e}[${t}].${n}`}function it(e){return pt.find(([,t])=>t.test(e))?.[0]??`record`}function at(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=lt(t);return dt(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?ct(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function ot(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>w(e,t)))}function st(e){return e.replace(/^./u,e=>e.toUpperCase())}function ct(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function lt(e){let t=ct(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ut(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ut(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function dt(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var ft=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],pt=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function mt(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>ht(t,w(e,t))),r=(t?.parameter??[]).map(t=>ht(t,tt(e,t)));return{selector:n.filter(e=>e.location===`path`||gt(e)),pagination:n.filter(_t),filter:[...n.filter(vt),...r.filter(vt)],body:r.filter(e=>!vt(e))}}function ht(e,t){let{in:n,inputName:r,...i}=e;return{...i,name:e.in===`body`?t:e.name,flag:re(t),location:n,description:e.description||`${e.name} ${e.in} parameter`}}function gt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function _t(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function vt(e){return e.location!==`path`&&!gt(e)&&!_t(e)}var T=16e3,yt=(e,t=T)=>e.length<=120&&x.byteLength(`${e.join(`
|
|
2
2
|
`)}\n`,`utf8`)<=t,E=(e,t=!1,n=!1,r=1)=>{let i=de(e),a=t||i.endsWith(`
|
|
3
3
|
`),o=i.endsWith(`
|
|
4
4
|
`)?i.slice(0,-1):i,s=o.length===0?[]:o.split(`
|