@vercel/geistdocs 2.3.2 → 2.4.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/dist/cli/index.js +6 -6
- package/dist/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -1
- package/dist/internal/mdx-to-markdown.js +80 -11
- package/dist/internal/navbar/logo-vercel-labs.d.ts +2 -0
- package/dist/internal/navbar/logo-vercel-labs.d.ts.map +1 -0
- package/dist/internal/navbar/logo-vercel-labs.js +2 -0
- package/dist/internal/navbar/navbar-brand.d.ts +8 -0
- package/dist/internal/navbar/navbar-brand.d.ts.map +1 -0
- package/dist/internal/navbar/navbar-brand.js +20 -0
- package/dist/internal/navbar/navbar-logo.d.ts +3 -2
- package/dist/internal/navbar/navbar-logo.d.ts.map +1 -1
- package/dist/internal/navbar/navbar-logo.js +4 -3
- package/dist/navbar.d.ts +1 -1
- package/dist/navbar.d.ts.map +1 -1
- package/dist/navbar.js +1 -1
- package/docs/agents.md +1 -1
- package/docs/llms.txt +39 -1
- package/docs/manifest.json +1 -1
- package/docs/pages/configuration.md +22 -0
- package/docs/pages/getting-started.md +16 -0
- package/package.json +1 -1
- package/template/content/docs/configuration.mdx +22 -0
- package/template/content/docs/getting-started.mdx +16 -0
- package/template/geistdocs.tsx +3 -0
- package/template/lib/geistdocs/config.tsx +2 -0
- package/template/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{program as A}from"commander";import{access as
|
|
3
|
-
`,"utf8")},J=(e,t)=>{for(let n of ce){let r=e[n];if(r&&t in r)return r[t]}},le=(e,t)=>!!J(e,t),$=(e,t,n)=>{let r=!1;for(let s of ce){let i=e[s];i&&t in i&&(i[t]=n,r=!0)}return r},H=()=>He(new URL("../../template",import.meta.url)),N=async e=>{await je(H(),e,{recursive:!0});let t=C(e,".gitignore"),n=C(e,"_gitignore");try{await Be(n,t)}catch{}};var pe="@vercel/geistdocs",ue="@vercel/geistdocs-private";var et=async e=>{await N(e)},tt=async e=>{try{return await Xe(e),!0}catch{return!1}},nt=async()=>{await tt(".env.example")&&await Ke(".env.example",".env.local")},rt=async(e,t)=>{let n=await M(e),r=de();return $(n,t,r)?(await O(e,n),!0):!1};var st=async e=>{await T("pnpm",["install"],{cwd:e,env:process.env,stdio:"inherit"})},it=async e=>{await T("git",["init"],{cwd:e,env:process.env,stdio:"inherit"}),await T("git",["add","."],{cwd:e,env:process.env,stdio:"inherit"}),await T("git",["commit","-m","\u2728 Initial commit"],{cwd:e,env:process.env,stdio:"inherit"})},ot=async()=>{let e=await Ze({message:"What is your project named?",placeholder:"my-app",validate(t){if(t.length===0)return"Please enter a project name."}});return me(e)&&(ge("Operation cancelled."),process.exit(0)),e.toString()},at=async()=>b,fe=async e=>{try{ze("Let's start a Geistdocs project!");let t=process.cwd(),n=e.name||await ot(),r=await at(),s=Qe(),i=Ye(t,n);s.start("Copying bundled template..."),await et(n),s.message("Setting up environment variables..."),process.chdir(i),await nt(),s.message("Rewriting package dependency versions..."),await rt(i,r),s.message("Installing dependencies..."),await st(i),e.disableGit||(s.message("Initializing Git repository..."),await it(i)),s.stop("Project initialized successfully!"),We("Run `pnpm dev` to start the development server.")}catch(t){let n=t instanceof Error?t.message:`Failed to initialize project: ${t}`;X.error(n),process.exit(1)}};import{execFileSync as Ft}from"child_process";import Dt from"@next/env";var ct="https://api.mixedbread.com/v1";var dt=/\/$/;var g={contentHash:"geistdocs_content_hash",description:"geistdocs_description",documentId:"geistdocs_document_id",locale:"geistdocs_locale",rawFileId:"geistdocs_raw_file_id",revision:"geistdocs_revision",revisionAncestors:"geistdocs_revision_ancestors",revisionTimestamp:"geistdocs_revision_timestamp",schemaVersion:"geistdocs_schema_version",siteId:"geistdocs_site_id",sourceId:"geistdocs_source_id",sourceUrl:"geistdocs_source_url",title:"geistdocs_title",url:"geistdocs_url"},Y=e=>typeof e=="object"&&e!==null,S=(e,t)=>{let n=e[t];return typeof n=="string"?n:void 0},lt=(e,t)=>{let n=e[t];return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]},pt=(e,t)=>{let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0},q=e=>{if(!Y(e))return null;let t=e[g.schemaVersion],n=S(e,g.contentHash),r=S(e,g.description)??"",s=S(e,g.documentId),i=S(e,g.locale),o=S(e,g.rawFileId),a=S(e,g.revision),d=lt(e,g.revisionAncestors),c=pt(e,g.revisionTimestamp),u=S(e,g.siteId),l=S(e,g.sourceId),m=S(e,g.sourceUrl),f=S(e,g.title),h=S(e,g.url);return t!==1||!n||!s||!i||!u||!l||!m||!f||!h?null:{contentHash:n,description:r,documentId:s,locale:i,rawFileId:o,revision:a,revisionAncestors:d,revisionTimestamp:c,schemaVersion:t,siteId:u,sourceId:l,sourceUrl:m,title:f,url:h}},K=e=>Y(e)&&typeof e.id=="string"&&typeof e.status=="string"&&["cancelled","completed","failed","in_progress","pending"].includes(e.status),ut=e=>new Promise(t=>{setTimeout(t,e)}),gt=(e,t)=>{let n=e.headers.get("retry-after");if(n){let r=Number(n);if(Number.isFinite(r)&&r>=0)return Math.min(r*1e3,3e4);let s=Date.parse(n);if(Number.isFinite(s))return Math.min(Math.max(0,s-Date.now()),3e4)}return 250*2**t},mt=e=>e===408||e===409||e===429||e>=500,U=e=>encodeURIComponent(e),R=class extends Error{status;constructor(t,n){super(t),this.name="MixedbreadRequestError",this.status=n}},he=({apiBaseUrl:e=ct,apiKey:t,fetchImpl:n=fetch,maxRetries:r=2,requestTimeoutMs:s=3e4,sleep:i=ut,storeId:o})=>{let a=e.replace(dt,""),d=U(o),c=async({body:u,headers:l,method:m,path:f,signal:h})=>{for(let x=0;;x+=1){let v=new AbortController,_=()=>v.abort(h?.reason);h?.aborted?_():h?.addEventListener("abort",_,{once:!0});let se=setTimeout(()=>{v.abort(new Error("Mixedbread request timed out"))},s);try{let E=await n(`${a}${f}`,{body:u?.(),headers:{Authorization:`Bearer ${t}`,...l},method:m,signal:v.signal});if(!E.ok){if(x<r&&mt(E.status)){await i(gt(E,x));continue}let D=(await E.text()).slice(0,500);throw new R(`Mixedbread request failed (${E.status} ${E.statusText})${D?`: ${D}`:""}`,E.status)}return E.status===204?void 0:await E.json()}finally{clearTimeout(se),h?.removeEventListener("abort",_)}}};return{async search({locale:u,query:l,signal:m,siteId:f,topK:h}){let x=await c({body:()=>JSON.stringify({filters:{all:[{key:g.siteId,operator:"eq",value:f},{key:g.locale,operator:"eq",value:u}]},query:l,search_options:{return_metadata:!0},store_identifiers:[o],top_k:h}),headers:{"Content-Type":"application/json"},method:"POST",path:"/stores/search",signal:m});if(!Array.isArray(x.data))throw new Error("Mixedbread search returned an invalid response");return x.data.filter(Y)},async listStoreFiles(u){let l=await c({body:()=>JSON.stringify({after:u,limit:100}),headers:{"Content-Type":"application/json"},method:"POST",path:`/stores/${d}/files/list`});if(!Array.isArray(l.data))throw new Error("Mixedbread file listing returned an invalid response");let m=l.data.filter(K),f=l.pagination?.has_more?l.pagination.last_cursor:void 0;if(l.pagination?.has_more&&!f)throw new Error("Mixedbread file listing omitted its next cursor");return{files:m,nextCursor:f??void 0}},async uploadFile({content:u,filename:l}){let m=await c({body:()=>{let f=new FormData;return f.append("file",new Blob([u],{type:"text/markdown"}),l),f},method:"POST",path:"/files"});if(typeof m.id!="string")throw new Error("Mixedbread file upload returned an invalid response");return m.id},async createStoreFile({externalId:u,fileId:l,metadata:m}){let f=await c({body:()=>JSON.stringify({config:{parsing_strategy:"fast"},external_id:u,file_id:l,metadata:m,overwrite:!0}),headers:{"Content-Type":"application/json"},method:"POST",path:`/stores/${d}/files`});if(!K(f))throw new Error("Mixedbread store file creation returned an invalid response");return f},async deleteFile(u){try{await c({method:"DELETE",path:`/files/${U(u)}`})}catch(l){if(!(l instanceof R&&l.status===404))throw l}},async retrieveStoreFile(u){let l=await c({method:"GET",path:`/stores/${d}/files/${U(u)}`});if(!K(l))throw new Error("Mixedbread store file retrieval returned an invalid response");return l},async deleteStoreFile(u){try{await c({method:"DELETE",path:`/stores/${d}/files/${U(u)}`})}catch(l){if(!(l instanceof R&&l.status===404))throw l}}}};import{createHash as ht}from"crypto";import{readFile as we}from"fs/promises";import{join as wt,resolve as z,sep as yt}from"path";var ye="/api/search/export",xt="server/app/api/search/export.body",Et=4,St=1e3,bt=18e4,Se=e=>typeof e=="object"&&e!==null,_t=e=>Se(e)?["content","description","id","locale","sourceId","sourceUrl","title","url"].every(t=>typeof e[t]=="string"):!1,be=e=>{if(!Se(e)||e.version!==1||e.provider!=="local"&&e.provider!=="mixedbread"||!Array.isArray(e.documents)||!e.documents.every(_t)||e.siteId!==void 0&&typeof e.siteId!="string")throw new Error("The Geistdocs search export is invalid or unsupported.");let t=new Set;for(let n of e.documents){if(t.has(n.id))throw new Error(`The Geistdocs search export contains duplicate document ID "${n.id}".`);t.add(n.id)}return e},_e=async({cwd:e=process.cwd(),outputDirectory:t=".next"}={})=>{let n=z(e,t),r=wt(n,"prerender-manifest.json"),i=JSON.parse(await we(r,"utf8")).routes?.[ye];if(i?.routeType!=="route"||i.compute!=="static"||i.response!=="complete")throw new Error(`${ye} was not statically generated by the latest Next.js build.`);let o=z(n,"server/app"),a=z(n,xt);if(!a.startsWith(`${o}${yt}`))throw new Error("The Geistdocs search export path escaped the Next.js output.");return be(JSON.parse(await we(a,"utf8")))},L=e=>ht("sha256").update(e).digest("hex"),Tt=e=>L(JSON.stringify({content:e.content,description:e.description,locale:e.locale,sourceId:e.sourceId,sourceUrl:e.sourceUrl,title:e.title,url:e.url})),It=({document:e,hash:t,revision:n,revisionAncestors:r,revisionTimestamp:s,siteId:i})=>({[g.contentHash]:t,[g.description]:e.description,[g.documentId]:e.id,[g.locale]:e.locale,...n?{[g.revision]:n}:{},...r.length>0?{[g.revisionAncestors]:r}:{},...s===void 0?{}:{[g.revisionTimestamp]:s},[g.schemaVersion]:1,[g.siteId]:i,[g.sourceId]:e.sourceId,[g.sourceUrl]:e.sourceUrl,[g.title]:e.title,[g.url]:e.url}),Pt=(e,t,n,r,s)=>{let i=Tt(e),o=L(t).slice(0,16),a=L(e.id).slice(0,32);return{document:e,externalId:`geistdocs/${o}/${a}/${i.slice(0,16)}`,hash:i,metadata:It({document:e,hash:i,revision:n,revisionAncestors:r,revisionTimestamp:s,siteId:t})}},W=(e,t,n)=>!!(t&&e.revisionAncestors.includes(t))||n!==void 0&&e.revisionTimestamp!==void 0&&e.revisionTimestamp>n,vt=({currentRevision:e,currentRevisionAncestors:t,currentRevisionTimestamp:n,desired:r,metadata:s})=>r?.hash===s.contentHash?!0:e&&s.revision?s.revision===e||t.includes(s.revision)||n!==void 0&&s.revisionTimestamp!==void 0&&s.revisionTimestamp<n:!1,At=e=>new Promise(t=>{setTimeout(t,e)}),xe=async e=>{let t=[],n=new Set,r;do{let s=await e.listStoreFiles(r);if(t.push(...s.files),r=s.nextCursor,r){if(n.has(r))throw new Error("Mixedbread file listing repeated a pagination cursor.");n.add(r)}}while(r);return t},Ee=async(e,t,n)=>{let r=[],s=[],i=0,o=async()=>{for(;i<e.length;){let a=i;i+=1;try{r[a]=await n(e[a])}catch(d){s.push(d)}}};if(await Promise.all(Array.from({length:Math.min(Math.max(1,t),e.length)},o)),s.length>0){let a=s.map(d=>d instanceof Error?d.message:String(d)).join(`
|
|
4
|
-
`);throw new AggregateError(
|
|
5
|
-
${a}`)}return r},
|
|
6
|
-
`).filter(Boolean)}catch{n=[]}let r=t||n[0],
|
|
7
|
-
`));let o=await Te({client:he({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:s}),manifest:i,...Ot(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as $t,writeFileSync as Nt}from"fs";import{mkdir as Ut,readFile as Z,writeFile as Lt}from"fs/promises";import{dirname as Gt,extname as jt,relative as Re,resolve as j}from"path";import{intro as Vt,isCancel as Bt,log as I,multiselect as Jt,outro as G,spinner as Ht}from"@clack/prompts";import{glob as Xt}from"glob";import{Node as F,Project as Kt,SyntaxKind as Yt}from"ts-morph";var qt="geistdocs.tsx",zt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,ve=()=>({version:1,entries:{}}),Wt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},Qt=e=>{let t=j(process.cwd(),e);return $t(t,"utf8")},Ae=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],Zt=e=>{try{let t=new Kt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=Qt(e),i=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!i)return[];if(F.isObjectLiteralExpression(i))return Ae(i);let o=i.getFirstDescendantByKind(Yt.ObjectLiteralExpression);return o?Ae(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},en=async()=>{let e=await Jt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Bt(e)&&(G("Translation cancelled"),process.exit(0)),e},tn=async e=>(await Xt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),nn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?ve():{version:1,entries:n.entries}}catch{return ve()}},Me=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Nt(t,n,"utf8")},rn=async e=>{let t=await Promise.all(e.map(async n=>[n,await Wt(n)]));return Object.fromEntries(t)},sn=(e,t)=>{let n=jt(e);return`${e.slice(0,-n.length)}.${t}${n}`},Fe=(e,t)=>`${Re(process.cwd(),e)}::${t}`,on=(e,t,n,r,s=!1)=>{let i=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=sn(a,c),l=Fe(a,c),m=r.entries[l];if(!s&&m?.hash===d){o+=1;continue}i.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:i,skippedCount:o}},an=async e=>{await Ut(Gt(e),{recursive:!0})},cn=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let i=await r.text();throw new Error(`API request failed (${r.status}): ${i}`)}let s=await r.json();if(!s.translation)throw new Error("API response did not include a translation");return s.translation},dn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),s=await cn(t,r,e.locale);await an(e.targetFile),await Lt(e.targetFile,s,"utf8"),n.entries[Fe(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},De=async(e,t)=>{Vt("Translate MDX content");let n=e??zt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",s=Zt(t.config??qt),i=await tn(n);i.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),G("Translation cancelled"),process.exit(1)),I.info(`Found ${i.length} MDX file(s) matching pattern`),s.length===0&&(s=await en());let o=j(process.cwd(),ee),a=await nn();await Me(a),I.info(`Using cache: ${o}`);let d=await rn(i),{tasks:c,skippedCount:u}=on(s,i,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),G(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Ht();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await dn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Re(process.cwd(),x.targetFile)}`)})),await Me(a);m.stop("Translation complete!"),G(`Created/updated ${c.length} file(s)`)};import{access as ln,copyFile as pn,mkdir as $e,rm as re}from"fs/promises";import{dirname as un,join as P}from"path";import{intro as gn,log as w,outro as V,spinner as Ne}from"@clack/prompts";import{glob as mn}from"glob";var fn=["**/*"],hn=["content/docs/**"],te=".geistdocs-tmp",wn=async(e,t)=>{let n=P(e,t);await re(n,{recursive:!0,force:!0}),await $e(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),ke=async(e,t,n)=>(await mn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),yn=async e=>{try{return await ln(e),!0}catch{return!1}},xn=async(e,t,n)=>{let r=P(t,e),s=P(n,e);return await yn(r)?(await pn(r,s),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},En=async(e,t)=>{let n=P(t,e);return await re(n,{force:!0}),{success:!0}},Ce=20,Oe=async(e,t,n)=>{let r=[];for(let s=0;s<e.length;s+=n){let i=e.slice(s,s+n),o=await Promise.all(i.map(t));r.push(...o)}return r},Sn=async(e,t,n,r,s)=>{let i={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>un(P(r,d))))];s.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>$e(d,{recursive:!0}))),s.message(`Updating ${e.length} files...`);let a=await Oe(e,async d=>{let c=await xn(d,n,r);return{file:d,...c}},Ce);for(let{file:d,success:c,error:u}of a)c?i.success.push(d):i.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){s.message(`Deleting ${t.length} files...`);let d=await Oe(t,async c=>{try{return await En(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Ce);for(let c of d)c.success?i.deleted.push(c.file):i.failed.push({file:c.file,error:c.error})}return i},bn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},_n=e=>e.includes("canary")?"canary":"latest",Tn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(b)}`);if(!t.ok)throw new Error(`Failed to resolve ${b}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${b}`);return r},In=async e=>{let t=await M(e),n=J(t,b);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=_n(n),s=await Tn(r);return n===s?{currentVersion:n,nextVersion:s,updateTag:r,updated:!1}:($(t,b,s),await O(e,t),{currentVersion:n,nextVersion:s,updateTag:r,updated:!0})},Pn=async(e,t,n)=>{let r=await M(e);if(!le(r,b))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:s,nextVersion:i,updateTag:o,updated:a}=await In(e);if(!a)return w.success(s?`@vercel/geistdocs is already at ${i} (${o}).`:"No package version update was needed."),V("Package-based site is already up to date."),!0;w.info(`Bumping ${b} from ${s} to ${i} (${o})`);let d=Ne();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),V("Please review and test the upgraded package version."),!0},vn=async(e,t,n,r,s)=>{let i=P(e,te),o=Ne(),a=s?.sync?i:t;o.start("Preparing template snapshot..."),s?.sync&&(await wn(e,te),await N(i)),o.message("Scanning for files...");let d=await ke(n,r,a),c=[];if(s?.sync){o.message("Comparing with local files...");let l=await ke(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),s?.sync&&await ne(i),V("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),s?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await Sn(d,c,a,e,o);s?.sync&&(o.message("Cleaning up..."),await ne(i)),o.stop("Update complete!"),bn(u),V("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),s=e&&e.length>0?e:fn,i=e&&e.length>0?[]:hn;try{if(gn("Let's update your Geistdocs project!"),await Pn(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await vn(n,r,s,i,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(P(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.3.2","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(fe);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(De);var An=A.command("search").description("Manage the external search index used by Ask AI");An.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
|
2
|
+
import{Option as Rn,program as A}from"commander";import{access as Ke,copyFile as Ye,readdir as Un,readFile as qe,writeFile as ze}from"fs/promises";import{join as ge}from"path";import{cancel as me,confirm as We,intro as Qe,isCancel as fe,log as X,outro as Ze,spinner as et,text as tt}from"@clack/prompts";import{spawn as Le}from"child_process";import{readFileSync as je}from"fs";import{cp as Be,readFile as Ve,rename as Je,writeFile as He}from"fs/promises";import{join as C}from"path";import{fileURLToPath as Xe}from"url";var S="@vercel/geistdocs",T=(e,t=[],n={})=>new Promise((r,i)=>{let s=Le(e,t,{stdio:"inherit",...n});s.on("error",i),s.on("close",o=>{if(o===0){r();return}i(new Error(`Command failed with exit code ${o}: ${[e,...t].join(" ")}`))})}),ce=["dependencies","devDependencies","optionalDependencies","peerDependencies"],de=()=>JSON.parse(je(new URL("../../package.json",import.meta.url),"utf8")).version,M=async e=>{let t=C(e,"package.json"),n=await Ve(t,"utf8");return JSON.parse(n)},O=async(e,t)=>{let n=C(e,"package.json");await He(n,`${JSON.stringify(t,null,2)}
|
|
3
|
+
`,"utf8")},J=(e,t)=>{for(let n of ce){let r=e[n];if(r&&t in r)return r[t]}},le=(e,t)=>!!J(e,t),$=(e,t,n)=>{let r=!1;for(let i of ce){let s=e[i];s&&t in s&&(s[t]=n,r=!0)}return r},H=()=>Xe(new URL("../../template",import.meta.url)),N=async e=>{await Be(H(),e,{recursive:!0});let t=C(e,".gitignore"),n=C(e,"_gitignore");try{await Je(n,t)}catch{}};var pe="@vercel/geistdocs",ue="@vercel/geistdocs-private";var nt=async(e,t)=>{if(await N(e),t==="vercel")return;let n=ge(e,"geistdocs.tsx"),s=(await qe(n,"utf8")).split('export const navbarBrand: GeistdocsNavbarBrand = "vercel";');if(s.length!==2)throw new Error("The bundled template must contain exactly one navbarBrand export.");await ze(n,s.join('export const navbarBrand: GeistdocsNavbarBrand = "labs";'),"utf8")},rt=async e=>{try{return await Ke(e),!0}catch{return!1}},st=async()=>{await rt(".env.example")&&await Ye(".env.example",".env.local")},it=async(e,t)=>{let n=await M(e),r=de();return $(n,t,r)?(await O(e,n),!0):!1};var ot=async e=>{await T("pnpm",["install"],{cwd:e,env:process.env,stdio:"inherit"})},at=async e=>{await T("git",["init"],{cwd:e,env:process.env,stdio:"inherit"}),await T("git",["add","."],{cwd:e,env:process.env,stdio:"inherit"}),await T("git",["commit","-m","\u2728 Initial commit"],{cwd:e,env:process.env,stdio:"inherit"})},ct=async()=>{let e=await tt({message:"What is your project named?",placeholder:"my-app",validate(t){if(t.length===0)return"Please enter a project name."}});return fe(e)&&(me("Operation cancelled."),process.exit(0)),e.toString()},dt=async()=>S,he=async e=>{try{let t=e.brand??"vercel";if(t!=="vercel"&&t!=="labs")throw new Error(`Invalid navbar brand "${t}". Choose vercel or labs.`);Qe("Let's start a Geistdocs project!");let n=process.cwd(),r=e.name||await ct(),i=await dt(),s=et(),o=ge(n,r);s.start("Copying bundled template..."),await nt(r,t),s.message("Setting up environment variables..."),process.chdir(o),await st(),s.message("Rewriting package dependency versions..."),await it(o,i),s.message("Installing dependencies..."),await ot(o),e.disableGit||(s.message("Initializing Git repository..."),await at(o)),s.stop("Project initialized successfully!"),Ze("Run `pnpm dev` to start the development server.")}catch(t){let n=t instanceof Error?t.message:`Failed to initialize project: ${t}`;X.error(n),process.exit(1)}};import{execFileSync as kt}from"child_process";import Ct from"@next/env";var lt="https://api.mixedbread.com/v1";var pt=/\/$/;var g={contentHash:"geistdocs_content_hash",description:"geistdocs_description",documentId:"geistdocs_document_id",locale:"geistdocs_locale",rawFileId:"geistdocs_raw_file_id",revision:"geistdocs_revision",revisionAncestors:"geistdocs_revision_ancestors",revisionTimestamp:"geistdocs_revision_timestamp",schemaVersion:"geistdocs_schema_version",siteId:"geistdocs_site_id",sourceId:"geistdocs_source_id",sourceUrl:"geistdocs_source_url",title:"geistdocs_title",url:"geistdocs_url"},Y=e=>typeof e=="object"&&e!==null,E=(e,t)=>{let n=e[t];return typeof n=="string"?n:void 0},ut=(e,t)=>{let n=e[t];return Array.isArray(n)?n.filter(r=>typeof r=="string"):[]},gt=(e,t)=>{let n=e[t];return typeof n=="number"&&Number.isFinite(n)?n:void 0},q=e=>{if(!Y(e))return null;let t=e[g.schemaVersion],n=E(e,g.contentHash),r=E(e,g.description)??"",i=E(e,g.documentId),s=E(e,g.locale),o=E(e,g.rawFileId),a=E(e,g.revision),d=ut(e,g.revisionAncestors),c=gt(e,g.revisionTimestamp),u=E(e,g.siteId),l=E(e,g.sourceId),m=E(e,g.sourceUrl),f=E(e,g.title),h=E(e,g.url);return t!==1||!n||!i||!s||!u||!l||!m||!f||!h?null:{contentHash:n,description:r,documentId:i,locale:s,rawFileId:o,revision:a,revisionAncestors:d,revisionTimestamp:c,schemaVersion:t,siteId:u,sourceId:l,sourceUrl:m,title:f,url:h}},K=e=>Y(e)&&typeof e.id=="string"&&typeof e.status=="string"&&["cancelled","completed","failed","in_progress","pending"].includes(e.status),mt=e=>new Promise(t=>{setTimeout(t,e)}),ft=(e,t)=>{let n=e.headers.get("retry-after");if(n){let r=Number(n);if(Number.isFinite(r)&&r>=0)return Math.min(r*1e3,3e4);let i=Date.parse(n);if(Number.isFinite(i))return Math.min(Math.max(0,i-Date.now()),3e4)}return 250*2**t},ht=e=>e===408||e===409||e===429||e>=500,G=e=>encodeURIComponent(e),R=class extends Error{status;constructor(t,n){super(t),this.name="MixedbreadRequestError",this.status=n}},we=({apiBaseUrl:e=lt,apiKey:t,fetchImpl:n=fetch,maxRetries:r=2,requestTimeoutMs:i=3e4,sleep:s=mt,storeId:o})=>{let a=e.replace(pt,""),d=G(o),c=async({body:u,headers:l,method:m,path:f,signal:h})=>{for(let x=0;;x+=1){let P=new AbortController,_=()=>P.abort(h?.reason);h?.aborted?_():h?.addEventListener("abort",_,{once:!0});let se=setTimeout(()=>{P.abort(new Error("Mixedbread request timed out"))},i);try{let b=await n(`${a}${f}`,{body:u?.(),headers:{Authorization:`Bearer ${t}`,...l},method:m,signal:P.signal});if(!b.ok){if(x<r&&ht(b.status)){await s(ft(b,x));continue}let D=(await b.text()).slice(0,500);throw new R(`Mixedbread request failed (${b.status} ${b.statusText})${D?`: ${D}`:""}`,b.status)}return b.status===204?void 0:await b.json()}finally{clearTimeout(se),h?.removeEventListener("abort",_)}}};return{async search({locale:u,query:l,signal:m,siteId:f,topK:h}){let x=await c({body:()=>JSON.stringify({filters:{all:[{key:g.siteId,operator:"eq",value:f},{key:g.locale,operator:"eq",value:u}]},query:l,search_options:{return_metadata:!0},store_identifiers:[o],top_k:h}),headers:{"Content-Type":"application/json"},method:"POST",path:"/stores/search",signal:m});if(!Array.isArray(x.data))throw new Error("Mixedbread search returned an invalid response");return x.data.filter(Y)},async listStoreFiles(u){let l=await c({body:()=>JSON.stringify({after:u,limit:100}),headers:{"Content-Type":"application/json"},method:"POST",path:`/stores/${d}/files/list`});if(!Array.isArray(l.data))throw new Error("Mixedbread file listing returned an invalid response");let m=l.data.filter(K),f=l.pagination?.has_more?l.pagination.last_cursor:void 0;if(l.pagination?.has_more&&!f)throw new Error("Mixedbread file listing omitted its next cursor");return{files:m,nextCursor:f??void 0}},async uploadFile({content:u,filename:l}){let m=await c({body:()=>{let f=new FormData;return f.append("file",new Blob([u],{type:"text/markdown"}),l),f},method:"POST",path:"/files"});if(typeof m.id!="string")throw new Error("Mixedbread file upload returned an invalid response");return m.id},async createStoreFile({externalId:u,fileId:l,metadata:m}){let f=await c({body:()=>JSON.stringify({config:{parsing_strategy:"fast"},external_id:u,file_id:l,metadata:m,overwrite:!0}),headers:{"Content-Type":"application/json"},method:"POST",path:`/stores/${d}/files`});if(!K(f))throw new Error("Mixedbread store file creation returned an invalid response");return f},async deleteFile(u){try{await c({method:"DELETE",path:`/files/${G(u)}`})}catch(l){if(!(l instanceof R&&l.status===404))throw l}},async retrieveStoreFile(u){let l=await c({method:"GET",path:`/stores/${d}/files/${G(u)}`});if(!K(l))throw new Error("Mixedbread store file retrieval returned an invalid response");return l},async deleteStoreFile(u){try{await c({method:"DELETE",path:`/stores/${d}/files/${G(u)}`})}catch(l){if(!(l instanceof R&&l.status===404))throw l}}}};import{createHash as yt}from"crypto";import{readFile as ye}from"fs/promises";import{join as xt,resolve as z,sep as bt}from"path";var xe="/api/search/export",Et="server/app/api/search/export.body",St=4,_t=1e3,Tt=18e4,Se=e=>typeof e=="object"&&e!==null,It=e=>Se(e)?["content","description","id","locale","sourceId","sourceUrl","title","url"].every(t=>typeof e[t]=="string"):!1,_e=e=>{if(!Se(e)||e.version!==1||e.provider!=="local"&&e.provider!=="mixedbread"||!Array.isArray(e.documents)||!e.documents.every(It)||e.siteId!==void 0&&typeof e.siteId!="string")throw new Error("The Geistdocs search export is invalid or unsupported.");let t=new Set;for(let n of e.documents){if(t.has(n.id))throw new Error(`The Geistdocs search export contains duplicate document ID "${n.id}".`);t.add(n.id)}return e},Te=async({cwd:e=process.cwd(),outputDirectory:t=".next"}={})=>{let n=z(e,t),r=xt(n,"prerender-manifest.json"),s=JSON.parse(await ye(r,"utf8")).routes?.[xe];if(s?.routeType!=="route"||s.compute!=="static"||s.response!=="complete")throw new Error(`${xe} was not statically generated by the latest Next.js build.`);let o=z(n,"server/app"),a=z(n,Et);if(!a.startsWith(`${o}${bt}`))throw new Error("The Geistdocs search export path escaped the Next.js output.");return _e(JSON.parse(await ye(a,"utf8")))},U=e=>yt("sha256").update(e).digest("hex"),vt=e=>U(JSON.stringify({content:e.content,description:e.description,locale:e.locale,sourceId:e.sourceId,sourceUrl:e.sourceUrl,title:e.title,url:e.url})),Pt=({document:e,hash:t,revision:n,revisionAncestors:r,revisionTimestamp:i,siteId:s})=>({[g.contentHash]:t,[g.description]:e.description,[g.documentId]:e.id,[g.locale]:e.locale,...n?{[g.revision]:n}:{},...r.length>0?{[g.revisionAncestors]:r}:{},...i===void 0?{}:{[g.revisionTimestamp]:i},[g.schemaVersion]:1,[g.siteId]:s,[g.sourceId]:e.sourceId,[g.sourceUrl]:e.sourceUrl,[g.title]:e.title,[g.url]:e.url}),At=(e,t,n,r,i)=>{let s=vt(e),o=U(t).slice(0,16),a=U(e.id).slice(0,32);return{document:e,externalId:`geistdocs/${o}/${a}/${s.slice(0,16)}`,hash:s,metadata:Pt({document:e,hash:s,revision:n,revisionAncestors:r,revisionTimestamp:i,siteId:t})}},W=(e,t,n)=>!!(t&&e.revisionAncestors.includes(t))||n!==void 0&&e.revisionTimestamp!==void 0&&e.revisionTimestamp>n,Mt=({currentRevision:e,currentRevisionAncestors:t,currentRevisionTimestamp:n,desired:r,metadata:i})=>r?.hash===i.contentHash?!0:e&&i.revision?i.revision===e||t.includes(i.revision)||n!==void 0&&i.revisionTimestamp!==void 0&&i.revisionTimestamp<n:!1,Rt=e=>new Promise(t=>{setTimeout(t,e)}),be=async e=>{let t=[],n=new Set,r;do{let i=await e.listStoreFiles(r);if(t.push(...i.files),r=i.nextCursor,r){if(n.has(r))throw new Error("Mixedbread file listing repeated a pagination cursor.");n.add(r)}}while(r);return t},Ee=async(e,t,n)=>{let r=[],i=[],s=0,o=async()=>{for(;s<e.length;){let a=s;s+=1;try{r[a]=await n(e[a])}catch(d){i.push(d)}}};if(await Promise.all(Array.from({length:Math.min(Math.max(1,t),e.length)},o)),i.length>0){let a=i.map(d=>d instanceof Error?d.message:String(d)).join(`
|
|
4
|
+
`);throw new AggregateError(i,`Mixedbread search sync did not complete:
|
|
5
|
+
${a}`)}return r},Ft=async({client:e,file:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=t,o=Date.now()+r;for(;s.status==="pending"||s.status==="in_progress";){if(Date.now()>=o)throw new Error(`Mixedbread timed out while indexing file ${t.id}.`);await i(n),s=await e.retrieveStoreFile(t.id)}if(s.status!=="completed")throw new Error(`Mixedbread failed to index file ${t.id} (${s.status}).`);return s},Dt=async({client:e,desired:t,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})=>{let s=await e.uploadFile({content:t.document.content,filename:`${U(t.document.id).slice(0,32)}.md`}),o;try{o=await e.createStoreFile({externalId:t.externalId,fileId:s,metadata:{...t.metadata,[g.rawFileId]:s}})}catch(a){try{await e.deleteFile(s)}catch(d){throw new AggregateError([a,d],`Mixedbread failed to attach and clean up raw file ${s}.`)}throw a}return Ft({client:e,file:o,pollIntervalMs:n,pollTimeoutMs:r,sleep:i})},Ie=async({client:e,concurrency:t=St,manifest:n,pollIntervalMs:r=_t,pollTimeoutMs:i=Tt,revision:s,revisionAncestors:o=[],revisionTimestamp:a,sleep:d=Rt})=>{let c=_e(n);if(c.provider!=="mixedbread")return{deleted:0,skipped:c.documents.length,uploaded:0};let u=c.siteId?.trim();if(!u)throw new Error("Mixedbread retrieval requires a non-empty siteId in geistdocs.tsx.");if(c.documents.length===0)throw new Error("The Geistdocs search export is empty. Refusing to remove indexed documents.");let l=c.documents.map(p=>At(p,u,s,o,a)),m=new Map(l.map(p=>[p.document.id,p])),h=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),x=new Map,P=new Set;for(let p of h){W(p.metadata,s,a)&&P.add(p.metadata.documentId);let y=m.get(p.metadata.documentId);y&&p.metadata.contentHash===y.hash&&p.file.status==="completed"&&!x.has(p.metadata.documentId)&&x.set(p.metadata.documentId,p)}let _=l.filter(p=>!(x.has(p.document.id)||P.has(p.document.id)));await Ee(_,t,p=>Dt({client:e,desired:p,pollIntervalMs:r,pollTimeoutMs:i,sleep:d}));let b=(await be(e)).flatMap(p=>{let y=q(p.metadata);return y?.siteId===u?[{file:p,metadata:y}]:[]}),D=new Set(b.filter(({metadata:p})=>W(p,s,a)).map(({metadata:p})=>p.documentId)),ie=new Set;for(let p of l){if(D.has(p.document.id))continue;let ae=b.filter(({file:V,metadata:k})=>V.status==="completed"&&k.documentId===p.document.id&&k.contentHash===p.hash).sort((V,k)=>V.file.id.localeCompare(k.file.id))[0];ae&&ie.add(ae.file.id)}let oe=b.filter(({file:p,metadata:y})=>p.status!=="pending"&&p.status!=="in_progress"&&!W(y,s,a)&&Mt({currentRevision:s,currentRevisionAncestors:o,currentRevisionTimestamp:a,desired:m.get(y.documentId),metadata:y})&&!ie.has(p.id));return await Ee(oe,t,async({file:p,metadata:y})=>{await e.deleteFile(y.rawFileId??p.id),await e.deleteStoreFile(p.id)}),{deleted:oe.length,skipped:l.length-_.length,uploaded:_.length}};var Ot=50,$t=e=>`vercel integration add mixedbread --name docs-${e||"your-site-id"} --environment production`,ve=(e,t)=>kt("git",t,{cwd:e,encoding:"utf8",stdio:["ignore","pipe","ignore"]}).trim(),Nt=e=>{let t=process.env.VERCEL_GIT_COMMIT_SHA?.trim(),n=[];try{n=ve(e,["rev-list",`--max-count=${Ot+1}`,t||"HEAD"]).split(`
|
|
6
|
+
`).filter(Boolean)}catch{n=[]}let r=t||n[0],i;for(let s of Array.from(new Set([r,"HEAD"].filter(Boolean))))try{let o=Number(ve(e,["show","-s","--format=%ct",s]));if(Number.isFinite(o)){i=o;break}}catch{}return{revision:r,revisionAncestors:n.filter(s=>s!==r),revisionTimestamp:i}},Pe=async({allowNonProduction:e=!1,dir:t=".next"}={})=>{let n=process.cwd();Ct.loadEnvConfig(n,!1);let r=process.env.MXBAI_API_KEY?.trim(),i=process.env.MXBAI_STORE_ID?.trim();if(process.env.VERCEL_ENV!=="production"&&!e){console.log("Geistdocs search sync skipped: this is not a production Vercel build.");return}if(!!r!=!!i)throw new Error("Mixedbread is partially configured. Set both MXBAI_API_KEY and MXBAI_STORE_ID.");let s;try{s=await Te({cwd:n,outputDirectory:t})}catch(a){if(!(r||i)){console.log("Geistdocs search sync skipped: no Mixedbread credentials or static search export were found.");return}throw a}if(s.provider!=="mixedbread"){console.log("Geistdocs search sync skipped: Ask AI uses local retrieval.");return}if(!(r&&i))throw new Error(["Mixedbread retrieval is enabled, but MXBAI_API_KEY or MXBAI_STORE_ID is missing.","From the root of this site's repository, linked to the correct Vercel project, run:",$t(s.siteId)].join(`
|
|
7
|
+
`));let o=await Ie({client:we({apiBaseUrl:process.env.MXBAI_BASE_URL,apiKey:r,storeId:i}),manifest:s,...Nt(n)});console.log(`Geistdocs search sync complete: ${o.uploaded} uploaded, ${o.deleted} deleted, ${o.skipped} unchanged.`)};import{readFileSync as Gt,writeFileSync as Ut}from"fs";import{mkdir as Lt,readFile as Z,writeFile as jt}from"fs/promises";import{dirname as Bt,extname as Vt,relative as Fe,resolve as j}from"path";import{intro as Jt,isCancel as Ht,log as I,multiselect as Xt,outro as L,spinner as Kt}from"@clack/prompts";import{glob as Yt}from"glob";import{Node as F,Project as qt,SyntaxKind as zt}from"ts-morph";var Wt="geistdocs.tsx",Qt="content/docs/**/*.mdx",ee=".translation-cache.json",Q=8,Ae=()=>({version:1,entries:{}}),Zt=async e=>{let t=await Z(e),{createHash:n}=await import("crypto");return n("sha256").update(t).digest("hex")},en=e=>{let t=j(process.cwd(),e);return Gt(t,"utf8")},Me=e=>F.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(F.isPropertyAssignment(t)){let n=t.getNameNode();if(F.isIdentifier(n)||F.isStringLiteral(n))return[n.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],tn=e=>{try{let t=new qt({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),n=en(e),s=t.createSourceFile(e,n,{overwrite:!0}).getVariableDeclarations().find(a=>a.getName()==="translations")?.getInitializer();if(!s)return[];if(F.isObjectLiteralExpression(s))return Me(s);let o=s.getFirstDescendantByKind(zt.ObjectLiteralExpression);return o?Me(o):[]}catch(t){let n=t instanceof Error?t.message:`${t}`;return I.warn(`Failed to read locales from ${e}: ${n}`),[]}},nn=async()=>{let e=await Xt({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ht(e)&&(L("Translation cancelled"),process.exit(0)),e},rn=async e=>(await Yt(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),sn=async()=>{let e=j(process.cwd(),ee);try{let t=await Z(e,"utf8"),n=JSON.parse(t);return n.version!==1||!n.entries?Ae():{version:1,entries:n.entries}}catch{return Ae()}},Re=e=>{let t=j(process.cwd(),ee),n=JSON.stringify(e,null,2);Ut(t,n,"utf8")},on=async e=>{let t=await Promise.all(e.map(async n=>[n,await Zt(n)]));return Object.fromEntries(t)},an=(e,t)=>{let n=Vt(e);return`${e.slice(0,-n.length)}.${t}${n}`},De=(e,t)=>`${Fe(process.cwd(),e)}::${t}`,cn=(e,t,n,r,i=!1)=>{let s=[],o=0;for(let a of t){let d=n[a];for(let c of e){let u=an(a,c),l=De(a,c),m=r.entries[l];if(!i&&m?.hash===d){o+=1;continue}s.push({locale:c,sourceFile:a,sourceHash:d,targetFile:u})}}return{tasks:s,skippedCount:o}},dn=async e=>{await Lt(Bt(e),{recursive:!0})},ln=async(e,t,n)=>{let r=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:n})});if(!r.ok){let s=await r.text();throw new Error(`API request failed (${r.status}): ${s}`)}let i=await r.json();if(!i.translation)throw new Error("API response did not include a translation");return i.translation},pn=async(e,t,n)=>{let r=await Z(e.sourceFile,"utf8"),i=await ln(t,r,e.locale);await dn(e.targetFile),await jt(e.targetFile,i,"utf8"),n.entries[De(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},ke=async(e,t)=>{Jt("Translate MDX content");let n=e??Qt,r=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",i=tn(t.config??Wt),s=await rn(n);s.length===0&&(I.error(`No MDX files found matching pattern: ${n}`),L("Translation cancelled"),process.exit(1)),I.info(`Found ${s.length} MDX file(s) matching pattern`),i.length===0&&(i=await nn());let o=j(process.cwd(),ee),a=await sn();await Re(a),I.info(`Using cache: ${o}`);let d=await on(s),{tasks:c,skippedCount:u}=cn(i,s,d,a,t.force);if(c.length===0){I.success("All translations are up to date!"),L(`Skipped ${u} file(s) (unchanged)`);return}let l=[];for(let h=0;h<c.length;h+=Q)l.push(c.slice(h,h+Q));I.info(`Processing ${c.length} translation(s) in ${l.length} batch(es) of up to ${Q}`),u>0&&I.info(`Skipped ${u} translation(s) (unchanged)`);let m=Kt();m.start("Translating content...");let f=0;for(let h of l)await Promise.all(h.map(async x=>{await pn(x,r,a),f+=1,m.message(`Translated ${f}/${c.length}: ${Fe(process.cwd(),x.targetFile)}`)})),await Re(a);m.stop("Translation complete!"),L(`Created/updated ${c.length} file(s)`)};import{access as un,copyFile as gn,mkdir as Ne,rm as re}from"fs/promises";import{dirname as mn,join as v}from"path";import{intro as fn,log as w,outro as B,spinner as Ge}from"@clack/prompts";import{glob as hn}from"glob";var wn=["**/*"],yn=["content/docs/**"],te=".geistdocs-tmp",xn=async(e,t)=>{let n=v(e,t);await re(n,{recursive:!0,force:!0}),await Ne(n,{recursive:!0})},ne=async e=>await re(e,{recursive:!0,force:!0}),Ce=async(e,t,n)=>(await hn(e,{cwd:n,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),bn=async e=>{try{return await un(e),!0}catch{return!1}},En=async(e,t,n)=>{let r=v(t,e),i=v(n,e);return await bn(r)?(await gn(r,i),{success:!0}):{success:!1,error:`Source file not found: ${r}`}},Sn=async(e,t)=>{let n=v(t,e);return await re(n,{force:!0}),{success:!0}},Oe=20,$e=async(e,t,n)=>{let r=[];for(let i=0;i<e.length;i+=n){let s=e.slice(i,i+n),o=await Promise.all(s.map(t));r.push(...o)}return r},_n=async(e,t,n,r,i)=>{let s={success:[],deleted:[],failed:[]},o=[...new Set(e.map(d=>mn(v(r,d))))];i.message(`Creating ${o.length} directories...`),await Promise.all(o.map(d=>Ne(d,{recursive:!0}))),i.message(`Updating ${e.length} files...`);let a=await $e(e,async d=>{let c=await En(d,n,r);return{file:d,...c}},Oe);for(let{file:d,success:c,error:u}of a)c?s.success.push(d):s.failed.push({file:d,error:u??"Unknown error"});if(t.length>0){i.message(`Deleting ${t.length} files...`);let d=await $e(t,async c=>{try{return await Sn(c,r),{file:c,success:!0}}catch(u){let l=u instanceof Error?u.message:`${u}`;return{file:c,success:!1,error:l}}},Oe);for(let c of d)c.success?s.deleted.push(c.file):s.failed.push({file:c.file,error:c.error})}return s},Tn=e=>{if(e.success.length>0){w.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)w.info(` \u2713 ${t}`)}if(e.deleted.length>0){w.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)w.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){w.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:n}of e.failed)w.error(` \u2717 ${t}: ${n}`)}},In=e=>e.includes("canary")?"canary":"latest",vn=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(S)}`);if(!t.ok)throw new Error(`Failed to resolve ${S}@${e}`);let r=(await t.json())["dist-tags"]?.[e];if(!r)throw new Error(`Could not find dist-tag ${e} for ${S}`);return r},Pn=async e=>{let t=await M(e),n=J(t,S);if(!n)return{currentVersion:n,nextVersion:void 0,updated:!1};let r=In(n),i=await vn(r);return n===i?{currentVersion:n,nextVersion:i,updateTag:r,updated:!1}:($(t,S,i),await O(e,t),{currentVersion:n,nextVersion:i,updateTag:r,updated:!0})},An=async(e,t,n)=>{let r=await M(e);if(!le(r,S))return!1;t&&t.length>0&&w.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),n?.sync&&w.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:i,nextVersion:s,updateTag:o,updated:a}=await Pn(e);if(!a)return w.success(i?`@vercel/geistdocs is already at ${s} (${o}).`:"No package version update was needed."),B("Package-based site is already up to date."),!0;w.info(`Bumping ${S} from ${i} to ${s} (${o})`);let d=Ge();return d.start("Installing updated package version..."),await T("pnpm",["install"],{cwd:e}),d.stop("Package update complete!"),B("Please review and test the upgraded package version."),!0},Mn=async(e,t,n,r,i)=>{let s=v(e,te),o=Ge(),a=i?.sync?s:t;o.start("Preparing template snapshot..."),i?.sync&&(await xn(e,te),await N(s)),o.message("Scanning for files...");let d=await Ce(n,r,a),c=[];if(i?.sync){o.message("Comparing with local files...");let l=await Ce(n,r,e),m=new Set(d);c=l.filter(f=>!m.has(f))}if(o.stop(`Found ${d.length} files to update`),d.length===0&&c.length===0){w.warn("No files matched the patterns. Nothing to update."),i?.sync&&await ne(s),B("Update cancelled.");return}w.info(`Patterns: ${n.length}`),w.info(`Files to update: ${d.length}`),i?.sync&&w.info(`Files to delete: ${c.length}`),o.start("Updating files...");let u=await _n(d,c,a,e,o);i?.sync&&(o.message("Cleaning up..."),await ne(s)),o.stop("Update complete!"),Tn(u),B("Please review and test the changes carefully.")},Ue=async(e,t)=>{let n=process.cwd(),r=H(),i=e&&e.length>0?e:wn,s=e&&e.length>0?[]:yn;try{if(fn("Let's update your Geistdocs project!"),await An(n,e,t))return;w.info("Template source: bundled package snapshot"),e&&e.length>0&&w.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&w.info("Sync mode enabled: will delete files removed from template"),await Mn(n,r,i,s,t)}catch(o){let a=o instanceof Error?o.message:`${o}`;try{await ne(v(n,te))}catch{}w.error(`Failed to update project: ${a}`),process.exit(1)}};A.name("geistdocs").description("CLI for Geistdocs projects").version("2.4.0","-v, --version","Output the current version");A.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").addOption(new Rn("--brand <brand>","Navbar brand").choices(["vercel","labs"]).default("vercel")).option("--disable-git","Disable git initialization").action(he);A.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(Ue);A.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(ke);var Fn=A.command("search").description("Manage the external search index used by Ask AI");Fn.command("sync").description("Sync the latest static docs export to Mixedbread").option("--dir <path>","Next.js output directory",".next").option("--allow-non-production","Run outside a production Vercel build").action(Pe);await A.parseAsync(process.argv).catch(e=>{console.error(e instanceof Error?e.message:e),process.exitCode=1});
|
package/dist/config.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ export interface GeistdocsVersionsConfig {
|
|
|
153
153
|
current: string;
|
|
154
154
|
items: GeistdocsVersionConfig[];
|
|
155
155
|
}
|
|
156
|
+
export type GeistdocsNavbarBrand = "vercel" | "labs";
|
|
156
157
|
export interface GeistdocsConfig {
|
|
157
158
|
agent?: GeistdocsAgentReadinessConfig;
|
|
158
159
|
ai?: GeistdocsAIConfig;
|
|
@@ -174,6 +175,7 @@ export interface GeistdocsConfig {
|
|
|
174
175
|
nav?: GeistdocsNavItem[];
|
|
175
176
|
/** The product this docs site is for. */
|
|
176
177
|
navbarActiveProduct?: string;
|
|
178
|
+
navbarBrand?: GeistdocsNavbarBrand;
|
|
177
179
|
/**
|
|
178
180
|
* GitHub icon link in the navbar's action cluster. Rendered when
|
|
179
181
|
* `github` is configured; set `{ enabled: false }` to hide it.
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,eAAO,MAAM,iBAAiB,GAAI,UAAU,MAAM,GAAG,SAAS,WAO7D,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAoBvE,CAAC;AAEF,4EAA4E;AAC5E,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,UAAU,MAAM,GAAG,SAAS,WAWtE,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AAED,uCAAuC;AACvC,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,OAAO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AC;IACvB,KAAK,CAAC,EAAE,sBAAsB,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,EAAE,uBAAuB,CAAC;IACnC,MAAM,CAAC,EAAE,sBAAsB,CAAC;CACjC;AAED,eAAO,MAAM,YAAY,GAAI,CAAC,SAAS,eAAe,EAAE,QAAQ,CAAC,KAAG,CAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AA+SA,yEAAyE;AACzE,eAAO,MAAM,aAAa,GAAU,QAAQ,MAAM,oBACF,CAAC"}
|
|
@@ -12,17 +12,13 @@ const getAttribute = (node, name) => {
|
|
|
12
12
|
if (typeof attribute.value === "string") {
|
|
13
13
|
return attribute.value;
|
|
14
14
|
}
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
15
|
+
const statement = attribute.value?.data?.estree?.body[0];
|
|
16
|
+
const expression = statement?.type === "ExpressionStatement"
|
|
17
|
+
? statement.expression
|
|
18
|
+
: undefined;
|
|
19
|
+
return expression?.type === "Literal" && typeof expression.value === "string"
|
|
20
|
+
? expression.value
|
|
21
|
+
: undefined;
|
|
26
22
|
};
|
|
27
23
|
const paragraph = (value) => ({
|
|
28
24
|
children: [{ type: "text", value }],
|
|
@@ -74,6 +70,29 @@ const calloutNode = (node) => {
|
|
|
74
70
|
type: "blockquote",
|
|
75
71
|
};
|
|
76
72
|
};
|
|
73
|
+
const buttonNodes = (node) => {
|
|
74
|
+
const href = getAttribute(node, "href");
|
|
75
|
+
if (!href ||
|
|
76
|
+
node.attributes?.some((attribute) => attribute.type === "mdxJsxExpressionAttribute")) {
|
|
77
|
+
return node.children ?? [];
|
|
78
|
+
}
|
|
79
|
+
const children = (node.children ?? []).flatMap((child, index) => {
|
|
80
|
+
if (child.type !== "paragraph") {
|
|
81
|
+
return [child];
|
|
82
|
+
}
|
|
83
|
+
return [
|
|
84
|
+
...(index > 0 ? [{ type: "text", value: " " }] : []),
|
|
85
|
+
...(child.children ?? []),
|
|
86
|
+
];
|
|
87
|
+
});
|
|
88
|
+
if (children.length === 0) {
|
|
89
|
+
return [];
|
|
90
|
+
}
|
|
91
|
+
const link = { children, type: "link", url: href };
|
|
92
|
+
return node.type === "mdxJsxFlowElement"
|
|
93
|
+
? [{ children: [link], type: "paragraph" }]
|
|
94
|
+
: [link];
|
|
95
|
+
};
|
|
77
96
|
const replaceComponent = (node) => {
|
|
78
97
|
if (OMITTED_COMPONENTS.has(node.name ?? "")) {
|
|
79
98
|
return [];
|
|
@@ -87,6 +106,9 @@ const replaceComponent = (node) => {
|
|
|
87
106
|
if (node.name === "Callout") {
|
|
88
107
|
return [calloutNode(node)];
|
|
89
108
|
}
|
|
109
|
+
if (node.name === "Button") {
|
|
110
|
+
return buttonNodes(node);
|
|
111
|
+
}
|
|
90
112
|
const text = getAttribute(node, "text");
|
|
91
113
|
if ((node.name === "CopyPrompt" || node.name === "Prompt") && text) {
|
|
92
114
|
return [paragraph(text)];
|
|
@@ -97,6 +119,50 @@ const replaceComponent = (node) => {
|
|
|
97
119
|
return node.children ?? [];
|
|
98
120
|
};
|
|
99
121
|
const isJsxElement = (node) => node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement";
|
|
122
|
+
const getAttributeExpression = (node, name) => {
|
|
123
|
+
const value = node.attributes?.find((entry) => entry.type === "mdxJsxAttribute" && entry.name === name)?.value;
|
|
124
|
+
if (!value || typeof value === "string") {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
const statement = value.data?.estree?.body[0];
|
|
128
|
+
return statement?.type === "ExpressionStatement"
|
|
129
|
+
? statement.expression
|
|
130
|
+
: undefined;
|
|
131
|
+
};
|
|
132
|
+
const tabsNodes = (node) => {
|
|
133
|
+
const expression = getAttributeExpression(node, "tabs");
|
|
134
|
+
// Read literals without evaluating MDX. A spread makes label positions unknown.
|
|
135
|
+
const labels = expression?.type === "ArrayExpression" &&
|
|
136
|
+
!expression.elements.some((element) => element?.type === "SpreadElement")
|
|
137
|
+
? expression.elements.map((element) => element?.type === "Literal" && typeof element.value === "string"
|
|
138
|
+
? element.value
|
|
139
|
+
: undefined)
|
|
140
|
+
: [];
|
|
141
|
+
return (node.children ?? []).flatMap((child) => {
|
|
142
|
+
if (!isJsxElement(child) || child.name !== "TabContent") {
|
|
143
|
+
return cleanNode(child);
|
|
144
|
+
}
|
|
145
|
+
const orderExpression = getAttributeExpression(child, "order");
|
|
146
|
+
const order = orderExpression?.type === "Literal"
|
|
147
|
+
? orderExpression.value
|
|
148
|
+
: Number(getAttribute(child, "order"));
|
|
149
|
+
const label = typeof order === "number" && Number.isInteger(order)
|
|
150
|
+
? labels[order - 1]
|
|
151
|
+
: undefined;
|
|
152
|
+
const content = (child.children ?? []).flatMap(cleanNode);
|
|
153
|
+
if (!label) {
|
|
154
|
+
return content;
|
|
155
|
+
}
|
|
156
|
+
return [
|
|
157
|
+
{
|
|
158
|
+
children: [{ type: "text", value: label }],
|
|
159
|
+
depth: 4,
|
|
160
|
+
type: "heading",
|
|
161
|
+
},
|
|
162
|
+
...content,
|
|
163
|
+
];
|
|
164
|
+
});
|
|
165
|
+
};
|
|
100
166
|
// Steps exist in two shapes: the `Steps`/`Step` components authored in MDX and
|
|
101
167
|
// the `div.fd-steps`/`div.fd-step` output that remarkSteps emits for numbered
|
|
102
168
|
// headings. Both flatten to their content with the step number restored on
|
|
@@ -132,6 +198,9 @@ const cleanNode = (node) => {
|
|
|
132
198
|
if (isStepsNode(node)) {
|
|
133
199
|
return stepsNodes(node);
|
|
134
200
|
}
|
|
201
|
+
if (isJsxElement(node) && node.name === "TabsWithChildren") {
|
|
202
|
+
return tabsNodes(node);
|
|
203
|
+
}
|
|
135
204
|
if (node.children) {
|
|
136
205
|
node.children = node.children.flatMap(cleanNode);
|
|
137
206
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logo-vercel-labs.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/logo-vercel-labs.tsx"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,+CAqE1B,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
export const LogoVercelLabs = () => (_jsxs(_Fragment, { children: [_jsxs("svg", { "aria-hidden": "true", className: "block dark:hidden", fill: "none", focusable: "false", height: 18, viewBox: "0 0 183 42", width: (183 * 18) / 42, xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { clipRule: "evenodd", d: "M23.5092 0L47.0185 41.44H0L23.5092 0Z", fill: "black", fillRule: "evenodd" }), _jsx("path", { d: "M169.729 41.2752C166.731 41.2752 164.206 40.8386 162.156 39.9656C160.145 39.0925 158.588 37.8778 157.487 36.3214C156.387 34.7651 155.76 32.9999 155.608 31.026L163.068 30.6844C163.333 32.2787 163.998 33.5124 165.06 34.3855C166.123 35.2585 167.699 35.6951 169.786 35.6951C171.495 35.6951 172.823 35.4294 173.772 34.8979C174.759 34.3285 175.253 33.4554 175.253 32.2787C175.253 31.5954 175.082 31.026 174.74 30.5705C174.399 30.115 173.753 29.7164 172.804 29.3748C171.855 29.0331 170.451 28.6915 168.591 28.3498C165.478 27.8184 163.03 27.1731 161.245 26.4139C159.461 25.6167 158.19 24.6298 157.43 23.453C156.709 22.2763 156.349 20.8148 156.349 19.0687C156.349 16.2217 157.43 13.9251 159.594 12.1789C161.796 10.3948 165.003 9.50278 169.217 9.50278C171.95 9.50278 174.247 9.95829 176.107 10.8693C177.967 11.7424 179.409 12.9571 180.434 14.5135C181.497 16.0319 182.161 17.778 182.427 19.7519L175.082 20.0936C174.892 19.0687 174.55 18.1766 174.057 17.4174C173.563 16.6582 172.899 16.0888 172.064 15.7092C171.229 15.2917 170.242 15.0829 169.103 15.0829C167.395 15.0829 166.104 15.4245 165.231 16.1078C164.358 16.7911 163.922 17.7021 163.922 18.8409C163.922 19.6381 164.111 20.3024 164.491 20.8338C164.909 21.3652 165.573 21.8018 166.484 22.1434C167.395 22.4471 168.61 22.7318 170.128 22.9975C173.317 23.491 175.822 24.1363 177.644 24.9335C179.504 25.6927 180.814 26.6796 181.573 27.8943C182.37 29.0711 182.769 30.4946 182.769 32.1648C182.769 34.1008 182.218 35.752 181.117 37.1186C180.055 38.4851 178.536 39.529 176.562 40.2503C174.626 40.9335 172.349 41.2752 169.729 41.2752Z", fill: "black" }), _jsx("path", { d: "M141.184 41.2752C139.058 41.2752 137.198 40.8197 135.603 39.9086C134.047 38.9976 132.832 37.7259 131.959 36.0937L131.788 40.5919H124.842V0.164658L132.13 0.164658V14.5135C132.965 13.109 134.161 11.9322 135.717 10.9832C137.274 9.99626 139.096 9.50278 141.184 9.50278C143.803 9.50278 146.061 10.1671 147.959 11.4957C149.895 12.7863 151.376 14.6274 152.401 17.0188C153.464 19.3723 153.995 22.1624 153.995 25.389C153.995 28.6156 153.464 31.4246 152.401 33.8161C151.376 36.1696 149.895 38.0106 147.959 39.3392C146.061 40.6299 143.803 41.2752 141.184 41.2752ZM139.532 35.3534C141.62 35.3534 143.29 34.4804 144.543 32.7342C145.796 30.9501 146.422 28.5017 146.422 25.389C146.422 22.2383 145.796 19.7899 144.543 18.0438C143.328 16.2976 141.677 15.4245 139.589 15.4245C138.033 15.4245 136.685 15.8231 135.546 16.6203C134.446 17.3795 133.592 18.4993 132.984 19.9797C132.415 21.4601 132.13 23.2632 132.13 25.389C132.13 27.4388 132.415 29.2229 132.984 30.7413C133.592 32.2218 134.446 33.3606 135.546 34.1577C136.647 34.9549 137.976 35.3534 139.532 35.3534Z", fill: "black" }), _jsx("path", { d: "M103.361 41.2752C100.172 41.2752 97.6099 40.5539 95.6739 39.1115C93.738 37.631 92.77 35.5812 92.77 32.962C92.77 30.3427 93.5862 28.2929 95.2184 26.8125C96.8507 25.332 99.3371 24.2692 102.678 23.6238L112.756 21.631C112.756 19.4672 112.262 17.8539 111.275 16.7911C110.288 15.6902 108.827 15.1398 106.891 15.1398C105.145 15.1398 103.759 15.5574 102.734 16.3925C101.748 17.1896 101.064 18.3474 100.685 19.8658L93.2825 19.5242C93.8898 16.2976 95.3703 13.8302 97.7238 12.122C100.077 10.3759 103.133 9.50278 106.891 9.50278C111.219 9.50278 114.483 10.6036 116.685 12.8053C118.924 14.969 120.044 18.0817 120.044 22.1434V33.1897C120.044 33.9869 120.177 34.5373 120.443 34.841C120.746 35.1447 121.183 35.2965 121.752 35.2965H122.72V40.5919C122.493 40.6678 122.113 40.7248 121.582 40.7627C121.088 40.8007 120.576 40.8197 120.044 40.8197C118.792 40.8197 117.672 40.6299 116.685 40.2503C115.698 39.8327 114.939 39.1304 114.407 38.1435C113.876 37.1186 113.61 35.733 113.61 33.9869L114.236 34.4424C113.933 35.771 113.268 36.9667 112.243 38.0296C111.256 39.0545 110.004 39.8517 108.485 40.4211C106.967 40.9905 105.259 41.2752 103.361 41.2752ZM104.841 35.9798C106.474 35.9798 107.878 35.6571 109.055 35.0118C110.232 34.3665 111.143 33.4744 111.788 32.3356C112.433 31.1968 112.756 29.8493 112.756 28.2929V26.5847L104.898 28.179C103.266 28.5207 102.089 29.0331 101.368 29.7164C100.685 30.3617 100.343 31.2158 100.343 32.2787C100.343 33.4554 100.723 34.3665 101.482 35.0118C102.279 35.6571 103.399 35.9798 104.841 35.9798Z", fill: "black" }), _jsx("path", { d: "M64.0186 40.5919V0.164627L71.4207 0.164627V38.3143L67.378 34.1577H90.6094V40.5919H64.0186Z", fill: "black" })] }), _jsxs("svg", { "aria-hidden": "true", className: "hidden dark:block", fill: "none", focusable: "false", height: 18, viewBox: "0 0 183 42", width: (183 * 18) / 42, xmlns: "http://www.w3.org/2000/svg", children: [_jsx("path", { clipRule: "evenodd", d: "M23.5092 0L47.0185 41.44H0L23.5092 0Z", fill: "white", fillRule: "evenodd" }), _jsx("path", { d: "M169.729 41.2752C166.731 41.2752 164.206 40.8386 162.156 39.9656C160.145 39.0925 158.588 37.8778 157.487 36.3214C156.387 34.7651 155.76 32.9999 155.608 31.026L163.068 30.6844C163.333 32.2787 163.998 33.5124 165.06 34.3855C166.123 35.2585 167.699 35.6951 169.786 35.6951C171.495 35.6951 172.823 35.4294 173.772 34.8979C174.759 34.3285 175.253 33.4554 175.253 32.2787C175.253 31.5954 175.082 31.026 174.74 30.5705C174.399 30.115 173.753 29.7164 172.804 29.3748C171.855 29.0331 170.451 28.6915 168.591 28.3498C165.478 27.8184 163.03 27.1731 161.245 26.4139C159.461 25.6167 158.19 24.6298 157.43 23.453C156.709 22.2763 156.349 20.8148 156.349 19.0687C156.349 16.2217 157.43 13.9251 159.594 12.1789C161.796 10.3948 165.003 9.50278 169.217 9.50278C171.95 9.50278 174.247 9.95829 176.107 10.8693C177.967 11.7424 179.409 12.9571 180.434 14.5135C181.497 16.0319 182.161 17.778 182.427 19.7519L175.082 20.0936C174.892 19.0687 174.55 18.1766 174.057 17.4174C173.563 16.6582 172.899 16.0888 172.064 15.7092C171.229 15.2917 170.242 15.0829 169.103 15.0829C167.395 15.0829 166.104 15.4245 165.231 16.1078C164.358 16.7911 163.922 17.7021 163.922 18.8409C163.922 19.6381 164.111 20.3024 164.491 20.8338C164.909 21.3652 165.573 21.8018 166.484 22.1434C167.395 22.4471 168.61 22.7318 170.128 22.9975C173.317 23.491 175.822 24.1363 177.644 24.9335C179.504 25.6927 180.814 26.6796 181.573 27.8943C182.37 29.0711 182.769 30.4946 182.769 32.1648C182.769 34.1008 182.218 35.752 181.117 37.1186C180.055 38.4851 178.536 39.529 176.562 40.2503C174.626 40.9335 172.349 41.2752 169.729 41.2752Z", fill: "white" }), _jsx("path", { d: "M141.184 41.2752C139.058 41.2752 137.198 40.8197 135.603 39.9086C134.047 38.9976 132.832 37.7259 131.959 36.0937L131.788 40.5919H124.842V0.164642L132.13 0.164642V14.5135C132.965 13.109 134.161 11.9322 135.717 10.9832C137.274 9.99625 139.096 9.50277 141.184 9.50277C143.803 9.50277 146.061 10.1671 147.959 11.4957C149.895 12.7863 151.376 14.6273 152.401 17.0188C153.464 19.3723 153.995 22.1624 153.995 25.389C153.995 28.6156 153.464 31.4246 152.401 33.8161C151.376 36.1696 149.895 38.0106 147.959 39.3392C146.061 40.6299 143.803 41.2752 141.184 41.2752ZM139.532 35.3534C141.62 35.3534 143.29 34.4804 144.543 32.7342C145.796 30.9501 146.422 28.5017 146.422 25.389C146.422 22.2383 145.796 19.7899 144.543 18.0437C143.328 16.2976 141.677 15.4245 139.589 15.4245C138.033 15.4245 136.685 15.8231 135.546 16.6202C134.446 17.3794 133.592 18.4993 132.984 19.9797C132.415 21.4601 132.13 23.2632 132.13 25.389C132.13 27.4388 132.415 29.2229 132.984 30.7413C133.592 32.2217 134.446 33.3605 135.546 34.1577C136.647 34.9549 137.976 35.3534 139.532 35.3534Z", fill: "white" }), _jsx("path", { d: "M103.361 41.2752C100.172 41.2752 97.6099 40.5539 95.6739 39.1115C93.738 37.631 92.77 35.5812 92.77 32.962C92.77 30.3427 93.5862 28.2929 95.2184 26.8125C96.8507 25.332 99.3371 24.2692 102.678 23.6238L112.756 21.631C112.756 19.4672 112.262 17.8539 111.275 16.7911C110.288 15.6902 108.827 15.1398 106.891 15.1398C105.145 15.1398 103.759 15.5574 102.734 16.3925C101.748 17.1896 101.064 18.3474 100.685 19.8658L93.2825 19.5242C93.8898 16.2976 95.3703 13.8302 97.7238 12.122C100.077 10.3759 103.133 9.50278 106.891 9.50278C111.219 9.50278 114.483 10.6036 116.685 12.8053C118.924 14.969 120.044 18.0817 120.044 22.1434V33.1897C120.044 33.9869 120.177 34.5373 120.443 34.841C120.746 35.1447 121.183 35.2965 121.752 35.2965H122.72V40.5919C122.493 40.6678 122.113 40.7248 121.582 40.7627C121.088 40.8007 120.576 40.8197 120.044 40.8197C118.792 40.8197 117.672 40.6299 116.685 40.2503C115.698 39.8327 114.939 39.1304 114.407 38.1435C113.876 37.1186 113.61 35.733 113.61 33.9869L114.236 34.4424C113.933 35.771 113.268 36.9667 112.243 38.0296C111.256 39.0545 110.004 39.8517 108.485 40.4211C106.967 40.9905 105.259 41.2752 103.361 41.2752ZM104.841 35.9798C106.474 35.9798 107.878 35.6571 109.055 35.0118C110.232 34.3665 111.143 33.4744 111.788 32.3356C112.433 31.1968 112.756 29.8493 112.756 28.2929V26.5847L104.898 28.179C103.266 28.5207 102.089 29.0331 101.368 29.7164C100.685 30.3617 100.343 31.2158 100.343 32.2787C100.343 33.4554 100.723 34.3665 101.482 35.0118C102.279 35.6571 103.399 35.9798 104.841 35.9798Z", fill: "white" }), _jsx("path", { d: "M64.0186 40.5919V0.164612L71.4207 0.164612V38.3143L67.378 34.1577H90.6094V40.5919H64.0186Z", fill: "white" })] })] }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { GeistdocsConfig, GeistdocsNavbarBrand } from "../../config";
|
|
2
|
+
interface NavbarBrandProps {
|
|
3
|
+
brand?: GeistdocsNavbarBrand;
|
|
4
|
+
variant?: GeistdocsConfig["navbarVariant"];
|
|
5
|
+
}
|
|
6
|
+
export declare const NavbarBrand: ({ brand, variant, }: NavbarBrandProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=navbar-brand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"navbar-brand.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-brand.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAG1E,UAAU,gBAAgB;IACxB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,OAAO,CAAC,EAAE,eAAe,CAAC,eAAe,CAAC,CAAC;CAC5C;AAED,eAAO,MAAM,WAAW,GAAI,qBAGzB,gBAAgB,4CAkClB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Link from "next/link";
|
|
3
|
+
import { LogoIconVercelSvg, LogoVercelOssSvg } from "#geistdocs-assets/logos";
|
|
4
|
+
import { LogoVercelLabs } from "./logo-vercel-labs";
|
|
5
|
+
export const NavbarBrand = ({ brand = "vercel", variant = "standard", }) => {
|
|
6
|
+
let label = "Vercel";
|
|
7
|
+
let href = "https://vercel.com/";
|
|
8
|
+
let logo = _jsx(LogoIconVercelSvg, { size: 18 });
|
|
9
|
+
if (brand === "labs") {
|
|
10
|
+
label = "Vercel Labs";
|
|
11
|
+
href = "https://vercel.com/labs";
|
|
12
|
+
logo = _jsx(LogoVercelLabs, {});
|
|
13
|
+
}
|
|
14
|
+
else if (variant === "oss") {
|
|
15
|
+
label = "Vercel Open Source";
|
|
16
|
+
href = "https://vercel.com/oss";
|
|
17
|
+
logo = (_jsxs(_Fragment, { children: [_jsx(LogoIconVercelSvg, { className: "@min-[640px]:hidden", size: 18 }), _jsx(LogoVercelOssSvg, { className: "@min-[640px]:block hidden shrink-0", height: 18 })] }));
|
|
18
|
+
}
|
|
19
|
+
return (_jsx(Link, { "aria-label": label, className: "-mx-2 flex items-center rounded-md p-2 text-gray-1000 outline-none focus-visible:ring-2 focus-visible:ring-blue-700 focus-visible:ring-inset", href: href, rel: "noopener", target: "_blank", children: logo }));
|
|
20
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
import type { GeistdocsNavbarOssProduct } from "../../config";
|
|
2
|
+
import type { GeistdocsNavbarBrand, GeistdocsNavbarOssProduct } from "../../config";
|
|
3
3
|
export declare const DEFAULT_OSS_SECTION = "Open Source";
|
|
4
4
|
export declare const DEFAULT_OSS_PRODUCTS: GeistdocsNavbarOssProduct[];
|
|
5
5
|
/**
|
|
@@ -24,6 +24,7 @@ export declare function PanelLink({ active, product, }: {
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function resolveOssProducts(products: GeistdocsNavbarOssProduct[] | undefined, activeProduct: string | undefined): GeistdocsNavbarOssProduct[];
|
|
26
26
|
type NavbarLogoProps = {
|
|
27
|
+
brand?: GeistdocsNavbarBrand;
|
|
27
28
|
className?: string;
|
|
28
29
|
href?: string;
|
|
29
30
|
} & ({
|
|
@@ -35,6 +36,6 @@ type NavbarLogoProps = {
|
|
|
35
36
|
variant?: "standard";
|
|
36
37
|
logo: ReactNode;
|
|
37
38
|
});
|
|
38
|
-
export declare function NavbarLogo({ className, href, ...props }: NavbarLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
39
|
+
export declare function NavbarLogo({ brand, className, href, ...props }: NavbarLogoProps): import("react/jsx-runtime").JSX.Element;
|
|
39
40
|
export {};
|
|
40
41
|
//# sourceMappingURL=navbar-logo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar-logo.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-logo.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"navbar-logo.d.ts","sourceRoot":"","sources":["../../../src/internal/navbar/navbar-logo.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EACV,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,cAAc,CAAC;AAWtB,eAAO,MAAM,mBAAmB,gBAAgB,CAAC;AAEjD,eAAO,MAAM,oBAAoB,EAAE,yBAAyB,EAuF3D,CAAC;AAsBF;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,gNAC4K,CAAC;AAEhN;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,MAAM,EACN,OAAO,GACR,EAAE;IACD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,IAAI,CAAC,yBAAyB,EAAE,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC;CACzE,2CA+BA;AAwCD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,yBAAyB,EAAE,GAAG,SAAS,EACjD,aAAa,EAAE,MAAM,GAAG,SAAS,GAChC,yBAAyB,EAAE,CAI7B;AAED,KAAK,eAAe,GAAG;IACrB,KAAK,CAAC,EAAE,oBAAoB,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,CACA;IACE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,KAAK,CAAC;IACf,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,CAAC,EAAE,yBAAyB,EAAE,CAAC;CAC3C,GACD;IACE,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,IAAI,EAAE,SAAS,CAAC;CACjB,CACJ,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,IAAU,EACV,GAAG,KAAK,EACT,EAAE,eAAe,2CAuKjB"}
|
|
@@ -5,10 +5,11 @@ import { usePathname, useRouter } from "next/navigation";
|
|
|
5
5
|
import { NavigationMenu as NavigationMenuPrimitive } from "radix-ui";
|
|
6
6
|
import { useEffect, useRef, useState } from "react";
|
|
7
7
|
import { IconSlashForward } from "#geistdocs-assets/icons";
|
|
8
|
-
import { LogoEve
|
|
8
|
+
import { LogoEve } from "#geistdocs-assets/logos";
|
|
9
9
|
import { cn } from "#geistdocs-ui/utils";
|
|
10
10
|
import { LocalizedLink, useLocalizedHref } from "../localized-link";
|
|
11
11
|
import { NavigationMenu, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, } from "../ui/navigation-menu";
|
|
12
|
+
import { NavbarBrand } from "./navbar-brand";
|
|
12
13
|
export const DEFAULT_OSS_SECTION = "Open Source";
|
|
13
14
|
export const DEFAULT_OSS_PRODUCTS = [
|
|
14
15
|
{
|
|
@@ -142,7 +143,7 @@ function OssFeaturedCard({ product }) {
|
|
|
142
143
|
export function resolveOssProducts(products, activeProduct) {
|
|
143
144
|
return (products ?? DEFAULT_OSS_PRODUCTS).filter((product) => product.id !== activeProduct && product.href !== activeProduct);
|
|
144
145
|
}
|
|
145
|
-
export function NavbarLogo({ className, href = "/", ...props }) {
|
|
146
|
+
export function NavbarLogo({ brand, className, href = "/", ...props }) {
|
|
146
147
|
const isOss = props.variant === "oss";
|
|
147
148
|
const ossProducts = isOss
|
|
148
149
|
? resolveOssProducts(props.ossProducts, props.activeProduct)
|
|
@@ -169,7 +170,7 @@ export function NavbarLogo({ className, href = "/", ...props }) {
|
|
|
169
170
|
previousPathnameRef.current = pathname;
|
|
170
171
|
}
|
|
171
172
|
}, [pathname]);
|
|
172
|
-
return (_jsxs("span", { className: cn("flex items-center gap-2.5", className), children: [_jsx(
|
|
173
|
+
return (_jsxs("span", { className: cn("flex items-center gap-2.5", className), children: [_jsx(NavbarBrand, { brand: brand, variant: props.variant }), _jsx("div", { className: "w-5 text-center text-gray-alpha-400 text-lg dark:text-gray-600", children: _jsx(IconSlashForward, { size: 20 }) }), isOss ? (_jsxs(_Fragment, { children: [_jsx(Link, { className: "flex @min-[1024px]:hidden items-center text-gray-1000", href: localizedHref, prefetch: true, children: props.logo }), _jsxs("div", { className: "@min-[1024px]:contents hidden", children: [_jsx(NavigationMenu, { "aria-label": "Product navigation", delayDuration: 0, onValueChange: (value) => {
|
|
173
174
|
if (value && suppressLogoHoverRef.current) {
|
|
174
175
|
return;
|
|
175
176
|
}
|
package/dist/navbar.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { GeistdocsConfig } from "./config";
|
|
2
2
|
interface NavbarProps {
|
|
3
|
-
config: Pick<GeistdocsConfig, "github" | "logo" | "logoHref" | "nav" | "navbarActiveProduct" | "navbarGithub" | "navbarOssProducts" | "navbarVariant">;
|
|
3
|
+
config: Pick<GeistdocsConfig, "github" | "logo" | "logoHref" | "nav" | "navbarActiveProduct" | "navbarBrand" | "navbarGithub" | "navbarOssProducts" | "navbarVariant">;
|
|
4
4
|
}
|
|
5
5
|
export declare const Navbar: ({ config }: NavbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
export {};
|
package/dist/navbar.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../src/navbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,UAAU,WAAW;IACnB,MAAM,EAAE,IAAI,CACV,eAAe,EACb,QAAQ,GACR,MAAM,GACN,UAAU,GACV,KAAK,GACL,qBAAqB,GACrB,cAAc,GACd,mBAAmB,GACnB,eAAe,CAClB,CAAC;CACH;AAKD,eAAO,MAAM,MAAM,GAAI,YAAY,WAAW,
|
|
1
|
+
{"version":3,"file":"navbar.d.ts","sourceRoot":"","sources":["../src/navbar.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAQhD,UAAU,WAAW;IACnB,MAAM,EAAE,IAAI,CACV,eAAe,EACb,QAAQ,GACR,MAAM,GACN,UAAU,GACV,KAAK,GACL,qBAAqB,GACrB,aAAa,GACb,cAAc,GACd,mBAAmB,GACnB,eAAe,CAClB,CAAC;CACH;AAKD,eAAO,MAAM,MAAM,GAAI,YAAY,WAAW,4CAsE7C,CAAC"}
|
package/dist/navbar.js
CHANGED
|
@@ -17,5 +17,5 @@ export const Navbar = ({ config }) => {
|
|
|
17
17
|
// resolved and filtered inside the client menus below. Pass the raw custom
|
|
18
18
|
// list (if any) and the active product down; each menu drops the active one.
|
|
19
19
|
const activeProduct = config.navbarActiveProduct;
|
|
20
|
-
return (_jsx(NavbarShell, { children: _jsxs("div", { className: "@container mx-auto flex w-full max-w-[1448px] justify-between px-2", children: [_jsxs("div", { className: "flex select-none flex-row items-center", children: [isOss ? (_jsx(NavbarLogo, { activeProduct: activeProduct, className: "ml-4", href: config.logoHref, logo: config.logo, ossProducts: config.navbarOssProducts, variant: "oss" })) : (_jsx(NavbarLogo, { className: "ml-4", href: config.logoHref, logo: config.logo, variant: "standard" })), _jsx(DesktopMenu, { className: "@min-[1024px]:flex hidden", items: nav })] }), _jsxs("div", { className: "mr-4 flex flex-row items-center justify-end gap-2", children: [_jsx(SearchButton, { className: "@min-[1024px]:flex hidden w-36" }), _jsx(AskAIButton, { className: "@min-[768px]:flex hidden shrink-0", size: "small", variant: "secondary" }), _jsx(AskAIButton, { className: "@min-[768px]:hidden", size: "small", variant: "secondary" }), showGithub ? (_jsx(GitHubButton, { className: "@min-[768px]:inline-flex hidden shrink-0", github: config.github })) : null, _jsx(MobileMenu, { activeProduct: activeProduct, githubUrl: githubUrl, nav: nav, ossProducts: config.navbarOssProducts, showOss: isOss })] })] }) }));
|
|
20
|
+
return (_jsx(NavbarShell, { children: _jsxs("div", { className: "@container mx-auto flex w-full max-w-[1448px] justify-between px-2", children: [_jsxs("div", { className: "flex select-none flex-row items-center", children: [isOss ? (_jsx(NavbarLogo, { activeProduct: activeProduct, brand: config.navbarBrand, className: "ml-4", href: config.logoHref, logo: config.logo, ossProducts: config.navbarOssProducts, variant: "oss" })) : (_jsx(NavbarLogo, { brand: config.navbarBrand, className: "ml-4", href: config.logoHref, logo: config.logo, variant: "standard" })), _jsx(DesktopMenu, { className: "@min-[1024px]:flex hidden", items: nav })] }), _jsxs("div", { className: "mr-4 flex flex-row items-center justify-end gap-2", children: [_jsx(SearchButton, { className: "@min-[1024px]:flex hidden w-36" }), _jsx(AskAIButton, { className: "@min-[768px]:flex hidden shrink-0", size: "small", variant: "secondary" }), _jsx(AskAIButton, { className: "@min-[768px]:hidden", size: "small", variant: "secondary" }), showGithub ? (_jsx(GitHubButton, { className: "@min-[768px]:inline-flex hidden shrink-0", github: config.github })) : null, _jsx(MobileMenu, { activeProduct: activeProduct, githubUrl: githubUrl, nav: nav, ossProducts: config.navbarOssProducts, showOss: isOss })] })] }) }));
|
|
21
21
|
};
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.4.0 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 2.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 2.4.0.
|
|
4
4
|
They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
|
|
5
5
|
|
|
6
6
|
## Documentation Index
|
|
@@ -186,6 +186,22 @@ pnpm dlx @vercel/geistdocs@latest init --name my-docs
|
|
|
186
186
|
|
|
187
187
|
The CLI copies the template bundled in the package, rewrites the generated app to depend on the same `@vercel/geistdocs` version, installs dependencies, copies `.env.example` to `.env.local`, and initializes Git.
|
|
188
188
|
|
|
189
|
+
### Create a Labs starter
|
|
190
|
+
|
|
191
|
+
To reuse the same template with [Vercel Labs](https://vercel.com/labs) navbar branding, run:
|
|
192
|
+
|
|
193
|
+
```bash title="Terminal"
|
|
194
|
+
pnpm dlx @vercel/geistdocs@latest init --name my-labs-docs --brand labs
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
`--brand` accepts `vercel` (default) or `labs`. Omitting it or passing `--brand vercel` preserves the starter defaults. Invalid values fail before prompts or writes. Add `--disable-git` to skip Git initialization, not dependency installation.
|
|
198
|
+
|
|
199
|
+
Labs changes only `navbarBrand` in `geistdocs.tsx`, independently of the `navbarVariant` layout, project `Logo`, and navigation.
|
|
200
|
+
|
|
201
|
+
`@vercel/geistdocs-private` accepts the same flag. Its public-repository prompt still selects the public or private package; either choice preserves the selected brand.
|
|
202
|
+
|
|
203
|
+
Read [Choose a navbar brand](/docs/configuration#choose-a-navbar-brand) to change the brand in an existing project.
|
|
204
|
+
|
|
189
205
|
## Understand generated dependencies
|
|
190
206
|
|
|
191
207
|
Generated projects pin the resolved package version and include AI SDK v6 and `@ai-sdk/react` v3. The public package does not require private npm access. The template already configures styles, fonts, Cache Components, Partial Prefetching, source adapters, search, Ask AI, and agent-readable routes.
|
|
@@ -1123,6 +1139,10 @@ Read [Configure sidebar navigation](/docs/guides/nested-navigation) for page ord
|
|
|
1123
1139
|
The root `geistdocs.tsx` file is the primary configuration surface:
|
|
1124
1140
|
|
|
1125
1141
|
```tsx title="geistdocs.tsx"
|
|
1142
|
+
import type { GeistdocsNavbarBrand } from "@vercel/geistdocs/config";
|
|
1143
|
+
|
|
1144
|
+
export const navbarBrand: GeistdocsNavbarBrand = "vercel";
|
|
1145
|
+
|
|
1126
1146
|
export const Logo = () => <span>My Docs</span>;
|
|
1127
1147
|
|
|
1128
1148
|
export const github = {
|
|
@@ -1162,6 +1182,22 @@ export const basePath: string | undefined = undefined;
|
|
|
1162
1182
|
export const siteId: string | undefined = undefined;
|
|
1163
1183
|
```
|
|
1164
1184
|
|
|
1185
|
+
### Choose a navbar brand
|
|
1186
|
+
|
|
1187
|
+
Set the optional `navbarBrand` export to `"vercel"` (default) or `"labs"`:
|
|
1188
|
+
|
|
1189
|
+
```tsx title="geistdocs.tsx"
|
|
1190
|
+
import type { GeistdocsNavbarBrand } from "@vercel/geistdocs/config";
|
|
1191
|
+
|
|
1192
|
+
export const navbarBrand: GeistdocsNavbarBrand = "labs";
|
|
1193
|
+
```
|
|
1194
|
+
|
|
1195
|
+
The generated `lib/geistdocs/config.tsx` forwards this export to `defineConfig`. Existing sites can forward it in their adapter or set `navbarBrand: "labs"` directly in `defineConfig`. Private projects use the type from `@vercel/geistdocs-private/config`.
|
|
1196
|
+
|
|
1197
|
+
Labs links to [vercel.com/labs](https://vercel.com/labs) and adapts to light and dark themes. Brand selection preserves your project's `Logo`, `logoHref`, and navigation. It is independent of `navbarVariant`, which selects the `"oss"` (default) or `"standard"` layout; either supports both brands.
|
|
1198
|
+
|
|
1199
|
+
For new projects, both CLIs accept `--brand labs`; omitting it or using `--brand vercel` preserves the defaults. See [Create a Labs starter](/docs/getting-started#create-a-labs-starter).
|
|
1200
|
+
|
|
1165
1201
|
### Group navbar links into a dropdown
|
|
1166
1202
|
|
|
1167
1203
|
A `nav` entry can group related links into a dropdown. Provide `items` instead of `href`. Each item needs a `label` and an `href`, and takes an optional `section`:
|
|
@@ -1195,6 +1231,7 @@ import {
|
|
|
1195
1231
|
github,
|
|
1196
1232
|
Logo,
|
|
1197
1233
|
nav,
|
|
1234
|
+
navbarBrand,
|
|
1198
1235
|
prompt,
|
|
1199
1236
|
siteId,
|
|
1200
1237
|
suggestions,
|
|
@@ -1209,6 +1246,7 @@ export const config = defineConfig({
|
|
|
1209
1246
|
logo: <Logo />,
|
|
1210
1247
|
github,
|
|
1211
1248
|
nav,
|
|
1249
|
+
navbarBrand,
|
|
1212
1250
|
basePath,
|
|
1213
1251
|
siteId,
|
|
1214
1252
|
translations,
|
package/docs/manifest.json
CHANGED
|
@@ -49,6 +49,10 @@ Read [Configure sidebar navigation](/docs/guides/nested-navigation) for page ord
|
|
|
49
49
|
The root `geistdocs.tsx` file is the primary configuration surface:
|
|
50
50
|
|
|
51
51
|
```tsx title="geistdocs.tsx"
|
|
52
|
+
import type { GeistdocsNavbarBrand } from "@vercel/geistdocs/config";
|
|
53
|
+
|
|
54
|
+
export const navbarBrand: GeistdocsNavbarBrand = "vercel";
|
|
55
|
+
|
|
52
56
|
export const Logo = () => <span>My Docs</span>;
|
|
53
57
|
|
|
54
58
|
export const github = {
|
|
@@ -88,6 +92,22 @@ export const basePath: string | undefined = undefined;
|
|
|
88
92
|
export const siteId: string | undefined = undefined;
|
|
89
93
|
```
|
|
90
94
|
|
|
95
|
+
### Choose a navbar brand
|
|
96
|
+
|
|
97
|
+
Set the optional `navbarBrand` export to `"vercel"` (default) or `"labs"`:
|
|
98
|
+
|
|
99
|
+
```tsx title="geistdocs.tsx"
|
|
100
|
+
import type { GeistdocsNavbarBrand } from "@vercel/geistdocs/config";
|
|
101
|
+
|
|
102
|
+
export const navbarBrand: GeistdocsNavbarBrand = "labs";
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The generated `lib/geistdocs/config.tsx` forwards this export to `defineConfig`. Existing sites can forward it in their adapter or set `navbarBrand: "labs"` directly in `defineConfig`. Private projects use the type from `@vercel/geistdocs-private/config`.
|
|
106
|
+
|
|
107
|
+
Labs links to [vercel.com/labs](https://vercel.com/labs) and adapts to light and dark themes. Brand selection preserves your project's `Logo`, `logoHref`, and navigation. It is independent of `navbarVariant`, which selects the `"oss"` (default) or `"standard"` layout; either supports both brands.
|
|
108
|
+
|
|
109
|
+
For new projects, both CLIs accept `--brand labs`; omitting it or using `--brand vercel` preserves the defaults. See [Create a Labs starter](/docs/getting-started#create-a-labs-starter).
|
|
110
|
+
|
|
91
111
|
### Group navbar links into a dropdown
|
|
92
112
|
|
|
93
113
|
A `nav` entry can group related links into a dropdown. Provide `items` instead of `href`. Each item needs a `label` and an `href`, and takes an optional `section`:
|
|
@@ -121,6 +141,7 @@ import {
|
|
|
121
141
|
github,
|
|
122
142
|
Logo,
|
|
123
143
|
nav,
|
|
144
|
+
navbarBrand,
|
|
124
145
|
prompt,
|
|
125
146
|
siteId,
|
|
126
147
|
suggestions,
|
|
@@ -135,6 +156,7 @@ export const config = defineConfig({
|
|
|
135
156
|
logo: <Logo />,
|
|
136
157
|
github,
|
|
137
158
|
nav,
|
|
159
|
+
navbarBrand,
|
|
138
160
|
basePath,
|
|
139
161
|
siteId,
|
|
140
162
|
translations,
|
|
@@ -46,6 +46,22 @@ pnpm dlx @vercel/geistdocs@latest init --name my-docs
|
|
|
46
46
|
|
|
47
47
|
The CLI copies the template bundled in the package, rewrites the generated app to depend on the same `@vercel/geistdocs` version, installs dependencies, copies `.env.example` to `.env.local`, and initializes Git.
|
|
48
48
|
|
|
49
|
+
### Create a Labs starter
|
|
50
|
+
|
|
51
|
+
To reuse the same template with [Vercel Labs](https://vercel.com/labs) navbar branding, run:
|
|
52
|
+
|
|
53
|
+
```bash title="Terminal"
|
|
54
|
+
pnpm dlx @vercel/geistdocs@latest init --name my-labs-docs --brand labs
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
`--brand` accepts `vercel` (default) or `labs`. Omitting it or passing `--brand vercel` preserves the starter defaults. Invalid values fail before prompts or writes. Add `--disable-git` to skip Git initialization, not dependency installation.
|
|
58
|
+
|
|
59
|
+
Labs changes only `navbarBrand` in `geistdocs.tsx`, independently of the `navbarVariant` layout, project `Logo`, and navigation.
|
|
60
|
+
|
|
61
|
+
`@vercel/geistdocs-private` accepts the same flag. Its public-repository prompt still selects the public or private package; either choice preserves the selected brand.
|
|
62
|
+
|
|
63
|
+
Read [Choose a navbar brand](/docs/configuration#choose-a-navbar-brand) to change the brand in an existing project.
|
|
64
|
+
|
|
49
65
|
## Understand generated dependencies
|
|
50
66
|
|
|
51
67
|
Generated projects pin the resolved package version and include AI SDK v6 and `@ai-sdk/react` v3. The public package does not require private npm access. The template already configures styles, fonts, Cache Components, Partial Prefetching, source adapters, search, Ask AI, and agent-readable routes.
|
package/package.json
CHANGED
|
@@ -47,6 +47,10 @@ Read [Configure sidebar navigation](/docs/guides/nested-navigation) for page ord
|
|
|
47
47
|
The root `geistdocs.tsx` file is the primary configuration surface:
|
|
48
48
|
|
|
49
49
|
```tsx title="geistdocs.tsx"
|
|
50
|
+
import type { GeistdocsNavbarBrand } from "@vercel/geistdocs/config";
|
|
51
|
+
|
|
52
|
+
export const navbarBrand: GeistdocsNavbarBrand = "vercel";
|
|
53
|
+
|
|
50
54
|
export const Logo = () => <span>My Docs</span>;
|
|
51
55
|
|
|
52
56
|
export const github = {
|
|
@@ -86,6 +90,22 @@ export const basePath: string | undefined = undefined;
|
|
|
86
90
|
export const siteId: string | undefined = undefined;
|
|
87
91
|
```
|
|
88
92
|
|
|
93
|
+
### Choose a navbar brand
|
|
94
|
+
|
|
95
|
+
Set the optional `navbarBrand` export to `"vercel"` (default) or `"labs"`:
|
|
96
|
+
|
|
97
|
+
```tsx title="geistdocs.tsx"
|
|
98
|
+
import type { GeistdocsNavbarBrand } from "@vercel/geistdocs/config";
|
|
99
|
+
|
|
100
|
+
export const navbarBrand: GeistdocsNavbarBrand = "labs";
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
The generated `lib/geistdocs/config.tsx` forwards this export to `defineConfig`. Existing sites can forward it in their adapter or set `navbarBrand: "labs"` directly in `defineConfig`. Private projects use the type from `@vercel/geistdocs-private/config`.
|
|
104
|
+
|
|
105
|
+
Labs links to [vercel.com/labs](https://vercel.com/labs) and adapts to light and dark themes. Brand selection preserves your project's `Logo`, `logoHref`, and navigation. It is independent of `navbarVariant`, which selects the `"oss"` (default) or `"standard"` layout; either supports both brands.
|
|
106
|
+
|
|
107
|
+
For new projects, both CLIs accept `--brand labs`; omitting it or using `--brand vercel` preserves the defaults. See [Create a Labs starter](/docs/getting-started#create-a-labs-starter).
|
|
108
|
+
|
|
89
109
|
### Group navbar links into a dropdown
|
|
90
110
|
|
|
91
111
|
A `nav` entry can group related links into a dropdown. Provide `items` instead of `href`. Each item needs a `label` and an `href`, and takes an optional `section`:
|
|
@@ -119,6 +139,7 @@ import {
|
|
|
119
139
|
github,
|
|
120
140
|
Logo,
|
|
121
141
|
nav,
|
|
142
|
+
navbarBrand,
|
|
122
143
|
prompt,
|
|
123
144
|
siteId,
|
|
124
145
|
suggestions,
|
|
@@ -133,6 +154,7 @@ export const config = defineConfig({
|
|
|
133
154
|
logo: <Logo />,
|
|
134
155
|
github,
|
|
135
156
|
nav,
|
|
157
|
+
navbarBrand,
|
|
136
158
|
basePath,
|
|
137
159
|
siteId,
|
|
138
160
|
translations,
|
|
@@ -45,6 +45,22 @@ pnpm dlx @vercel/geistdocs@latest init --name my-docs
|
|
|
45
45
|
|
|
46
46
|
The CLI copies the template bundled in the package, rewrites the generated app to depend on the same `@vercel/geistdocs` version, installs dependencies, copies `.env.example` to `.env.local`, and initializes Git.
|
|
47
47
|
|
|
48
|
+
### Create a Labs starter
|
|
49
|
+
|
|
50
|
+
To reuse the same template with [Vercel Labs](https://vercel.com/labs) navbar branding, run:
|
|
51
|
+
|
|
52
|
+
```bash title="Terminal"
|
|
53
|
+
pnpm dlx @vercel/geistdocs@latest init --name my-labs-docs --brand labs
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
`--brand` accepts `vercel` (default) or `labs`. Omitting it or passing `--brand vercel` preserves the starter defaults. Invalid values fail before prompts or writes. Add `--disable-git` to skip Git initialization, not dependency installation.
|
|
57
|
+
|
|
58
|
+
Labs changes only `navbarBrand` in `geistdocs.tsx`, independently of the `navbarVariant` layout, project `Logo`, and navigation.
|
|
59
|
+
|
|
60
|
+
`@vercel/geistdocs-private` accepts the same flag. Its public-repository prompt still selects the public or private package; either choice preserves the selected brand.
|
|
61
|
+
|
|
62
|
+
Read [Choose a navbar brand](/docs/configuration#choose-a-navbar-brand) to change the brand in an existing project.
|
|
63
|
+
|
|
48
64
|
## Understand generated dependencies
|
|
49
65
|
|
|
50
66
|
Generated projects pin the resolved package version and include AI SDK v6 and `@ai-sdk/react` v3. The public package does not require private npm access. The template already configures styles, fonts, Cache Components, Partial Prefetching, source adapters, search, Ask AI, and agent-readable routes.
|
package/template/geistdocs.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
GeistdocsAgentReadinessConfig,
|
|
3
3
|
GeistdocsAIConfig,
|
|
4
|
+
GeistdocsNavbarBrand,
|
|
4
5
|
} from "@vercel/geistdocs/config";
|
|
5
6
|
|
|
7
|
+
export const navbarBrand: GeistdocsNavbarBrand = "vercel";
|
|
8
|
+
|
|
6
9
|
export const Logo = () => (
|
|
7
10
|
<span className="font-semibold text-gray-1000 text-lg leading-none tracking-[-3%]">
|
|
8
11
|
Geistdocs
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
github,
|
|
7
7
|
Logo,
|
|
8
8
|
nav,
|
|
9
|
+
navbarBrand,
|
|
9
10
|
prompt,
|
|
10
11
|
siteId,
|
|
11
12
|
suggestions,
|
|
@@ -21,6 +22,7 @@ export const config = defineConfig({
|
|
|
21
22
|
logo: <Logo />,
|
|
22
23
|
github,
|
|
23
24
|
nav,
|
|
25
|
+
navbarBrand,
|
|
24
26
|
basePath,
|
|
25
27
|
siteId,
|
|
26
28
|
siteUrl: isSiteUrlConfigured ? siteUrl.toString() : undefined,
|
package/template/package.json
CHANGED