@aventurevc/aventure-cli 0.7.332 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +109 -37
- package/dist/aventure-cli/command-catalog.compact.txt +11 -28
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +59 -139
- package/dist/chunks/{auth-Dz_A-dL_.js → auth-DTt1r8ab.js} +1 -1
- package/dist/chunks/{aventure-cli-BBxgoLnF.js → aventure-cli-ChRJCsYc.js} +4 -4
- package/dist/chunks/{index.node-BpjrGuen.js → index.node-Ch7Vs316.js} +1 -1
- package/dist/chunks/{oauth-bearer-credential-1WZWSwji.js → oauth-bearer-credential-DREFG9pZ.js} +2 -2
- package/dist/chunks/{oauth-login-DSNKOKUf.js → oauth-login-CFWh9pGK.js} +1 -1
- package/dist/chunks/oauth-login-kcyjyVvw.js +1 -0
- package/dist/chunks/openapi-commands-C9JKVw0Q.js +1 -0
- package/dist/chunks/text-field-jyeJ8k8G.js +1 -0
- package/dist/chunks/{text-response-DEelXkk9.js → text-response-LnZ28abi.js} +1 -1
- package/package.json +5 -4
- package/dist/chunks/oauth-login-DwEpJ0WZ.js +0 -1
- package/dist/chunks/openapi-commands-DQaPv5E_.js +0 -1
- package/dist/chunks/text-field-CwDIzxGg.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{D as e,at as t,j as n,k as r}from"./auth-Dz_A-dL_.js";import{C as i,a,c as o,v as s}from"./person-owner-BqBLyw4S.js";import{a as c,i as l,n as u,t as d}from"./text-field-CwDIzxGg.js";function f(e,t,n=t.inputName){if(t.in===`body`)return n;let r=re.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?y(v(n!==`id`&&n!==`slug`?n:`${h(e.path)}${_(n)}`),t):r.inputName}function p(e,t,n=ee(e)){return m(g(e,t),new Set(n))}function m(e,t){if(!t.has(e))return e;let n=`body${_(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function h(e){return ie.find(([,t])=>t.test(e))?.[0]??`record`}function g(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=te(t);return y(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?v(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function ee(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>f(e,t)))}function _(e){return e.replace(/^./u,e=>e.toUpperCase())}function v(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 te(e){let t=v(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ne(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ne(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function y(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var re=[{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`}],ie=[[`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 ae(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>b(t,f(e,t))),r=(t?.parameter??[]).map(t=>b(t,p(e,t)));return{selector:n.filter(e=>e.location===`path`||x(e)),pagination:n.filter(S),filter:[...n.filter(C),...r.filter(C)],body:r.filter(e=>!C(e))}}function b(e,t){return{name:e.in===`body`?t:e.name,flag:r(t),required:e.required,location:e.in,description:e.description||`${e.name} ${e.in} parameter`}}function x(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function S(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function C(e){return e.location!==`path`&&!x(e)&&!S(e)}var w=`aventure`,oe={high:60,medium:30},se={high:20,medium:10};function ce(e){let{contract:t,guidance:r,enumQueryFlag:i}=e,a=t.requestBody?.[0],o=i?.inputName??null,s=D(t.parameter,o),c=D(a?.parameter??[],null),l=s.map(e=>fe(t,e)),u=c.map(e=>pe(t,e)),d=a?.requiredPath??[],f=new Set((a?.parameter??[]).map(({name:e})=>e)),m=d.filter(e=>!f.has(e)&&!c.some(({name:t})=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`))),h=a?.required===!0&&a.kind===`json`&&(u.length===0||m.length>0),g=[w,...t.projection.cliPath,...i===null?[]:[i.flag],...l,...u,...h?[`--from-file "<path>"`]:[]];return{intent:t.intent,operationId:t.operationId,recommendedCommand:g.join(` `),useFor:r.useFor,notFor:r.notFor,apiRoute:`${t.method} ${t.path}`,mcpTool:n(t.intent),missingInputs:[...s.map(e=>e.name),...c.map(e=>p(t,e)),...m,...h?[`fromFile`]:[]],pathInput:E(t.parameter,`path`),queryInput:E(t.parameter,`query`),bodyInput:(a?.parameter??[]).map(e=>e.name),operationDescription:t.description,bodySchemaName:a?.schemaName??null,bodyKind:a?.kind??null,bodyRequired:a?.required??!1,requiredBodyPath:d,confidence:e.confidence,alternatives:e.alternatives}}function le(e){let t=T(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor||`See operation description`}}function T(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}function ue(e,t){if(e===0)return`low`;let n=e-t;return e>=oe.high&&n>=se.high?`high`:e>=oe.medium&&n>=se.medium?`medium`:`low`}function de(e,t,n=[]){return{intent:`unknown`,operationId:``,recommendedCommand:``,useFor:e,notFor:t,apiRoute:``,mcpTool:``,missingInputs:n,pathInput:[],queryInput:[],bodyInput:[],operationDescription:``,bodySchemaName:null,bodyKind:null,bodyRequired:!1,requiredBodyPath:[],confidence:`low`,alternatives:[]}}function E(e,t){return e.flatMap(e=>e.in===t?(e.itemProperty??[e]).map(e=>e.name):[])}function D(e,t){return e.filter(e=>e.required&&e.schemaDefault===void 0&&(t===null||e.inputName!==t))}function fe(t,n){let i=f(t,n),a=`${i}${n.schemaType===`array`?`...`:``}`;return`${r(i)} ${e(`<${a}>`)}`}function pe(t,n){let i=p(t,n),a=`${i}${n.schemaType===`array`?`...`:``}`;return`${r(i)} ${e(`<${a}>`)}`}var O=2,me=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`)),he=new Set([`delete`,`remove`,`destroy`,`purge`,`erase`,`drop`,`detach`,`unlink`]),ge=new Set([`create`,`add`,`update`,`edit`,`set`,`change`,`modify`,`upload`,`attach`,`merge`,`link`,`join`,`write`,`import`,`publish`,`verify`]),_e=new Set([`list`,`get`,`show`,`view`,`browse`,`fetch`,`read`,`lookup`,`find`,`count`,`inspect`]);function ve(e){let t=t=>[...e].some(e=>t.has(e));return t(he)?`delete`:t(ge)?`write`:t(_e)?`read`:`neutral`}function k(e,t){let n=N(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&k(e,`person`),A(e,ye(n),n),A(e,be(n),n))}function ye(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=O&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>O&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function be(e){return e===`person`?`people`:e.length>=O&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function A(e,t,n){t!==void 0&&t!==n&&t.length>=O&&/^[a-z]+$/u.test(t)&&e.add(t)}function j(e){let t=new Set(M(e)),n=Array.from(t);for(let e of n)k(t,e);return t}function xe(e){return M(e).map(j)}function Se(e,t){if(e.length===0)return!1;let n=j(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function M(e){return N(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!me.has(e))}function N(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase()}var Ce=20,we=15,Te=30,Ee=2;function P(e,t,n){let r=N(e.trim());if(r.length===0)return t.map(e=>({item:e,score:1}));let i=j(r),a=xe(r);return t.map(e=>{let t=n(e);return{item:e,fields:t,score:je(r,i,a,t)}}).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}function De(e){return{...e,cliPath:e.projection.cliPath,enumParameter:e.parameter.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:e.parameter.flatMap(e=>[e.name,e.inputName]),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function Oe(e,t){let n=e.q?.trim()??``,r=P(n,t.filter(t=>ke(e,t)),De).map(({item:e,score:t})=>({contract:e,score:t})),i=r.map(({contract:e})=>e),a=e.limit===void 0||!Number.isFinite(e.limit)?Ce:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a)));if(e.resolve!==!0){let e=r.slice(0,o).map(({contract:e})=>Ae(e));return{summary:`Operation catalog matches`,data:e,counts:{totalOperations:t.length,matched:i.length,returned:e.length}}}if(n.length===0)return F(t.length,i.length,`Provide q to get a generated command recommendation`,`Catalog listing; omit resolve to browse operations`,[`q`]);let s=j(N(n)),c=ve(s),l=r.filter(({contract:e})=>c===`delete`?!0:e.intent===`delete`||e.projection.destructive?!1:c!==`read`||e.projection.scope!==`write`).toSorted((e,t)=>t.score-e.score||Number(e.contract.projection.scope===`write`)-Number(t.contract.projection.scope===`write`)||e.contract.path.length-t.contract.path.length||e.contract.operationId.localeCompare(t.contract.operationId)),u=l[0];if(u===void 0)return F(t.length,i.length,`No generated operation matched this query`,`See generated operation descriptions`);let d=l.slice(1).map(({contract:e})=>`${w} ${e.projection.cliPath.join(` `)}`).filter((e,t,n)=>n.indexOf(e)===t).slice(0,2),f=u.contract;return{summary:`How-to command recommendation`,data:ce({contract:f,guidance:le(f),confidence:ue(u.score,l[1]?.score??0),alternatives:d,enumQueryFlag:Ie(s,f)}),counts:{totalOperations:t.length,matched:i.length,returned:1}}}function F(e,t,n,r,i=[]){return{summary:`How-to command recommendation`,data:de(n,r,i),counts:{totalOperations:e,matched:t,returned:0}}}function ke(e,t){let n=e.root?.trim().toLowerCase();return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function Ae(e){let t=e.requestBody?.[0];return{operationId:e.operationId,method:e.method,path:e.path,cli:e.projection.cliPath.join(` `),resource:e.resource,intent:e.intent,scope:e.projection.scope,bodySchemaName:t?.schemaName??null,bodyKind:t?.kind??null,bodyRequired:t?.required??!1,requiredBodyPath:t?.requiredPath??[],argument:ae(e)}}function je(e,t,n,r){let i=Pe(r),a=Me(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=Ne(e,i);let s=new Set(i.flatMap(M));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;k(n,e),[...n].some(e=>t.has(e))&&(o+=we)}Se(n,a)&&(o+=200),r.parameterName.some(t=>N(t)===e)&&(o+=Te);let c=new Set(r.parameterDescription.flatMap(M));for(let e of t)c.has(e)&&(o+=Ee);return o+=Re(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Fe(e,t,r.description),o}function Me(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(N).filter(e=>e.length>0)}function Ne(e,t){let n=M(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function Pe(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,T(e.description).useFor||e.description].map(N).filter(e=>e.length>0))]}function Fe(e,t,n){let r=N(T(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(M(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Ie(t,n){for(let i of n.parameter){if(i.in!==`query`)continue;let a=Le(t,i);if(a!==null){let t=f(n,i);return{inputName:i.inputName,flag:`${r(t)} ${e(a,i.schemaType,i.itemSchemaType)}`}}}return null}function Le(e,t){return(t.itemSchemaEnum??t.schemaEnum??[]).find(t=>ze(e,t))??null}function Re(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>ze(e,t))&&(n+=i?40:10);return n}function ze(e,t){let n=M(t);return n.length>0&&n.every(t=>e.has(t))}var Be=a([`HIGH`,`MEDIUM`,`LOW`]),Ve=a([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`]),He=s({excerpt:i(),sourceId:i(),sourceType:Ve,sourceVersion:i().nullish()}),Ue=s({answer:i(),citation:o(He),confidence:Be}),We=a([`auto`,`exact`,`keyword`,`semantic`,`natural`]),Ge=s({modeRequested:We,modeUsed:We}),I=120,L=30,R=8,z=10,Ke=2,qe=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Je=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),B=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`],Ye=new Map(c.map(({operationId:e,projection:t})=>[e,`${w} ${t.cliPath.join(` `)}`]));function Xe(e,t){if(typeof e==`string`)return e;let n=U(e);if(n===null)return null;let{response:r,hiddenNote:i}=l(n.operationId,n.response),a={...n,response:r},o=at(a.response);if(o!==null)return`${ft(o).join(`
|
|
1
|
+
import{D as e,at as t,j as n,k as r}from"./auth-DTt1r8ab.js";import{C as i,a,c as o,v as s}from"./person-owner-BqBLyw4S.js";import{a as c,i as l,n as u,t as d}from"./text-field-jyeJ8k8G.js";function f(e,t,n=t.inputName){if(t.in===`body`)return n;let r=re.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?y(v(n!==`id`&&n!==`slug`?n:`${h(e.path)}${_(n)}`),t):r.inputName}function p(e,t,n=ee(e)){return m(g(e,t),new Set(n))}function m(e,t){if(!t.has(e))return e;let n=`body${_(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function h(e){return ie.find(([,t])=>t.test(e))?.[0]??`record`}function g(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=te(t);return y(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?v(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function ee(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>f(e,t)))}function _(e){return e.replace(/^./u,e=>e.toUpperCase())}function v(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 te(e){let t=v(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?ne(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function ne(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function y(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var re=[{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`}],ie=[[`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 ae(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>b(t,f(e,t))),r=(t?.parameter??[]).map(t=>b(t,p(e,t)));return{selector:n.filter(e=>e.location===`path`||x(e)),pagination:n.filter(S),filter:[...n.filter(C),...r.filter(C)],body:r.filter(e=>!C(e))}}function b(e,t){return{name:e.in===`body`?t:e.name,flag:r(t),required:e.required,location:e.in,description:e.description||`${e.name} ${e.in} parameter`}}function x(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function S(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function C(e){return e.location!==`path`&&!x(e)&&!S(e)}var w=`aventure`,oe={high:60,medium:30},se={high:20,medium:10};function ce(e){let{contract:t,guidance:r,enumQueryFlag:i}=e,a=t.requestBody?.[0],o=i?.inputName??null,s=D(t.parameter,o),c=D(a?.parameter??[],null),l=s.map(e=>fe(t,e)),u=c.map(e=>pe(t,e)),d=a?.requiredPath??[],f=new Set((a?.parameter??[]).map(({name:e})=>e)),m=d.filter(e=>!f.has(e)&&!c.some(({name:t})=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`))),h=a?.required===!0&&a.kind===`json`&&(u.length===0||m.length>0),g=[w,...t.projection.cliPath,...i===null?[]:[i.flag],...l,...u,...h?[`--from-file "<path>"`]:[]];return{intent:t.intent,operationId:t.operationId,recommendedCommand:g.join(` `),useFor:r.useFor,notFor:r.notFor,apiRoute:`${t.method} ${t.path}`,mcpTool:n(t.intent),missingInputs:[...s.map(e=>e.name),...c.map(e=>p(t,e)),...m,...h?[`fromFile`]:[]],pathInput:E(t.parameter,`path`),queryInput:E(t.parameter,`query`),bodyInput:(a?.parameter??[]).map(e=>e.name),operationDescription:t.description,bodySchemaName:a?.schemaName??null,bodyKind:a?.kind??null,bodyRequired:a?.required??!1,requiredBodyPath:d,confidence:e.confidence,alternatives:e.alternatives}}function le(e){let t=T(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor||`See operation description`}}function T(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}function ue(e,t){if(e===0)return`low`;let n=e-t;return e>=oe.high&&n>=se.high?`high`:e>=oe.medium&&n>=se.medium?`medium`:`low`}function de(e,t,n=[]){return{intent:`unknown`,operationId:``,recommendedCommand:``,useFor:e,notFor:t,apiRoute:``,mcpTool:``,missingInputs:n,pathInput:[],queryInput:[],bodyInput:[],operationDescription:``,bodySchemaName:null,bodyKind:null,bodyRequired:!1,requiredBodyPath:[],confidence:`low`,alternatives:[]}}function E(e,t){return e.flatMap(e=>e.in===t?(e.itemProperty??[e]).map(e=>e.name):[])}function D(e,t){return e.filter(e=>e.required&&e.schemaDefault===void 0&&(t===null||e.inputName!==t))}function fe(t,n){let i=f(t,n),a=`${i}${n.schemaType===`array`?`...`:``}`;return`${r(i)} ${e(`<${a}>`)}`}function pe(t,n){let i=p(t,n),a=`${i}${n.schemaType===`array`?`...`:``}`;return`${r(i)} ${e(`<${a}>`)}`}var O=2,me=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`)),he=new Set([`delete`,`remove`,`destroy`,`purge`,`erase`,`drop`,`detach`,`unlink`]),ge=new Set([`create`,`add`,`update`,`edit`,`set`,`change`,`modify`,`upload`,`attach`,`merge`,`link`,`join`,`write`,`import`,`publish`,`verify`]),_e=new Set([`list`,`get`,`show`,`view`,`browse`,`fetch`,`read`,`lookup`,`find`,`count`,`inspect`]);function ve(e){let t=t=>[...e].some(e=>t.has(e));return t(he)?`delete`:t(ge)?`write`:t(_e)?`read`:`neutral`}function k(e,t){let n=N(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&k(e,`person`),A(e,ye(n),n),A(e,be(n),n))}function ye(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=O&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>O&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function be(e){return e===`person`?`people`:e.length>=O&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function A(e,t,n){t!==void 0&&t!==n&&t.length>=O&&/^[a-z]+$/u.test(t)&&e.add(t)}function j(e){let t=new Set(M(e)),n=Array.from(t);for(let e of n)k(t,e);return t}function xe(e){return M(e).map(j)}function Se(e,t){if(e.length===0)return!1;let n=j(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function M(e){return N(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!me.has(e))}function N(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase()}var Ce=20,we=15,Te=30,Ee=2;function P(e,t,n){let r=N(e.trim());if(r.length===0)return t.map(e=>({item:e,score:1}));let i=j(r),a=xe(r);return t.map(e=>{let t=n(e);return{item:e,fields:t,score:je(r,i,a,t)}}).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}function De(e){return{...e,cliPath:e.projection.cliPath,enumParameter:e.parameter.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:e.parameter.flatMap(e=>[e.name,e.inputName]),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function Oe(e,t){let n=e.q?.trim()??``,r=P(n,t.filter(t=>ke(e,t)),De).map(({item:e,score:t})=>({contract:e,score:t})),i=r.map(({contract:e})=>e),a=e.limit===void 0||!Number.isFinite(e.limit)?Ce:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a)));if(e.resolve!==!0){let e=r.slice(0,o).map(({contract:e})=>Ae(e));return{summary:`Operation catalog matches`,data:e,counts:{totalOperations:t.length,matched:i.length,returned:e.length}}}if(n.length===0)return F(t.length,i.length,`Provide q to get a generated command recommendation`,`Catalog listing; omit resolve to browse operations`,[`q`]);let s=j(N(n)),c=ve(s),l=r.filter(({contract:e})=>c===`delete`?!0:e.intent===`delete`||e.projection.destructive?!1:c!==`read`||e.projection.scope!==`write`).toSorted((e,t)=>t.score-e.score||Number(e.contract.projection.scope===`write`)-Number(t.contract.projection.scope===`write`)||e.contract.path.length-t.contract.path.length||e.contract.operationId.localeCompare(t.contract.operationId)),u=l[0];if(u===void 0)return F(t.length,i.length,`No generated operation matched this query`,`See generated operation descriptions`);let d=l.slice(1).map(({contract:e})=>`${w} ${e.projection.cliPath.join(` `)}`).filter((e,t,n)=>n.indexOf(e)===t).slice(0,2),f=u.contract;return{summary:`How-to command recommendation`,data:ce({contract:f,guidance:le(f),confidence:ue(u.score,l[1]?.score??0),alternatives:d,enumQueryFlag:Ie(s,f)}),counts:{totalOperations:t.length,matched:i.length,returned:1}}}function F(e,t,n,r,i=[]){return{summary:`How-to command recommendation`,data:de(n,r,i),counts:{totalOperations:e,matched:t,returned:0}}}function ke(e,t){let n=e.root?.trim().toLowerCase();return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function Ae(e){let t=e.requestBody?.[0];return{operationId:e.operationId,method:e.method,path:e.path,cli:e.projection.cliPath.join(` `),resource:e.resource,intent:e.intent,scope:e.projection.scope,bodySchemaName:t?.schemaName??null,bodyKind:t?.kind??null,bodyRequired:t?.required??!1,requiredBodyPath:t?.requiredPath??[],argument:ae(e)}}function je(e,t,n,r){let i=Pe(r),a=Me(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=Ne(e,i);let s=new Set(i.flatMap(M));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;k(n,e),[...n].some(e=>t.has(e))&&(o+=we)}Se(n,a)&&(o+=200),r.parameterName.some(t=>N(t)===e)&&(o+=Te);let c=new Set(r.parameterDescription.flatMap(M));for(let e of t)c.has(e)&&(o+=Ee);return o+=Re(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Fe(e,t,r.description),o}function Me(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(N).filter(e=>e.length>0)}function Ne(e,t){let n=M(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function Pe(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,T(e.description).useFor||e.description].map(N).filter(e=>e.length>0))]}function Fe(e,t,n){let r=N(T(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(M(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Ie(t,n){for(let i of n.parameter){if(i.in!==`query`)continue;let a=Le(t,i);if(a!==null){let t=f(n,i);return{inputName:i.inputName,flag:`${r(t)} ${e(a,i.schemaType,i.itemSchemaType)}`}}}return null}function Le(e,t){return(t.itemSchemaEnum??t.schemaEnum??[]).find(t=>ze(e,t))??null}function Re(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>ze(e,t))&&(n+=i?40:10);return n}function ze(e,t){let n=M(t);return n.length>0&&n.every(t=>e.has(t))}var Be=a([`HIGH`,`MEDIUM`,`LOW`]),Ve=a([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`]),He=s({excerpt:i(),sourceId:i(),sourceType:Ve,sourceVersion:i().nullish()}),Ue=s({answer:i(),citation:o(He),confidence:Be}),We=a([`auto`,`exact`,`keyword`,`semantic`,`natural`]),Ge=s({modeRequested:We,modeUsed:We}),I=120,L=30,R=8,z=10,Ke=2,qe=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Je=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),B=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`],Ye=new Map(c.map(({operationId:e,projection:t})=>[e,`${w} ${t.cliPath.join(` `)}`]));function Xe(e,t){if(typeof e==`string`)return e;let n=U(e);if(n===null)return null;let{response:r,hiddenNote:i}=l(n.operationId,n.response),a={...n,response:r},o=at(a.response);if(o!==null)return`${ft(o).join(`
|
|
2
2
|
`)}\n`;let s=a.summary??t??a.operationId??`OpenAPI call succeeded`,c=$e(a);return`${[...ft([s,`${a.method} ${a.endpoint}`,...c].filter(e=>e.length>0)),...i].join(`
|
|
3
3
|
`)}\n`}function Ze(e){let t=U(e)?.response,n=t!==void 0&&X(t)?t.interpretation:void 0;if(n===void 0||!X(n))return null;let r=Ge.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=K(n.filter??null),{unsupported:s,fallbackUsed:c}=n;return`${[`strategy: requested=${i} used=${a}`,...o!==void 0&&X(o)?[`constraints:`,...Object.entries(o).map(([e,t])=>` ${e}: ${Qe(t)}`)]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``].filter(Boolean).join(`
|
|
4
4
|
`)}\n`}var Qe=e=>Z(e)?u(e):Array.isArray(e)&&e.every(Z)?e.map(e=>u(e)).join(`, `):JSON.stringify(e);function $e(e){let{response:t,method:n,endpoint:r,nextCursor:i,httpStatus:a}=e;if(t===void 0)return a===void 0?[]:[`status=${a} no response body`];let o=a===void 0||n===`GET`?``:`status=${a}`,s=X(t)&&!J(t)?ot(t):null,c=s===null?void 0:it(s.context)?K(s.context):s.context;return[o,...J(t)?V(t,r,i):s===null?ct(t)?H(t.filter,t.meta):lt(t)?H([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):ut(t)?nt(t):W(t,``):[...V(s.page,r,i),...c===void 0?[]:W(c,``)]].filter(Boolean)}function V(e,t,n){let r=rt(t);return[`rows=${e.numberOfElements??e.content.length}${e.number===void 0?``:` page=${e.number}`}${e.size===void 0?``:` size=${e.size}`}${e.totalElements===void 0?``:` total=${e.totalElements}`}${e.totalPages===void 0?``:` totalPages=${e.totalPages}`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${$(n)}`,...et(e.content)].filter(Boolean)}function et(e){let t=e.filter(X);if(t.length===0)return e.length===0?[`(empty)`]:G(e,``);let n=tt(t);if(n.length===0)return G(e.slice(0,L),``);let r=t.slice(0,L).map(e=>{let t=q(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>dt(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),t.length>L&&s.push(`... ${t.length-L} more rows`),s}function tt(e){let t=new Set(e.flatMap(e=>Object.keys(q(e)))),n=qe.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,R-n.length);return[...n,...r].slice(0,R)}function H(e,t){let n=t!==void 0&&X(t)?t:{},r=[`total`,`limit`].flatMap(e=>typeof n[e]==`number`?[` ${e}=${n[e]}`]:[]).join(``),i=[`filters=${e.length}${r}`];for(let t of e){let e=t.choiceOption.length,n=t.choiceOptionTotal===null?`unknown (degraded)`:t.choiceOptionTotal??e,r=t.choiceOptionTruncated===!0?` truncated`:``;i.push(`- ${t.filterKey} (${t.label}): choices ${e}/${n}${r}`),t.choiceOption.slice(0,z).forEach(e=>{i.push(` ${Q(t.filterKey)} ${$(e.value)}`)}),e>z&&i.push(` ... ${e-z} more shown`)}return i}function nt(e){let t=Q(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,z).map(e=>`${t} ${$(e)}`),e.result.length>z?`... ${e.result.length-z} more matches`:``].filter(Boolean)}function rt(e){let t=e.indexOf(`?`);return t<0?[]:[...new URLSearchParams(e.slice(t+1)).entries()].filter(([e,t])=>!Je.has(e)&&t.length>0).map(([e,t])=>`${Q(e)} ${$(t)}`)}function U(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let n=Reflect.get(e,`method`),r=Reflect.get(e,`endpoint`);if(typeof n!=`string`||typeof r!=`string`)return null;let i=Reflect.get(e,`operationId`),a=Reflect.get(e,`summary`),o=Reflect.get(e,`httpStatus`),s=Reflect.get(e,`nextCursor`),c=Reflect.get(e,`response`),l=c===void 0?void 0:t.safeParse(c);return l!==void 0&&!l.success?null:{method:n,endpoint:r,httpStatus:typeof o==`number`?o:void 0,operationId:typeof i==`string`?i:void 0,summary:typeof a==`string`?a:void 0,nextCursor:typeof s==`string`&&s.length>0?s:void 0,response:l?.data}}function W(e,t,n){if(e===void 0)return[];if(Z(e))return[`${t}${d(e,n)}`];if(Array.isArray(e))return G(e,t,n);let r=[];for(let[n,i]of Object.entries(e)){if(Z(i)){r.push(`${t}${n}: ${d(i,n)}`);continue}r.push(`${t}${n}:`);for(let e of W(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function G(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){if(Z(i)){r.push(`${t}- ${d(i,n)}`);continue}r.push(`${t}-`);for(let e of W(i,`${t} `))r.push(e)}return r}function it(e){let t=e.interpretation;return t!==void 0&&X(t)}function K(e){if(Z(e))return e===null||typeof e==`string`&&e.trim().length===0?void 0:e;if(Array.isArray(e)){let t=e.flatMap(e=>{let t=K(e);return t===void 0?[]:[t]});return t.length===0?void 0:t}let t=Object.entries(e).flatMap(([e,t])=>{let n=K(t);return n===void 0?[]:[[e,n]]});if(t.length!==0)return Object.fromEntries([...B.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!B.includes(e))])}function at(e){let t=Ue.safeParse(e);if(!t.success)return null;let{answer:n,citation:r,confidence:i}=t.data,a=n.trimEnd().split(`
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aventurevc/aventure-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "Command-line access to aVenture research data on companies, people, funding, and news.",
|
|
6
|
+
"homepage": "https://docs.aventure.vc/cli",
|
|
6
7
|
"license": "Apache-2.0",
|
|
7
8
|
"repository": {
|
|
8
9
|
"type": "git",
|
|
@@ -32,9 +33,9 @@
|
|
|
32
33
|
},
|
|
33
34
|
"aventurePublicApi": {
|
|
34
35
|
"repository": "aventurevc/aventure-docs",
|
|
35
|
-
"commit": "
|
|
36
|
+
"commit": "5c0659a27ff8e9f01a7466a96f1c78eb59fd6b7d",
|
|
36
37
|
"openapiPath": "openapi/openapi.json",
|
|
37
|
-
"openapiSha256": "
|
|
38
|
+
"openapiSha256": "bcc2f2179bdcaee395b8d55defbf3117ea81b2d34490e1d8d36f0dc6afffc0ae"
|
|
38
39
|
},
|
|
39
40
|
"scripts": {}
|
|
40
41
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./oauth-login-DSNKOKUf.js";export{e as renewOAuthTokens};
|