@mintlify/cli 4.1.15 → 4.1.17
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/start.js +1 -1
- package/package.json +9 -9
package/dist/start.js
CHANGED
|
@@ -2320,7 +2320,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
2320
2320
|
|
|
2321
2321
|
`,o=/^\n*/.exec(e.content.slice(i))?.[0].length??0,s=`
|
|
2322
2322
|
`.repeat(Math.max(0,2-o)),c=(o,c)=>{let l=o?.split(`.`)[0];if(!o||!l||!/^[A-Z]/.test(l)||t.has(l)||n.has(o)||uNe(o))return;n.add(o);let u=yTe.map(e=>`snippets/${l}${e}`).find(t=>e.readFile?.call(e,t)!==void 0),d=u&&e.readFile?.call(e,u),f=u&&d!==void 0&&o===l?R8t(d,u,l):void 0;r.push({line:c?.line,column:c?.column,message:`<${o}> is not built in, imported or exported on this page`,edit:f?{start:i,end:i,text:`${a}import ${f} from "/${u}";${s}`}:void 0})},l=(e,t)=>me(e,/* @__PURE__ */ new Set,{reference:e=>{if(e.type!==`JSXIdentifier`)return;let n=e.loc;c(String(e.name),n?.start??t)}});return ue(e.tree,e=>{if(e.type===`mdxJsxFlowElement`||e.type===`mdxJsxTextElement`){c(e.name,e.position?.start);for(let t of e.attributes){let n=t.type===`mdxJsxAttribute`?t.value:t;n&&typeof n==`object`&&l(n.data?.estree,e.position?.start)}}else(e.type===`mdxFlowExpression`||e.type===`mdxTextExpression`)&&l(e.data?.estree,e.position?.start)}),r}},B8t=VEe.filter(e=>e!==`image`),V8t=String.raw`"[^"]*"|'[^']*'|\{[^{}]*\}|[^<>"'{}]`,H8t=new RegExp(String.raw`<(${B8t.join(`|`)})(?=[\s/>])(?:${V8t})*?(\/?)>`,`g`),U8t={id:`void-tags`,group:`content`,severity:`error`,scope:`file`,description:`self-close void HTML tags (<br>, <img>, <source>, …); MDX can't parse them unclosed`,raw:!0,check:({content:e})=>{let t=H6t(e),n=[];for(let r of t.matchAll(H8t)){if(r[2])continue;let i=r.index,a=i+r[0].length;if(RegExp(`^\\s*</${r[1]}\\s*>`).test(t.slice(a)))continue;let o=e.slice(0,i).split(`
|
|
2323
|
-
`);n.push({line:o.length,column:(o.pop()?.length??0)+1,message:`<${r[1]}> must be self-closed`,edit:{start:i,end:a,text:`${e.slice(i,a-1).trimEnd()} />`}})}return n}};var W8t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const F9=[U8t,E8t,z8t,F8t,N8t,j8t,A8t,{id:`openapi-spec`,group:`openapi`,severity:`error`,scope:`site`,description:`OpenAPI specs in docs.json or mint.json that don't parse or validate, with overlays applied`,check:e=>W8t(void 0,void 0,void 0,function*(){let t=[];try{let n=JSON.parse(yield Hn.readFile(It.join(e.baseDir,e.configFile),`utf-8`));t=$3t(e.configFile===`mint.json`?{api:{openapi:n.openapi}}:n)}catch{}if(t.length===0)return[];let n;try{n=yield e6t(e.localSchema)}catch(t){return[{file:e.configFile,message:`OpenAPI overlays: ${c1(t)}`}]}return(yield Promise.all(t.map(t=>W8t(void 0,void 0,void 0,function*(){let r=[];return yield n6t(t,e.localSchema,n,e=>r.push(e)),r.flatMap(({level:e,message:n})=>e===`error`?[{file:t,message:n}]:e===`warning`?[{file:t,message:n,severity:`warning`}]:[])})))).flat()})},...b8t];var G8t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const K8t=e=>{try{let{variables:t}=JSON.parse(e);return t&&typeof t==`object`?t:void 0}catch{return}},q8t=(e,t)=>G8t(void 0,[e,t],void 0,function*(e,{selected:t,localSchema:n}){let r=yield Q6t(e),i=/* @__PURE__ */ new Map,a=En.existsSync(It.join(e,`docs.json`))?`docs.json`:`mint.json`,o=t=>{if(!i.has(t))try{i.set(t,En.readFileSync(It.join(e,t),`utf-8`))}catch{i.set(t,void 0)}return i.get(t)};return{baseDir:e,files:r,selected:t,configFile:a,variables:K8t(o(a)??``),localSchema:n,read:o,locate:(e,t)=>{let n=o(e)??``,r=t?n.indexOf(t):-1;return r===-1?{}:D9(n,r)}}}),I9=[`content`,`nav`,`config`,`openapi`];var L9=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},R9=class extends Error{};const J8t=()=>F9.map(({id:e})=>e).join(`, `),Y8t=e=>{if(e===`all`)return F9;let t=F9.find(({id:t})=>t===e);if(t)return[t];if(I9.includes(e))return F9.filter(({group:t})=>t===e);throw new R9(`unknown rule or group "${e}". Groups: all, ${I9.join(`, `)}. Rules: ${J8t()}`)},X8t=({enable:e=[],disable:t=[]})=>{if([...t,...e].includes(k9.id))throw new R9(`${k9.id} always runs and can't be disabled`);let n=new Set(F9);for(let e of t)for(let t of Y8t(e))n.delete(t);for(let t of e)for(let e of Y8t(t))n.add(e);return F9.filter(e=>n.has(e))},Z8t=(e,t)=>Object.assign(Object.assign({},t),{rule:e.id,group:e.group,severity:t.severity??e.severity}),Q8t=new Map(F9.map(({id:e},t)=>[e,t])),z9=e=>e.sort((e,t)=>(e.file<t.file?-1:+(e.file>t.file))||(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0)||(Q8t.get(e.rule)??0)-(Q8t.get(t.rule)??0)),$8t=(e,t,n,r)=>{let i=new Set(e.filter(e=>e.rule===t.id).map(r));for(let a of n)i.has(r(a))||(i.add(r(a)),e.push(Z8t(t,a)))},e5t=(e,t,n)=>$8t(t,k9,n.filter(({file:t})=>!e.selected||e.selected.has(t)),({file:e})=>e),t5t=e=>e.filter(e=>e.scope===`file`),B9=(e,t,n,r)=>L9(void 0,void 0,void 0,function*(){for(let i of t)if(i.scope===`site`&&!!i.needsBuild===n)for(let t of yield i.check(e))r.push(Z8t(i,t))}),n5t=(e,t)=>L9(void 0,void 0,void 0,function*(){let n=yield p8t(e,t5t(t));return yield B9(e,t,!1,n),z9(n)}),r5t=(e,t,n)=>L9(void 0,void 0,void 0,function*(){return yield B9(e,t,!0,n),e5t(e,n,x8t(e,`parse-error`)),z9(n)}),i5t=(e,t,n)=>{let r=o8t(e,t,n);return`error`in r?0:r.approximate?1:2},a5t=(e,t)=>L9(void 0,void 0,void 0,function*(){let n=t=>e.read(t)??``,r=/* @__PURE__ */ new Map,i=({file:e,start:t,end:n})=>(r.get(e)??[]).some(({fix:e})=>t<e.end&&e.start<n);for(let{rule:e,fix:a}of t){if(!a||i(a))continue;let t=n(a.file),o=Object.assign(Object.assign({rule:e,file:a.file},D9(t,a.start)),{before:t.slice(a.start,a.end),after:a.text});r.set(a.file,[...r.get(a.file)??[],{fix:a,change:o}])}let a=new Set(e.files.filter(({kind:e})=>e===`snippet`).map(({file:e})=>e)),o=(t,n)=>i5t(t,a.has(t)?OO(n,e.variables):n,e.baseDir),s=[];for(let[t,i]of r){let r=n(t),a=E9(r,T9(i.map(({fix:e})=>e)));/\.mdx?$/.test(t)&&o(t,a)<o(t,r)||(yield Hn.writeFile(It.join(e.baseDir,t),a),s.push(...i.map(({change:e})=>e)))}return s}),o5t=(e,t,n)=>L9(void 0,void 0,void 0,function*(){let r=[],i=yield q8t(e,n),{selected:a}=n;if(a&&!i.files.some(({file:e})=>a.has(e)))throw new R9(`none of the given files are pages or snippets of this site: ${[...a].join(`, `)}`);let o=yield n5t(i,t);if(!n.fix)return{site:i,diagnostics:o,fixed:r};let s=o;for(let a=0;a<5;a++){let a=yield a5t(i,s);if(a.length===0)break;r.push(...a),i=yield q8t(e,n);let o=new Set(a.map(({file:e})=>e));s=z9(yield p8t(Object.assign(Object.assign({},i),{selected:o}),t5t(t)))}return r.length===0?{site:i,diagnostics:o,fixed:r}:{site:i,diagnostics:yield n5t(i,t),fixed:r}}),s5t=e=>{let t=JSON.stringify(e);return t.length>60?`${t.slice(0,57)}..."`:t},c5t=({line:e,column:t})=>e?`${e}${t?`:${t}`:``}`:``,l5t=({diagnostic:e})=>{let t=c5t(e);return(0,z.jsxs)(dH,{children:[` `,e.severity===`error`?(0,z.jsx)(dH,{color:`red`,children:`✗`}):(0,z.jsx)(dH,{color:`yellow`,children:`!`}),` `,t&&(0,z.jsxs)(dH,{dimColor:!0,children:[t,` `]}),(0,z.jsx)(dH,{dimColor:!0,children:e.rule}),` `,e.message,e.fix&&(0,z.jsx)(dH,{dimColor:!0,children:` (fixable)`})]})},V9=(e,t)=>`${e} ${t}${e===1?``:`s`}`,u5t=e=>{for(let t of e.fixed??[])EH((0,z.jsx)(hH,{message:`fixed ${t.file}${t.line?`:${t.line}`:``} ${t.rule}: ${s5t(t.before)} → ${s5t(t.after)}`}));let t=/* @__PURE__ */ new Map;for(let n of e.diagnostics)t.get(n.file)?.push(n)??t.set(n.file,[n]);for(let[e,n]of t)EH((0,z.jsxs)(uH,{flexDirection:`column`,children:[(0,z.jsx)(dH,{bold:!0,children:e}),n.map((e,t)=>(0,z.jsx)(l5t,{diagnostic:e},t))]}));let n=e.diagnostics.filter(({fix:e})=>e).length;n>0&&!e.fixed&&EH((0,z.jsx)(mH,{message:`\`--fix\` would fix ${V9(n,`issue`)}.`}));let{build:r}=e;r.ran&&r.passed?EH((0,z.jsx)(hH,{message:`build passed`})):r.ran&&e.passed?EH((0,z.jsx)(mH,{message:`build failed only on disabled rules`})):r.ran?EH((0,z.jsx)(vH,{message:`build failed`})):r.reason===`errors found`&&EH((0,z.jsx)(mH,{message:`build skipped until the errors above are fixed`}));let{errors:i,warnings:a}=e.summary,o=V9(a,`warning`),s=a>0?`passed with ${o}`:`validation passed`,c=`${V9(i,`error`)}${a>0?`, ${o}`:``}`;EH(e.passed?(0,z.jsx)(hH,{message:s}):(0,z.jsx)(vH,{message:c}))},d5t=(e,t,n)=>{let r={};for(let{rule:t}of e)r[t]=(r[t]??0)+1;let i=e.filter(({severity:e})=>e===`error`).length;return Object.assign({passed:i===0,summary:{errors:i,warnings:e.length-i,byRule:r},diagnostics:e.map(({rule:e,group:t,severity:n,file:r,line:i,column:a,message:o,fix:s})=>Object.assign(Object.assign(Object.assign(Object.assign({rule:e,group:t,severity:n,file:r},i!==void 0&&{line:i}),a!==void 0&&{column:a}),{message:o}),s&&{fix:s})),build:t},n&&{fixed:n})};var f5t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},p5t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const H9={passed:0,failed:1,crashed:2},m5t=e=>e.flatMap(e=>e.split(`,`).map(e=>e.trim()).filter(Boolean)),h5t=e=>new Promise(t=>{process.stdout.write(e,()=>t())}),g5t=()=>{let e={log:console.log,info:console.info,warn:console.warn,error:console.error};return console.log=console.info=console.warn=console.error=(...e)=>{process.stderr.write(`${dr(...e)}\n`)},()=>Object.assign(console,e)},_5t=(e,t)=>f5t(void 0,void 0,void 0,function*(){let n=(t??[]).map(String).filter(Boolean);if(n.length===0)return;let r=yield eRt(r1,n);return new Set(r.map(t=>It.relative(e,It.resolve(r1,t)).split(It.sep).join(`/`)))}),v5t=(e,t,...n)=>f5t(void 0,[e,t,...n],void 0,function*(e,t,n=r1){let r=e.format===`json`,i=r?g5t():void 0;try{let a=X8t({enable:e.enable,disable:e.disable??[]}),o=yield _5t(n,e.files);r||EH((0,z.jsx)(gH,{message:`validating...`}));let s=yield o5t(n,a,{selected:o,localSchema:e[`local-schema`],fix:e.fix}),{site:c,fixed:l}=s,{diagnostics:u}=p5t(s,[`site`,`fixed`]),d=a.some(({needsBuild:e})=>e),f;if(!e.build)f={ran:!1,reason:`disabled`};else if(!d)f={ran:!1,reason:`no build rules`};else if(u.some(({severity:e})=>e===`error`))f={ran:!1,reason:`errors found`};else{r||EH((0,z.jsx)(gH,{message:`building...`}));let{cli:n}=a1(t);c.build=yield sdt(Object.assign(Object.assign({},e),{_:[],$0:t,packageName:t,cliVersion:n,disableOpenapi:!a.some(({group:e})=>e===`openapi`)})),u=yield r5t(c,a,u),f={ran:!0,passed:c.build.passed}}let p=d5t(u,f,e.fix?l:void 0);r?(i?.(),yield h5t(`${JSON.stringify(p)}\n`)):(AH(),u5t(p),p.passed&&f.ran&&f.passed&&(yield y6t())),yield l1(p.passed?H9.passed:H9.failed)}catch(e){r?(i?.(),process.stderr.write(`Error: ${c1(e)}\n`)):(AH(),EH((0,z.jsx)(vH,{message:c1(e)}))),yield l1(H9.crashed)}}),U9=QJ.hex(`#18E299`),y5t=[{title:`Preview`,commands:[{name:`dev`,description:`Start a local preview of your site`},{name:`new`,description:`Scaffold a new documentation site`},{name:`deploy`,description:`Provision a docs site without login; get Git push instructions`}]},{title:`Quality`,commands:[{name:`validate`,description:`Validate the site build (strict)`},{name:`broken-links`,description:`Find broken links before you ship`},{name:`a11y`,description:`Check site for accessibility issues`},{name:`score`,description:`Run agent-readiness checks`}]},{title:`Insights`,commands:[{name:`analytics`,description:`View analytics for your site`},{name:`automations`,description:`Create and manage automations`}]},{title:`Account`,commands:[{name:`login`,description:`Authenticate with Mintlify`},{name:`claim`,description:`Claim a site created with mint deploy`},{name:`logout`,description:`Sign out on this device`},{name:`status`,description:`View authentication status`}]},{title:`CLI`,commands:[{name:`agent setup`,description:`Install Mintlify skills and configure Admin MCP`},{name:`config`,description:`Manage CLI configuration`},{name:`instructions`,description:`Print Mintlify workflow instructions`},{name:`update`,description:`Update to the latest version`}]}],b5t=[{name:`dev`,description:`Start a local preview of your site`},{name:`new docs`,description:`Scaffold a new site in ./docs`},{name:`claim`,description:`Get a claim link; use the deployment directory`},{name:`validate`,description:`Validate your site before shipping`},{name:`broken-links`,description:`Find broken links across your site`}],x5t=y5t.flatMap(e=>e.commands).reduce((e,t)=>Math.max(e,t.name.length),0)+2,S5t=(e,t,n,r)=>` `.repeat(r)+U9(e.padEnd(n))+QJ.dim(t);function C5t({packageName:e,version:t,signedIn:n,subdomain:r}){let i=`${e.charAt(0).toUpperCase()}${e.slice(1)} CLI`,a=t?/^\d/.test(t)?`v${t}`:t:void 0,o=[QJ.bold(i)+(a?QJ.dim(` ${a}`):``),``,n?QJ.dim(`Signed in to Mintlify`):QJ.dim(`Run `)+U9(`${e} login`)+QJ.dim(` to sign in`),...r?[QJ.dim(`Project ${r}`)]:[]],s=[``];s.push(...o);let c=b5t.reduce((t,n)=>Math.max(t,`${e} ${n.name}`.length),0)+2;s.push(``,` `+QJ.bold(`EXAMPLES`));for(let t of b5t)s.push(S5t(`${e} ${t.name}`,t.description,c,3));s.push(``,` `+QJ.bold(`COMMANDS`));for(let e of y5t){s.push(``,` `+QJ.bold(e.title));for(let t of e.commands)s.push(S5t(t.name,t.description,x5t,5))}return s.push(``,` `+QJ.dim(`Run `)+U9(`${e} <command> --help`)+QJ.dim(` for details on any command.`),``),s.join(`
|
|
2323
|
+
`);n.push({line:o.length,column:(o.pop()?.length??0)+1,message:`<${r[1]}> must be self-closed`,edit:{start:i,end:a,text:`${e.slice(i,a-1).trimEnd()} />`}})}return n}};var W8t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const F9=[U8t,E8t,z8t,F8t,N8t,j8t,A8t,{id:`openapi-spec`,group:`openapi`,severity:`error`,scope:`site`,description:`OpenAPI specs in docs.json or mint.json that don't parse or validate, with overlays applied`,check:e=>W8t(void 0,void 0,void 0,function*(){let t=[];try{let n=JSON.parse(yield Hn.readFile(It.join(e.baseDir,e.configFile),`utf-8`));t=$3t(e.configFile===`mint.json`?{api:{openapi:n.openapi}}:n)}catch{}if(t.length===0)return[];let n;try{n=yield e6t(e.localSchema)}catch(t){return[{file:e.configFile,message:`OpenAPI overlays: ${c1(t)}`}]}return(yield Promise.all(t.map(t=>W8t(void 0,void 0,void 0,function*(){let r=[];return yield n6t(t,e.localSchema,n,e=>r.push(e)),r.flatMap(({level:e,message:n})=>e===`error`?[{file:t,message:n}]:e===`warning`?[{file:t,message:n,severity:`warning`}]:[])})))).flat()})},...b8t];var G8t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};const K8t=e=>{try{let{variables:t}=JSON.parse(e);return t&&typeof t==`object`?t:void 0}catch{return}},q8t=(e,t)=>G8t(void 0,[e,t],void 0,function*(e,{selected:t,localSchema:n}){let r=yield Q6t(e),i=/* @__PURE__ */ new Map,a=En.existsSync(It.join(e,`docs.json`))?`docs.json`:`mint.json`,o=t=>{if(!i.has(t))try{i.set(t,En.readFileSync(It.join(e,t),`utf-8`))}catch{i.set(t,void 0)}return i.get(t)};return{baseDir:e,files:r,selected:t,configFile:a,variables:K8t(o(a)??``),localSchema:n,read:o,locate:(e,t)=>{let n=o(e)??``,r=t?n.indexOf(t):-1;return r===-1?{}:D9(n,r)}}}),I9=[`content`,`nav`,`config`,`openapi`];var L9=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},R9=class extends Error{};const J8t=()=>F9.map(({id:e})=>e).join(`, `),Y8t=e=>{if(e===`all`)return F9;let t=F9.find(({id:t})=>t===e);if(t)return[t];if(I9.includes(e))return F9.filter(({group:t})=>t===e);throw new R9(`unknown rule or group "${e}". Groups: all, ${I9.join(`, `)}. Rules: ${J8t()}`)},X8t=({enable:e=[],disable:t=[]})=>{if([...t,...e].includes(k9.id))throw new R9(`${k9.id} always runs and can't be disabled`);let n=new Set(F9);for(let e of t)for(let t of Y8t(e))n.delete(t);for(let t of e)for(let e of Y8t(t))n.add(e);return F9.filter(e=>n.has(e))},Z8t=(e,t)=>Object.assign(Object.assign({},t),{rule:e.id,group:e.group,severity:t.severity??e.severity}),Q8t=new Map(F9.map(({id:e},t)=>[e,t])),z9=e=>e.sort((e,t)=>(e.file<t.file?-1:+(e.file>t.file))||(e.line??0)-(t.line??0)||(e.column??0)-(t.column??0)||(Q8t.get(e.rule)??0)-(Q8t.get(t.rule)??0)),$8t=(e,t,n,r)=>{let i=new Set(e.filter(e=>e.rule===t.id).map(r));for(let a of n)i.has(r(a))||(i.add(r(a)),e.push(Z8t(t,a)))},e5t=(e,t,n)=>$8t(t,k9,n.filter(({file:t})=>!e.selected||e.selected.has(t)),({file:e})=>e),t5t=e=>e.filter(e=>e.scope===`file`),B9=(e,t,n,r)=>L9(void 0,void 0,void 0,function*(){for(let i of t)if(i.scope===`site`&&!!i.needsBuild===n)for(let t of yield i.check(e))r.push(Z8t(i,t))}),n5t=(e,t)=>L9(void 0,void 0,void 0,function*(){let n=yield p8t(e,t5t(t));return yield B9(e,t,!1,n),z9(n)}),r5t=(e,t,n)=>L9(void 0,void 0,void 0,function*(){return yield B9(e,t,!0,n),e5t(e,n,x8t(e,`parse-error`)),z9(n)}),i5t=(e,t,n)=>{let r=o8t(e,t,n);return`error`in r?0:r.approximate?1:2},a5t=(e,t)=>L9(void 0,void 0,void 0,function*(){let n=t=>e.read(t)??``,r=/* @__PURE__ */ new Map,i=({file:e,start:t,end:n})=>(r.get(e)??[]).some(({fix:e})=>t<e.end&&e.start<n);for(let{rule:e,fix:a}of t){if(!a||i(a))continue;let t=n(a.file),o=Object.assign(Object.assign({rule:e,file:a.file},D9(t,a.start)),{before:t.slice(a.start,a.end),after:a.text});r.set(a.file,[...r.get(a.file)??[],{fix:a,change:o}])}let a=new Set(e.files.filter(({kind:e})=>e===`snippet`).map(({file:e})=>e)),o=(t,n)=>i5t(t,a.has(t)?OO(n,e.variables):n,e.baseDir),s=[];for(let[t,i]of r){let r=n(t),a=E9(r,T9(i.map(({fix:e})=>e)));/\.mdx?$/.test(t)&&o(t,a)<o(t,r)||(yield Hn.writeFile(It.join(e.baseDir,t),a),s.push(...i.map(({change:e})=>e)))}return s}),o5t=(e,t,n)=>L9(void 0,void 0,void 0,function*(){let r=[],i=yield q8t(e,n),{selected:a}=n;if(a&&!i.files.some(({file:e})=>a.has(e)))throw new R9(`none of the given files are pages or snippets of this site: ${[...a].join(`, `)}`);let o=yield n5t(i,t);if(!n.fix)return{site:i,diagnostics:o,fixed:r};let s=o;for(let a=0;a<5;a++){let a=yield a5t(i,s);if(a.length===0)break;r.push(...a),i=yield q8t(e,n);let o=new Set(a.map(({file:e})=>e));s=z9(yield p8t(Object.assign(Object.assign({},i),{selected:o}),t5t(t)))}return r.length===0?{site:i,diagnostics:o,fixed:r}:{site:i,diagnostics:yield n5t(i,t),fixed:r}}),s5t=e=>{let t=JSON.stringify(e);return t.length>60?`${t.slice(0,57)}..."`:t},c5t=({line:e,column:t})=>e?`${e}${t?`:${t}`:``}`:``,l5t=({diagnostic:e})=>{let t=c5t(e);return(0,z.jsxs)(dH,{children:[` `,e.severity===`error`?(0,z.jsx)(dH,{color:`red`,children:`✗`}):(0,z.jsx)(dH,{color:`yellow`,children:`!`}),` `,t&&(0,z.jsxs)(dH,{dimColor:!0,children:[t,` `]}),(0,z.jsx)(dH,{dimColor:!0,children:e.rule}),` `,e.message,e.fix&&(0,z.jsx)(dH,{dimColor:!0,children:` (fixable)`})]})},V9=(e,t)=>`${e} ${t}${e===1?``:`s`}`,u5t=e=>{for(let t of e.fixed??[])EH((0,z.jsx)(hH,{message:`fixed ${t.file}${t.line?`:${t.line}`:``} ${t.rule}: ${s5t(t.before)} → ${s5t(t.after)}`}));let t=/* @__PURE__ */ new Map;for(let n of e.diagnostics)t.get(n.file)?.push(n)??t.set(n.file,[n]);for(let[e,n]of t)EH((0,z.jsxs)(uH,{flexDirection:`column`,marginBottom:1,children:[(0,z.jsx)(dH,{bold:!0,children:e}),n.map((e,t)=>(0,z.jsx)(l5t,{diagnostic:e},t))]}));let n=e.diagnostics.filter(({fix:e})=>e).length;n>0&&!e.fixed&&EH((0,z.jsx)(mH,{message:`\`--fix\` would fix ${V9(n,`issue`)}.`}));let{build:r}=e;r.ran&&r.passed?EH((0,z.jsx)(hH,{message:`build passed`})):r.ran&&e.passed?EH((0,z.jsx)(mH,{message:`build failed only on disabled rules`})):r.ran?EH((0,z.jsx)(vH,{message:`build failed`})):r.reason===`errors found`&&EH((0,z.jsx)(mH,{message:`build skipped until the errors above are fixed`}));let{errors:i,warnings:a}=e.summary,o=V9(a,`warning`),s=a>0?`passed with ${o}`:`validation passed`,c=`${V9(i,`error`)}${a>0?`, ${o}`:``}`;EH(e.passed?(0,z.jsx)(hH,{message:s}):(0,z.jsx)(vH,{message:c}))},d5t=(e,t,n)=>{let r={};for(let{rule:t}of e)r[t]=(r[t]??0)+1;let i=e.filter(({severity:e})=>e===`error`).length;return Object.assign({passed:i===0,summary:{errors:i,warnings:e.length-i,byRule:r},diagnostics:e.map(({rule:e,group:t,severity:n,file:r,line:i,column:a,message:o,fix:s})=>Object.assign(Object.assign(Object.assign(Object.assign({rule:e,group:t,severity:n,file:r},i!==void 0&&{line:i}),a!==void 0&&{column:a}),{message:o}),s&&{fix:s})),build:t},n&&{fixed:n})};var f5t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})},p5t=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n};const H9={passed:0,failed:1,crashed:2},m5t=e=>e.flatMap(e=>e.split(`,`).map(e=>e.trim()).filter(Boolean)),h5t=e=>new Promise(t=>{process.stdout.write(e,()=>t())}),g5t=()=>{let e={log:console.log,info:console.info,warn:console.warn,error:console.error};return console.log=console.info=console.warn=console.error=(...e)=>{process.stderr.write(`${dr(...e)}\n`)},()=>Object.assign(console,e)},_5t=(e,t)=>f5t(void 0,void 0,void 0,function*(){let n=(t??[]).map(String).filter(Boolean);if(n.length===0)return;let r=yield eRt(r1,n);return new Set(r.map(t=>It.relative(e,It.resolve(r1,t)).split(It.sep).join(`/`)))}),v5t=(e,t,...n)=>f5t(void 0,[e,t,...n],void 0,function*(e,t,n=r1){let r=e.format===`json`,i=r?g5t():void 0;try{let a=X8t({enable:e.enable,disable:e.disable??[]}),o=yield _5t(n,e.files);r||EH((0,z.jsx)(gH,{message:`validating...`}));let s=yield o5t(n,a,{selected:o,localSchema:e[`local-schema`],fix:e.fix}),{site:c,fixed:l}=s,{diagnostics:u}=p5t(s,[`site`,`fixed`]),d=a.some(({needsBuild:e})=>e),f;if(!e.build)f={ran:!1,reason:`disabled`};else if(!d)f={ran:!1,reason:`no build rules`};else if(u.some(({severity:e})=>e===`error`))f={ran:!1,reason:`errors found`};else{r||EH((0,z.jsx)(gH,{message:`building...`}));let{cli:n}=a1(t);c.build=yield sdt(Object.assign(Object.assign({},e),{_:[],$0:t,packageName:t,cliVersion:n,disableOpenapi:!a.some(({group:e})=>e===`openapi`)})),u=yield r5t(c,a,u),f={ran:!0,passed:c.build.passed}}let p=d5t(u,f,e.fix?l:void 0);r?(i?.(),yield h5t(`${JSON.stringify(p)}\n`)):(AH(),u5t(p),p.passed&&f.ran&&f.passed&&(yield y6t())),yield l1(p.passed?H9.passed:H9.failed)}catch(e){r?(i?.(),process.stderr.write(`Error: ${c1(e)}\n`)):(AH(),EH((0,z.jsx)(vH,{message:c1(e)}))),yield l1(H9.crashed)}}),U9=QJ.hex(`#18E299`),y5t=[{title:`Preview`,commands:[{name:`dev`,description:`Start a local preview of your site`},{name:`new`,description:`Scaffold a new documentation site`},{name:`deploy`,description:`Provision a docs site without login; get Git push instructions`}]},{title:`Quality`,commands:[{name:`validate`,description:`Validate the site build (strict)`},{name:`broken-links`,description:`Find broken links before you ship`},{name:`a11y`,description:`Check site for accessibility issues`},{name:`score`,description:`Run agent-readiness checks`}]},{title:`Insights`,commands:[{name:`analytics`,description:`View analytics for your site`},{name:`automations`,description:`Create and manage automations`}]},{title:`Account`,commands:[{name:`login`,description:`Authenticate with Mintlify`},{name:`claim`,description:`Claim a site created with mint deploy`},{name:`logout`,description:`Sign out on this device`},{name:`status`,description:`View authentication status`}]},{title:`CLI`,commands:[{name:`agent setup`,description:`Install Mintlify skills and configure Admin MCP`},{name:`config`,description:`Manage CLI configuration`},{name:`instructions`,description:`Print Mintlify workflow instructions`},{name:`update`,description:`Update to the latest version`}]}],b5t=[{name:`dev`,description:`Start a local preview of your site`},{name:`new docs`,description:`Scaffold a new site in ./docs`},{name:`claim`,description:`Get a claim link; use the deployment directory`},{name:`validate`,description:`Validate your site before shipping`},{name:`broken-links`,description:`Find broken links across your site`}],x5t=y5t.flatMap(e=>e.commands).reduce((e,t)=>Math.max(e,t.name.length),0)+2,S5t=(e,t,n,r)=>` `.repeat(r)+U9(e.padEnd(n))+QJ.dim(t);function C5t({packageName:e,version:t,signedIn:n,subdomain:r}){let i=`${e.charAt(0).toUpperCase()}${e.slice(1)} CLI`,a=t?/^\d/.test(t)?`v${t}`:t:void 0,o=[QJ.bold(i)+(a?QJ.dim(` ${a}`):``),``,n?QJ.dim(`Signed in to Mintlify`):QJ.dim(`Run `)+U9(`${e} login`)+QJ.dim(` to sign in`),...r?[QJ.dim(`Project ${r}`)]:[]],s=[``];s.push(...o);let c=b5t.reduce((t,n)=>Math.max(t,`${e} ${n.name}`.length),0)+2;s.push(``,` `+QJ.bold(`EXAMPLES`));for(let t of b5t)s.push(S5t(`${e} ${t.name}`,t.description,c,3));s.push(``,` `+QJ.bold(`COMMANDS`));for(let e of y5t){s.push(``,` `+QJ.bold(e.title));for(let t of e.commands)s.push(S5t(t.name,t.description,x5t,5))}return s.push(``,` `+QJ.dim(`Run `)+U9(`${e} <command> --help`)+QJ.dim(` for details on any command.`),``),s.join(`
|
|
2324
2324
|
`)+`
|
|
2325
2325
|
`}var w5t=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function W9(e,t){return w5t(this,void 0,void 0,function*(){let n=yield E1(`${x1}/api/cli/workflows${e}`,Object.assign(Object.assign({},t),{headers:Object.assign({Accept:`application/json`},t?.headers)}));if(!n.ok){let e=yield n.text().catch(()=>``);throw Error(`API error (${n.status}): ${e||n.statusText}`)}return n.json()})}function T5t(e,t){return W9(`/${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})}function E5t(e){return W9(`/${encodeURIComponent(e)}`)}function D5t(e,t){return W9(`/${encodeURIComponent(e)}/${encodeURIComponent(t)}`,{method:`DELETE`})}const G9=[`changelog`,`source-code-agent`,`translations`,`writing-style`,`typo-check`,`broken-link-detection`,`seo-metadata-audit`,`assistant-docs-updates`,`contextual-feedback-docs-updates`];var K9=function(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})};function q9(e){return e.format===`json`?`json`:`table`}function J9(e,t){e===`table`?EH((0,z.jsx)(dH,{children:t})):process.stdout.write(t+`
|
|
2326
2326
|
`)}function Y9(e){if(!e)throw Error("No subdomain set. Pass --subdomain, or run `mint config set subdomain <name>`.");return e}function O5t(e){return K9(this,void 0,void 0,function*(){let t=It.isAbsolute(e)?e:It.join(r1,e),n=yield Hn.readFile(t,`utf-8`);return/\.ya?ml$/i.test(t)?Re.load(n):JSON.parse(n)})}function k5t(e){let t=(e.pushRepo??[]).map(String).filter(Boolean);if(e.cron&&t.length>0)throw Error(`Specify either --cron or --push-repo, not both.`);if(e.cron)return{cron:e.cron};if(t.length>0)return{push:t.map(e=>({repo:e}))};throw Error(`A trigger is required. Pass --cron <expr> or --push-repo <owner/repo>.`)}function A5t(e){if(!e.name)throw Error(`--name is required when --file is not provided.`);let t=e.type;if(t!==void 0&&!G9.includes(t))throw Error(`Invalid --type "${t}". Valid types: ${G9.join(`, `)}`);let n={name:e.name,on:k5t(e)};e.prompt&&(n.prompt=e.prompt),t&&(n.type=t),e.automerge!==void 0&&(n.automerge=e.automerge);let r=(e.contextRepo??[]).map(String).filter(Boolean);return r.length>0&&(n.context=r.map(e=>({repo:e}))),n}function X9(e){return`webhook`in e?`webhook`:`cron`in e?`cron(${e.cron})`:`push`in e?`push(${e.push.map(e=>e.repo).join(`, `)})`:`composio(${e.composio.toolkit}:${e.composio.triggerSlug})`}function j5t(e){let t=[];return t.push(QJ.bold(`\nAutomation ${e.name}`)),t.push(` ${QJ.dim(`ID`)} ${e._id}`),t.push(` ${QJ.dim(`Status`)} ${e.status}`),e.type&&t.push(` ${QJ.dim(`Type`)} ${e.type}`),t.push(` ${QJ.dim(`Trigger`)} ${X9(e.trigger)}`),e.automerge!==void 0&&t.push(` ${QJ.dim(`Automerge`)} ${e.automerge}`),t.join(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mintlify/cli",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.17",
|
|
4
4
|
"description": "The Mintlify CLI",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18.0.0"
|
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
"sharp": "0.33.5"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@mintlify/package-builder": "0.0.
|
|
54
|
+
"@mintlify/package-builder": "0.0.147",
|
|
55
55
|
"fsevents": "2.3.3",
|
|
56
56
|
"keytar": "7.9.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@inquirer/prompts": "7.9.0",
|
|
60
|
-
"@mintlify/common": "1.0.
|
|
61
|
-
"@mintlify/editor": "0.0.
|
|
62
|
-
"@mintlify/link-rot": "3.0.
|
|
60
|
+
"@mintlify/common": "1.0.1358",
|
|
61
|
+
"@mintlify/editor": "0.0.636",
|
|
62
|
+
"@mintlify/link-rot": "3.0.1603",
|
|
63
63
|
"@mintlify/models": "0.0.392",
|
|
64
|
-
"@mintlify/og": "0.0.
|
|
65
|
-
"@mintlify/prebuild": "1.0.
|
|
66
|
-
"@mintlify/previewing": "4.0.
|
|
64
|
+
"@mintlify/og": "0.0.157",
|
|
65
|
+
"@mintlify/prebuild": "1.0.1534",
|
|
66
|
+
"@mintlify/previewing": "4.0.1621",
|
|
67
67
|
"@mintlify/ts-config": "2.0.2",
|
|
68
68
|
"@mintlify/validation": "0.1.969",
|
|
69
69
|
"@tsconfig/recommended": "1.0.2",
|
|
@@ -113,5 +113,5 @@
|
|
|
113
113
|
"yargs": "17.7.1",
|
|
114
114
|
"zod": "4.3.6"
|
|
115
115
|
},
|
|
116
|
-
"gitHead": "
|
|
116
|
+
"gitHead": "bd94735c612466834d8116657cc8ee5ea073d682"
|
|
117
117
|
}
|