@vercel/geistdocs 1.1.1 → 1.1.2
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/index.js +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{program as j}from"commander";import{copyFile as Y,rm as tt}from"fs/promises";import{join as R}from"path";import{cancel as et,intro as st,isCancel as nt,log as ot,outro as rt,spinner as at,text as it}from"@clack/prompts";import{exec as Z}from"child_process";import{promisify as Q}from"util";var D="https://github.com/vercel/geistdocs";var y={stdio:"ignore"};var E="geistdocs-update",m=Q(Z);var ct="https://github.com/vercel/geistdocs.git",lt=async t=>{await m(`git clone --depth 1 --filter=blob:none --sparse ${ct} ${t}`,y),await m("git sparse-checkout set apps/template",{...y,cwd:t}),await m("mv apps/template/* apps/template/.[!.]* . 2>/dev/null || true",{...y,cwd:t,shell:"/bin/bash"}),await m("rm -rf apps .git",{...y,cwd:t})},pt=async()=>{await Y(".env.example",".env.local")},gt=async()=>{await tt(R("content","docs"),{recursive:!0,force:!0})},dt=async()=>{await m("pnpm install",y)},ft=async()=>{await m("git init",y),await m("git add .",y),await m('git commit -m "\u2728 Initial commit"',y)},mt=async()=>{let t=await it({message:"What is your project named?",placeholder:"my-app",validate(e){if(e.length===0)return"Please enter a project name."}});return nt(t)&&(et("Operation cancelled."),process.exit(0)),t.toString()},I=async t=>{try{st("Let's start a Geistdocs project!");let e=process.cwd(),o=t.name||await mt(),n=at(),a=R(e,o);n.start("Cloning template..."),await lt(o),n.message("Moving into project..."),process.chdir(a),n.message("Setting up environment variables..."),await pt(),n.message("Deleting demo content..."),await gt(),n.message("Installing dependencies..."),await dt(),t.disableGit||(n.message("Initializing Git repository..."),await ft()),n.stop("Project initialized successfully!"),rt("Run `pnpm dev` to start the development server.")}catch(e){let o=e instanceof Error?e.message:`Failed to initialize project: ${e}`;ot.error(o),process.exit(1)}};import{createHash as ht}from"crypto";import{existsSync as z}from"fs";import{readFile as O,writeFile as G}from"fs/promises";import{dirname as ut,parse as _,resolve as v}from"path";import{intro as wt,isCancel as yt,log as h,outro as F,spinner as $t,text as Tt}from"@clack/prompts";import{glob as xt}from"glob";import{Project as Pt,SyntaxKind as C}from"ts-morph";var U=10,Ft="content/docs/**/*.mdx",A=".translation-cache.json",St=/\.[a-z]{2}\.mdx$/,vt=async t=>(await xt(t,{cwd:process.cwd(),absolute:!0,nodir:!0})).filter(o=>o.endsWith(".mdx")).filter(o=>!St.test(o)),bt=t=>{let e=v(process.cwd(),t),a=new Pt({skipAddingFilesFromTsConfig:!0}).addSourceFileAtPath(e).getVariableDeclaration("translations");if(!a)throw new Error("Could not find translations export in config file");let r=a.getInitializer();if(!r||r.getKind()!==C.ObjectLiteralExpression)throw new Error("translations must be an object literal");let s=r.asKind(C.ObjectLiteralExpression);if(!s)throw new Error("Could not parse translations object");let c=s.getProperties().filter(p=>p.getKind()===C.PropertyAssignment).map(p=>p.asKind(C.PropertyAssignment)?.getName()).filter(p=>p!==void 0);if(c.length===0)throw new Error("No locales found in translations object");let[d,...u]=c;return u},Et=t=>ht("sha256").update(t).digest("hex"),Ct=async()=>{let t=v(process.cwd(),A);if(!z(t))return{};try{let e=await O(t,"utf-8");return JSON.parse(e)}catch{return h.warn("Failed to load translation cache, starting fresh"),{}}},M=async t=>{let e=v(process.cwd(),A);await G(e,JSON.stringify(t,null,2),"utf-8")},jt=(t,e,o,n)=>{let a=t[e];if(!a)return!0;let r=a[o];return r?r.hash!==n:!0},Dt=async(t,e,o)=>{let n=await O(t,"utf-8"),a=await fetch(o,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,locale:e})}),r=await a.text();if(!a.ok){let s=`Translation failed with status ${a.status}`;try{let c=JSON.parse(r);s=c.error||c.message||s}catch{s=r||s}throw new Error(s)}try{return JSON.parse(r).translation}catch{throw new Error(`Failed to parse response: ${r.slice(0,200)}`)}},Ut=async(t,e,o,n,a)=>{let r=ut(t),{name:s,ext:c}=_(t),d=v(r,`${s}.${e}${c}`);await G(d,o,"utf-8"),n[t]||(n[t]={}),n[t][e]={hash:a,translatedAt:new Date().toISOString()},await M(n)},k=async(t,e)=>{wt("Translate MDX content");let o=t??Ft,n=[],a=e.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",r=e.config??"geistdocs.tsx";if(r)try{n=bt(r),h.info(`Loaded ${n.length} locale(s) from config: ${n.join(", ")}`)}catch(i){h.error(`Failed to load config: ${i instanceof Error?i.message:String(i)}`),F("Translation cancelled"),process.exit(1)}let s=await vt(o);if(s.length===0&&(h.error(`No MDX files found matching pattern: ${o}`),F("Translation cancelled"),process.exit(1)),h.info(`Found ${s.length} MDX file(s) matching pattern`),n.length===0){let i=await Tt({message:"Enter target locales (comma-separated):",placeholder:"cn,fr,es",validate:l=>{if(!l)return"At least one locale is required"}});yt(i)&&(F("Translation cancelled"),process.exit(0)),n=i.split(",").map(l=>l.trim())}let c=v(process.cwd(),A),d=await Ct();z(c)||await M(d),h.info(`Using cache: ${c}`);let u=new Map;for(let i of s){let l=await O(i,"utf-8");u.set(i,Et(l))}let p=[],$=0;for(let i of n)for(let l of s){let P=u.get(l);if(!P)throw new Error(`Hash not found for file: ${l}`);e.force||jt(d,l,i,P)?p.push({filePath:l,locale:i,hash:P}):$+=1}if(p.length===0){h.success("All translations are up to date!"),F(`Skipped ${$} file(s) (unchanged)`);return}let w=[];for(let i=0;i<p.length;i+=U)w.push(p.slice(i,i+U));h.info(`Processing ${p.length} translation(s) in ${w.length} batch(es) of up to ${U}`),$>0&&h.info(`Skipped ${$} translation(s) (unchanged)`);let x=$t();try{let i=[];x.start("Starting translation...");let l=0;for(let T=0;T<w.length;T++){let b=w[T];x.message(`Processing batch ${T+1}/${w.length} (${b.length} translations) - ${l}/${p.length} complete`),await Promise.all(b.map(async f=>{let{name:B,ext:W}=_(f.filePath),q=await Dt(f.filePath,f.locale,a);await Ut(f.filePath,f.locale,q,d,f.hash),i.push({name:B,locale:f.locale,ext:W}),l+=1})),T<w.length-1&&(x.message(`Batch ${T+1}/${w.length} complete. Pausing...`),await new Promise(f=>setTimeout(f,1e3)))}x.stop("Translation complete!");for(let{name:T,locale:b,ext:f}of i)h.success(`Saved: ${T}.${b}${f}`);let P=[`Translated ${i.length} file(s)`];$>0&&P.push(`Skipped ${$} unchanged`),F(P.join(" \u2022 "))}catch(i){let l=i instanceof Error?i.message:String(i);x.stop(`Translation failed: ${l}`),F("Exiting"),process.exit(1)}};import{copyFile as Ot,mkdir as K,rm as L}from"fs/promises";import{dirname as At,join as S}from"path";import{intro as Nt,log as g,outro as H,spinner as Lt}from"@clack/prompts";import{glob as Rt}from"glob";var X="apps/template",It=["**/*"],zt=["content/docs/**"],Gt=async t=>{let e=process.cwd(),o=S(e,t);await L(o,{recursive:!0,force:!0}),await K(o,{recursive:!0})},_t=async t=>await m(`git clone --depth 1 ${D} ${t}`),N=async t=>await L(t,{recursive:!0,force:!0}),J=async(t,e,o)=>(await Rt(t,{cwd:o,nodir:!0,dot:!0,ignore:[".git/**",...e]})).sort(),Mt=async(t,e)=>{let o=process.cwd(),n=S(e,X,t),a=S(o,t);await K(At(a),{recursive:!0}),await Ot(n,a)},kt=async t=>{let e=process.cwd(),o=S(e,t);await L(o,{force:!0})},Ht=async(t,e,o,n)=>{let a={success:[],deleted:[],failed:[]};for(let r of t)try{n.message(`Updating ${r}...`),await Mt(r,o),a.success.push(r)}catch(s){let c=s instanceof Error?s.message:`${s}`;a.failed.push({file:r,error:c})}for(let r of e)try{n.message(`Deleting ${r}...`),await kt(r),a.deleted.push(r)}catch(s){let c=s instanceof Error?s.message:`${s}`;a.failed.push({file:r,error:c})}return a},Jt=t=>{if(t.success.length>0){g.success(`Successfully updated ${t.success.length} files:`);for(let e of t.success)g.info(` \u2713 ${e}`)}if(t.deleted.length>0){g.success(`Deleted ${t.deleted.length} files:`);for(let e of t.deleted)g.info(` \u{1F5D1} ${e}`)}if(t.failed.length>0){g.warn(`Failed to update ${t.failed.length} files:`);for(let{file:e,error:o}of t.failed)g.error(` \u2717 ${e}: ${o}`)}},V=async(t,e)=>{let o=process.cwd(),n=S(o,E),a=t&&t.length>0?t:It,r=t&&t.length>0?[]:zt;try{Nt("Let's update your Geistdocs project!"),g.info(`Repository: ${D}`),t&&t.length>0&&g.info(`Updating specific files: ${t.join(", ")}`),e?.sync&&g.info("Sync mode enabled: will delete files removed from template");let s=Lt();s.start("Creating temporary directory..."),await Gt(E),s.message("Cloning repository..."),await _t(E),s.message("Scanning for files...");let c=S(n,X),d=await J(a,r,c),u=[];if(e?.sync){s.message("Comparing with local files...");let $=await J(a,r,o),w=new Set(d);u=$.filter(x=>!w.has(x))}if(s.stop(`Found ${d.length} files to update`),d.length===0&&u.length===0){g.warn("No files matched the patterns. Nothing to update."),await N(n),H("Update cancelled.");return}g.info(`Patterns: ${a.length}`),g.info(`Files to update: ${d.length}`),e?.sync&&g.info(`Files to delete: ${u.length}`),s.start("Updating files...");let p=await Ht(d,u,n,s);s.message("Cleaning up..."),await N(n),s.stop("Update complete!"),Jt(p),H("Please review and test the changes carefully.")}catch(s){let c=s instanceof Error?s.message:`${s}`;try{await N(n)}catch{}g.error(`Failed to update project: ${c}`),process.exit(1)}};j.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(I);j.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(V);j.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(k);j.parse(process.argv);
|
|
2
|
+
import{program as E}from"commander";import{copyFile as ee,rm as te}from"fs/promises";import{join as O}from"path";import{cancel as se,intro as ne,isCancel as re,log as oe,outro as ae,spinner as ie,text as ce}from"@clack/prompts";import{spawn as Q}from"child_process";var R="https://github.com/vercel/geistdocs";var T={stdio:"ignore"};var C="geistdocs-update",m=(e,t)=>new Promise((r,s)=>{let[o,...a]=e.split(" "),n=Q(o,a,{stdio:["ignore","pipe","pipe"],shell:t?.shell??!0,cwd:t?.cwd}),g="",l="";n.stdout?.on("data",c=>{g+=c.toString()}),n.stderr?.on("data",c=>{l+=c.toString()});let i=()=>{n.kill("SIGTERM"),setTimeout(()=>{n.killed||n.kill("SIGKILL")},1e3)};process.on("SIGINT",i),process.on("SIGTERM",i),n.on("close",c=>{process.removeListener("SIGINT",i),process.removeListener("SIGTERM",i),c===0?r({stdout:g,stderr:l}):s(new Error(`Command failed with code ${c}: ${l}`))}),n.on("error",c=>{process.removeListener("SIGINT",i),process.removeListener("SIGTERM",i),s(c)})});var le="https://github.com/vercel/geistdocs.git",pe=async e=>{await m(`git clone --depth 1 --filter=blob:none --sparse ${le} ${e}`,T),await m("git sparse-checkout set apps/template",{...T,cwd:e}),await m("mv apps/template/* apps/template/.[!.]* . 2>/dev/null || true",{...T,cwd:e,shell:"/bin/bash"}),await m("rm -rf apps .git",{...T,cwd:e})},ge=async()=>{await ee(".env.example",".env.local")},de=async()=>{await te(O("content","docs"),{recursive:!0,force:!0})},fe=async()=>{await m("pnpm install",T)},me=async()=>{await m("git init",T),await m("git add .",T),await m('git commit -m "\u2728 Initial commit"',T)},ue=async()=>{let e=await ce({message:"What is your project named?",placeholder:"my-app",validate(t){if(t.length===0)return"Please enter a project name."}});return re(e)&&(se("Operation cancelled."),process.exit(0)),e.toString()},A=async e=>{try{ne("Let's start a Geistdocs project!");let t=process.cwd(),r=e.name||await ue(),s=ie(),o=O(t,r);s.start("Cloning template..."),await pe(r),s.message("Moving into project..."),process.chdir(o),s.message("Setting up environment variables..."),await ge(),s.message("Deleting demo content..."),await de(),s.message("Installing dependencies..."),await fe(),e.disableGit||(s.message("Initializing Git repository..."),await me()),s.stop("Project initialized successfully!"),ae("Run `pnpm dev` to start the development server.")}catch(t){let r=t instanceof Error?t.message:`Failed to initialize project: ${t}`;oe.error(r),process.exit(1)}};import{createHash as he}from"crypto";import{existsSync as G}from"fs";import{readFile as L,writeFile as M}from"fs/promises";import{dirname as we,parse as k,resolve as v}from"path";import{intro as ye,isCancel as Te,log as w,outro as b,spinner as $e,text as xe}from"@clack/prompts";import{glob as Pe}from"glob";import{Project as Se,SyntaxKind as I}from"ts-morph";var j=10,be="content/docs/**/*.mdx",U=".translation-cache.json",ve=/\.[a-z]{2}\.mdx$/,Ee=async e=>(await Pe(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).filter(r=>r.endsWith(".mdx")).filter(r=>!ve.test(r)),Fe=e=>{let t=v(process.cwd(),e),o=new Se({skipAddingFilesFromTsConfig:!0}).addSourceFileAtPath(t).getVariableDeclaration("translations");if(!o)throw new Error("Could not find translations export in config file");let a=o.getInitializer();if(!a||a.getKind()!==I.ObjectLiteralExpression)throw new Error("translations must be an object literal");let n=a.asKind(I.ObjectLiteralExpression);if(!n)throw new Error("Could not parse translations object");let g=n.getProperties().filter(c=>c.getKind()===I.PropertyAssignment).map(c=>c.asKind(I.PropertyAssignment)?.getName()).filter(c=>c!==void 0);if(g.length===0)throw new Error("No locales found in translations object");let[l,...i]=g;return i},Ce=e=>he("sha256").update(e).digest("hex"),Ie=async()=>{let e=v(process.cwd(),U);if(!G(e))return{};try{let t=await L(e,"utf-8");return JSON.parse(t)}catch{return w.warn("Failed to load translation cache, starting fresh"),{}}},z=async e=>{let t=v(process.cwd(),U);await M(t,JSON.stringify(e,null,2),"utf-8")},Re=(e,t,r,s)=>{let o=e[t];if(!o)return!0;let a=o[r];return a?a.hash!==s:!0},je=async(e,t,r)=>{let s=await L(e,"utf-8"),o=await fetch(r,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:s,locale:t})}),a=await o.text();if(!o.ok){let n=`Translation failed with status ${o.status}`;try{let g=JSON.parse(a);n=g.error||g.message||n}catch{n=a||n}throw new Error(n)}try{return JSON.parse(a).translation}catch{throw new Error(`Failed to parse response: ${a.slice(0,200)}`)}},Le=async(e,t,r,s,o)=>{let a=we(e),{name:n,ext:g}=k(e),l=v(a,`${n}.${t}${g}`);await M(l,r,"utf-8"),s[e]||(s[e]={}),s[e][t]={hash:o,translatedAt:new Date().toISOString()},await z(s)},_=async(e,t)=>{ye("Translate MDX content");let r=e??be,s=[],o=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",a=t.config??"geistdocs.tsx";if(a)try{s=Fe(a),w.info(`Loaded ${s.length} locale(s) from config: ${s.join(", ")}`)}catch(p){w.error(`Failed to load config: ${p instanceof Error?p.message:String(p)}`),b("Translation cancelled"),process.exit(1)}let n=await Ee(r);if(n.length===0&&(w.error(`No MDX files found matching pattern: ${r}`),b("Translation cancelled"),process.exit(1)),w.info(`Found ${n.length} MDX file(s) matching pattern`),s.length===0){let p=await xe({message:"Enter target locales (comma-separated):",placeholder:"cn,fr,es",validate:d=>{if(!d)return"At least one locale is required"}});Te(p)&&(b("Translation cancelled"),process.exit(0)),s=p.split(",").map(d=>d.trim())}let g=v(process.cwd(),U),l=await Ie();G(g)||await z(l),w.info(`Using cache: ${g}`);let i=new Map;for(let p of n){let d=await L(p,"utf-8");i.set(p,Ce(d))}let c=[],h=0;for(let p of s)for(let d of n){let S=i.get(d);if(!S)throw new Error(`Hash not found for file: ${d}`);t.force||Re(l,d,p,S)?c.push({filePath:d,locale:p,hash:S}):h+=1}if(c.length===0){w.success("All translations are up to date!"),b(`Skipped ${h} file(s) (unchanged)`);return}let y=[];for(let p=0;p<c.length;p+=j)y.push(c.slice(p,p+j));w.info(`Processing ${c.length} translation(s) in ${y.length} batch(es) of up to ${j}`),h>0&&w.info(`Skipped ${h} translation(s) (unchanged)`);let P=$e();try{let p=[];P.start("Starting translation...");let d=0;for(let $=0;$<y.length;$++){let F=y[$];P.message(`Processing batch ${$+1}/${y.length} (${F.length} translations) - ${d}/${c.length} complete`),await Promise.all(F.map(async u=>{let{name:W,ext:Y}=k(u.filePath),Z=await je(u.filePath,u.locale,o);await Le(u.filePath,u.locale,Z,l,u.hash),p.push({name:W,locale:u.locale,ext:Y}),d+=1})),$<y.length-1&&(P.message(`Batch ${$+1}/${y.length} complete. Pausing...`),await new Promise(u=>setTimeout(u,1e3)))}P.stop("Translation complete!");for(let{name:$,locale:F,ext:u}of p)w.success(`Saved: ${$}.${F}${u}`);let S=[`Translated ${p.length} file(s)`];h>0&&S.push(`Skipped ${h} unchanged`),b(S.join(" \u2022 "))}catch(p){let d=p instanceof Error?p.message:String(p);P.stop(`Translation failed: ${d}`),b("Exiting"),process.exit(1)}};import{access as Ue,copyFile as De,mkdir as X,rm as N}from"fs/promises";import{dirname as Ne,join as x}from"path";import{intro as Oe,log as f,outro as H,spinner as Ae}from"@clack/prompts";import{glob as Ge}from"glob";var V="apps/template",Me=["**/*"],ke=["content/docs/**"],ze=async(e,t)=>{let r=x(e,t);await N(r,{recursive:!0,force:!0}),await X(r,{recursive:!0})},_e=async(e,t)=>{await m(`git clone --depth 1 --filter=blob:none --sparse ${R} ${t}`,{cwd:e}),await m("git sparse-checkout set apps/template",{cwd:x(e,t)})},D=async e=>await N(e,{recursive:!0,force:!0}),K=async(e,t,r)=>(await Ge(e,{cwd:r,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),He=async e=>{try{return await Ue(e),!0}catch{return!1}},Ke=async(e,t,r)=>{let s=x(t,V,e),o=x(r,e);return await He(s)?(await De(s,o),{success:!0}):{success:!1,error:`Source file not found: ${s}`}},Be=async(e,t)=>{let r=x(t,e);return await N(r,{force:!0}),{success:!0}},B=20,J=async(e,t,r)=>{let s=[];for(let o=0;o<e.length;o+=r){let a=e.slice(o,o+r),n=await Promise.all(a.map(t));s.push(...n)}return s},Je=async(e,t,r,s,o)=>{let a={success:[],deleted:[],failed:[]},n=[...new Set(e.map(l=>Ne(x(s,l))))];o.message(`Creating ${n.length} directories...`),await Promise.all(n.map(l=>X(l,{recursive:!0}))),o.message(`Updating ${e.length} files...`);let g=await J(e,async l=>{let i=await Ke(l,r,s);return{file:l,...i}},B);for(let{file:l,success:i,error:c}of g)i?a.success.push(l):a.failed.push({file:l,error:c??"Unknown error"});if(t.length>0){o.message(`Deleting ${t.length} files...`);let l=await J(t,async i=>{try{return await Be(i,s),{file:i,success:!0}}catch(c){let h=c instanceof Error?c.message:`${c}`;return{file:i,success:!1,error:h}}},B);for(let i of l)i.success?a.deleted.push(i.file):a.failed.push({file:i.file,error:i.error})}return a},Xe=e=>{if(e.success.length>0){f.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)f.info(` \u2713 ${t}`)}if(e.deleted.length>0){f.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)f.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){f.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:r}of e.failed)f.error(` \u2717 ${t}: ${r}`)}},q=async(e,t)=>{let r=process.cwd(),s=x(r,C),o=e&&e.length>0?e:Me,a=e&&e.length>0?[]:ke;try{Oe("Let's update your Geistdocs project!"),f.info(`Repository: ${R}`),e&&e.length>0&&f.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&f.info("Sync mode enabled: will delete files removed from template");let n=Ae();n.start("Creating temporary directory..."),await ze(r,C),n.message("Cloning repository..."),await _e(r,C),n.message("Scanning for files...");let g=x(s,V),l=await K(o,a,g),i=[];if(t?.sync){n.message("Comparing with local files...");let h=await K(o,a,r),y=new Set(l);i=h.filter(P=>!y.has(P))}if(n.stop(`Found ${l.length} files to update`),l.length===0&&i.length===0){f.warn("No files matched the patterns. Nothing to update."),await D(s),H("Update cancelled.");return}f.info(`Patterns: ${o.length}`),f.info(`Files to update: ${l.length}`),t?.sync&&f.info(`Files to delete: ${i.length}`),n.start("Updating files...");let c=await Je(l,i,s,r,n);n.message("Cleaning up..."),await D(s),n.stop("Update complete!"),Xe(c),H("Please review and test the changes carefully.")}catch(n){let g=n instanceof Error?n.message:`${n}`;try{await D(s)}catch{}f.error(`Failed to update project: ${g}`),process.exit(1)}};E.name("geistdocs").description("CLI for Geistdocs projects").version("1.1.1","-v, --version","Output the current version");E.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(A);E.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(q);E.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(_);E.parse(process.argv);
|