tldw
Version:
Generate README files from package metadata and configurable fragments.
124 lines (123 loc) • 19.7 kB
JavaScript
var e
import{Clerc as t,friendlyErrorPlugin as n,helpPlugin as a,strictFlagsPlugin as r,versionPlugin as l}from"clerc"
import{defineCommand as o}from"clerc"
import*as i from"forward-slash-path"
import s from"camelcase"
import p from"chalk"
import{filesize as u}from"filesize"
import*as g from"forward-slash-path"
import c from"fs-extra"
var m={legal:"Legal",warning:"Warning",usage:"Usage",advancedUsage:"Advanced Usage",example:!0,options:!0,development:!0,description:!0,result:!0,notes:"Notes",related:"Related",faq:"Questions & Answers"}
import f from"handlebars"
var d={flat:"secondary","flat-square":"secondary","for-the-badge":"default",plastic:"outline",social:"ghost"},h=new Set([".gif",".png",".svg"]),y=e=>e.replaceAll("-","--").replaceAll("_","__"),b=(e,t,n)=>{let a=e.replace(/\/+$/u,""),r=t.replace(/^\/+/,""),l=n.toString()
return l?`${a}/${r}?${l}`:`${a}/${r}`},k=e=>{let t=e.baseUrl??"https://shieldcn.dev",n=e.altText??"Shield",a=(e=>{try{let t=new URL(e).hostname
return"shieldcn.dev"===t||"www.shieldcn.dev"===t}catch{return!1}})(t),r=new URLSearchParams
if(a?r.set("variant",e.variant??d[e.style??"flat-square"]??e.style??"secondary"):r.set("style",e.style??"flat-square"),e.logo&&r.set("logo",e.logo),e.logoColor&&r.set("logoColor",e.logoColor),e.label&&r.set("label",e.label),e.query)for(let[t,n]of Object.entries(e.query))r.set(t,n)
let l=`badge/${encodeURIComponent(y(e.leftText??"Left"))}-${encodeURIComponent(y(e.rightText??"Right"))}-${encodeURIComponent(e.color??"lightgray")}`
e.path&&(l=Array.isArray(e.path)?e.path.map(e=>encodeURIComponent(e)).join("/"):(e=>e.split("/").map(e=>encodeURIComponent(e)).join("/"))(e.path)),e.path&&e.color&&r.set("color",e.color)
let o=a?(e=>(e=>[...h].some(t=>e.endsWith(t)))(e)?e:`${e}.svg`)(l):l,i=`<img src="${b(t,o,r)}" alt="${n}"/>`
if(e.colorSchemeAware&&a){let e=new URLSearchParams(r)
e.set("mode","light")
let a=new URLSearchParams(r)
a.set("mode","dark"),i=`<picture><source media="(prefers-color-scheme: dark)" srcset="${b(t,o,a)}"><img src="${b(t,o,e)}" alt="${n}"/></picture>`}return e.link?`<a href="${e.link}">${i}</a>`:i}
import*as w from"forward-slash-path"
import $ from"fs-extra"
import x from"trim-around"
import{parse as v}from"yaml"
var j=new Intl.Collator(void 0),A=["bun","npm","pnpm","yarn","deno"],T=["npm"],C=["ts","tsx","js","jsx"],F=async e=>{if(!await $.pathExists(e))return null
if(!(await $.stat(e)).isFile())return null
let t=await Bun.file(e).text()
return x(t)},L=async e=>{let t=await F(e)
return null===t?null:v(t)??null},S=async e=>{for(let t of C){let n=await F(`${e}.${t}`)
if(null!==n)return{content:n,extension:t}}return null},B=async e=>(await S(e))?.content??null,E=e=>null!=e&&("string"==typeof e?e.trim().length>0:Array.isArray(e)?e.length>0:"object"!=typeof e||Object.keys(e).length>0),D=e=>{let t=[]
Array.isArray(e)?t=e:null!=e&&(t=[e])
let n=t.filter(e=>"string"==typeof e).map(e=>e.trim()).filter(Boolean)
return[...new Set(n)]},R=(e,t=T)=>{let n=null==e?t:D(e),a=[]
for(let e of n){let t=e.toLowerCase(),n=A.find(e=>e===t)
n&&!a.includes(n)&&a.push(n)}return a},P=(e,t=1)=>"number"==typeof e&&Number.isFinite(e)?Math.max(0,Math.floor(e)):t,I=e=>"string"==typeof e?e.trim()||null:(e=>"object"==typeof e&&null!==e&&!Array.isArray(e))(e)?e:null,U=e=>Array.isArray(e)?0===e.length?[]:e.some(Array.isArray)?e.map(e=>(Array.isArray(e)?e:[e]).map(I).filter(e=>null!==e)):[e.map(I).filter(e=>null!==e)]:null,N=e=>!1!==e&&null!=e&&(!0===e||("string"==typeof e?e.trim()||!0:"object"==typeof e&&!Array.isArray(e)&&e)),q=(e,t)=>{let n=t.trim().toLowerCase()
return D(e).some(e=>e.toLowerCase()===n)},O=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',""").replaceAll("'","'"),M=e=>{if("string"==typeof e)return e
if(Array.isArray(e)){for(let t of e){let e=M(t)
if(e)return e}return null}return e?.url?e.url:null},H=e=>w.basename(e,w.extname(e)),G=e=>`https://raw.githubusercontent.com/${e}/HEAD/license.txt`,V=e=>e.split("/"),W=(e,t)=>{if(q(t.config.excludeShields,e))return""
if("bun"===e)return k({altText:"Bun",path:"badge/Bun-fbf0df",logo:"bun",logoColor:"fbf0df",variant:"outline",colorSchemeAware:!0,link:"https://bun.sh"})
if("types"===e)return k({altText:"TypeScript types included",path:"badge/types-included-377cc8",logo:"typescript",logoColor:"fff",colorSchemeAware:!0})
if("npm"===e)return k({altText:`${t.pkg.name} on npm`,leftText:"npm",rightText:t.pkg.name,logo:"npm",color:"C23039",link:`https://npmjs.com/package/${t.pkg.name}`})
if("npmx"===e)return k({altText:`${t.pkg.name} on npm`,leftText:"npmx",rightText:t.pkg.name,logo:"npm",color:"C23039",link:`https:/npmx.dev/package/${t.pkg.name}`})
if("pnpm"===e)return k({altText:`${t.pkg.name} on pnpm`,leftText:"pnpm",rightText:t.pkg.name,logo:"pnpm",logoColor:"white",color:"F69220",link:`https://npmjs.com/package/${t.pkg.name}`})
if("yarn"===e)return k({altText:`${t.pkg.name} on Yarn`,leftText:"Yarn",rightText:t.pkg.name,logo:"yarn",logoColor:"white",color:"2F8CB7",link:`https://yarnpkg.com/package/${t.pkg.name}`})
if("jsdelivr"===e)return k({altText:`${t.pkg.name} on jsDelivr`,leftText:"jsDelivr",rightText:t.pkg.name,logo:"html5",color:"orange",logoColor:"white",link:`https://www.jsdelivr.com/package/npm/${t.pkg.name}`})
if("unpkg"===e)return k({altText:`${t.pkg.name} on UNPKG`,leftText:"UNPKG",rightText:t.pkg.name,logo:"html5",color:"orange",logoColor:"white",link:`https://unpkg.com/browse/${t.pkg.name}/`})
if("web"===e)return k({altText:`${t.pkg.name} in the browser`,leftText:"browser",rightText:t.pkg.name,logo:"html5",color:"orange",logoColor:"white",link:`https://www.jsdelivr.com/package/npm/${t.pkg.name}`})
if("commitsSince"===e)return k({path:"badge/dynamic/json",query:{label:`commits since ${t.tag}`,query:"$.total_commits",url:`https://api.github.com/repos/${t.slug}/compare/${t.tag}...HEAD`},altText:`Commits since ${t.tag}`,logo:"github",link:`https://github.com/${t.slug}/compare/${t.tag}...HEAD`})
if("issues"===e)return k({path:["github","issues",...V(t.slug)],altText:"Issues",logo:"github",link:`https://github.com/${t.slug}/issues`})
if("license"===e)return k({path:["github","license",...V(t.slug)],altText:"License",link:G(t.slug)})
if("lastCommit"===e)return k({path:["github","last-commit",...V(t.slug)],altText:"Last commit",logo:"github",link:`https://github.com/${t.slug}/commits`})
if("githubPackages"===e){let e=`@${t.slug}`
return k({logo:"github",link:`https://github.com/${t.slug}/packages`,altText:`${e} on GitHub Packages`,leftText:"GitHub Packages",rightText:e,color:"24282e"})}if("dependents"===e)return k({path:["npm","dependents",...V(t.pkg.name)],altText:"Dependents",logo:"npm",link:`https://github.com/${t.slug}/network/dependents`})
if("npmDownloads"===e)return k({path:["npm","dm",...V(t.pkg.name)],altText:"Downloads",logo:"npm",link:`https://npmjs.com/package/${t.pkg.name}`})
if("npmLatest"===e)return k({path:["npm","v",...V(t.pkg.name)],altText:"Latest version on npm",logo:"npm",link:`https://npmjs.com/package/${t.pkg.name}`,label:"latest version"})
if("actions"===e)return t.config.githubActions?k({altText:"Build status",link:`https://github.com/${t.slug}/actions`,logo:"github",path:["github","ci",...V(t.slug)]}):""
if("sponsor"===e)return t.fundingLink?k({altText:`Sponsor ${t.pkg.name}`,link:t.fundingLink,leftText:"<3",rightText:"Sponsor",color:"FF45F1"}):""
throw Error(`Unknown shield type: ${e}`)},J=f.create()
J.registerHelper("shield",(e,...t)=>{let n=(e=>{let t=e.at(-1)
if("object"!=typeof t||null===t||!("data"in t))return null
let n=t.data
if("object"!=typeof n||null===n||!("root"in n))return null
let a=n.root
return"object"!=typeof a||null===a?null:a})(t)
return n?.config&&n.pkg&&n.slug&&n.tag?W(e,{config:n.config,fundingLink:n.fundingLink??null,pkg:n.pkg,slug:n.slug,tag:n.tag}):""}),J.registerHelper("escapeMarkdown",e=>"string"!=typeof e?"":e.replaceAll("<",String.raw`\<`))
var _,z=J,K=({bottomColor:e="oklch(66% 0.4 268)",font:t="JetBrains Mono, JetBrainsMono, monospace",text:n,topColor:a="oklch(70% 0.2 294)"})=>{let r=t,l=O(n)
return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16000 1000"><style>.text { font-size: 500px; font-weight: 200; font-family: ${r} }</style><defs><linearGradient id="color" x1="50%" y1="0%" x2="50%" y2="100%"><stop stop-color="${O(a)}"/><stop offset="100%" stop-color="${O(e)}"/></linearGradient></defs><rect width="16000" height="1000" fill="url(#color)" rx="100"/><text x="50%" y="50%" text-anchor="middle" dominant-baseline="middle" fill="white" class="text">${l}</text></svg>`}
import*as Y from"forward-slash-path"
import Q from"fs-extra"
var Z=async(e,t)=>{let n=await L(e)??{},a=await Q.pathExists(Y.join(t,".github","workflows")),r=n.environmentVariables,l={}
return"object"!=typeof r||null===r||Array.isArray(r)||(l=r),{banner:!1,binExample:null,binName:"global"===n.installation,githubActions:a,personal:!1,link:null,linkName:null,installation:!1,environmentVariables:{},maxBlankLines:1,needsNodeRuntime:!0,packageManagers:[...T],tryInBrowser:null,versionInInstallation:!1,exampleResultMayVary:!1,excludeShields:[],renderComment:!0,shields:null,githubPackage:!1,...n,banner:N(n.banner),environmentVariables:l,excludeShields:D(n.excludeShields),maxBlankLines:P(n.maxBlankLines),packageManagers:R(n.packageManagers,T),shields:U(n.shields),versionInInstallation:!0===n.versionInInstallation}}
import*as X from"forward-slash-path"
import{globby as ee}from"globby"
var te,ne=async({configDirectory:e})=>{let t=await ee(C.map(e=>`result*.${e}`),{cwd:e,onlyFiles:!0,caseSensitiveMatch:!0}),n=[...new Set(t.map(H).filter(e=>"result"!==e))].toSorted((e,t)=>j.compare(e,t)),a=await Promise.all(n.map(async t=>{for(let n of C){let a=X.join(e,`${t}.${n}`),r=await F(a)
if(null!==r)return[t,r]}return null}))
return Object.fromEntries(a.filter(e=>null!==e))}
import*as ae from"forward-slash-path"
var re=async e=>{let t=await(async e=>{let t=await F(e)
return null===t?null:JSON.parse(t)})(e)??{},n="string"==typeof t.name&&t.name.length>0?t.name:ae.basename(ae.dirname(ae.resolve(e))),a="string"==typeof t.version&&t.version.length>0?t.version:"1.0.0"
return{...t,name:n,version:a}}
import*as le from"forward-slash-path"
var oe=(e,t)=>e.required&&!t.required?-1:t.required&&!e.required?1:j.compare(e.name,t.name),ie=async(e,t)=>{let[n,a]=await Promise.all([L(e),L(le.join(t,"action.yml"))]),r=Object.entries(n??{}).map(([e,t])=>((e,t)=>"object"!=typeof t||null===t||Array.isArray(t)?{name:e,default:t}:{name:e,...t})(e,t))
if(a?.inputs)for(let[e,t]of Object.entries(a.inputs)){let n=r.find(t=>t.name===e)
n||(n={name:e},r.push(n)),void 0===n.info&&"string"==typeof t.description&&(n.info=t.description),void 0===n.default&&Object.hasOwn(t,"default")&&(n.default=t.default),void 0===n.required&&"boolean"==typeof t.required&&(n.required=t.required)}return 0===r.length?null:(r.sort(oe),{entries:r,anyEntryHasType:r.some(e=>E(e.type)),anyEntryHasInfo:r.some(e=>E(e.info)),anyEntryHasRequired:r.some(e=>!0===e.required),anyEntryHasDefault:r.some(e=>E(e.default))})},se=e=>"dev"===e?"--save-dev ":"global"===e?"--global ":"--save ",pe=(e,t,n)=>n?`${e}@^${t}`:e,ue={bun:{prod:e=>`bun add ${e}`,dev:e=>`bun add --development ${e}`,global:e=>`bun add --global ${e}`},npm:{prod:e=>`npm install --save ${e}`,dev:e=>`npm install --save-dev ${e}`,global:e=>`npm install --global ${e}`},pnpm:{prod:e=>`pnpm add ${e}`,dev:e=>`pnpm add --save-dev ${e}`,global:e=>`pnpm add --global ${e}`},yarn:{prod:e=>`yarn add ${e}`,dev:e=>`yarn add --dev ${e}`,global:e=>`yarn global add ${e}`},deno:{prod:e=>`deno add npm:${e}`,dev:e=>`deno add --dev npm:${e}`,global:e=>`deno install --global npm:${e}`}},ge=["bun.lock","bun.toml","bunfig.toml"],ce=async e=>(await Promise.all(ge.map(t=>c.pathExists(g.join(e,t))))).some(Boolean),me=process.cwd(),fe=(e,t,n)=>{let a=(e=>`--${e.replaceAll(/[A-Z]/gu,e=>`-${e.toLowerCase()}`)}`)(t),r=`-${n}`
return e.some(e=>e===a||e.startsWith(`${a}=`)||e===r||e.startsWith(`${r}=`)||e.startsWith(r)&&e.length>r.length)},de=o({name:"",description:"Generate a README file from package metadata and configurable fragments.",flags:{outputFile:{type:String,short:"o",default:i.join(me,"readme.md"),description:"output file"},configDirectory:{type:String,short:"c",default:i.join(me,"docs","tldw"),description:"directory containing tldw fragment and config files"},packageFile:{type:String,short:"p",default:i.join(me,"package.json"),description:"path to a package.json file"},licenseFile:{type:String,short:"l",default:i.join(me,"license.txt"),description:"path to the license file"}}},async e=>{let t=i.resolve(e.flags.packageFile),n=i.dirname(t),a={outputFile:i.resolve(e.flags.outputFile),configDirectory:fe(e.rawParsed.raw,"configDirectory","c")?i.resolve(e.flags.configDirectory):i.join(n,"docs","tldw"),packageFile:t,licenseFile:fe(e.rawParsed.raw,"licenseFile","l")?i.resolve(e.flags.licenseFile):i.join(n,"license.txt")},r=await(async e=>{let t=await(async e=>{if(!await c.pathExists(e.packageFile))throw Error(`No package.json found at ${e.packageFile}.`)
let t=g.dirname(e.packageFile),n=Object.entries(m).map(async([t,n])=>{let a=g.join(e.configDirectory,`${t}.md`),r=await F(a)
return null===r?[t,null]:"usage"===t?[t,r]:"string"==typeof n?[t,`## ${n}\n\n${r}`]:[t,r]}),[a,r,l,o,i,p,u,f,d,h,y,...b]=await Promise.all([re(e.packageFile),Z(g.join(e.configDirectory,"config.yml"),t),ie(g.join(e.configDirectory,"usageOptions.yml"),t),B(g.join(e.configDirectory,"example")),S(g.join(e.configDirectory,"usage")),S(g.join(e.configDirectory,"result")),ne(e),F(e.licenseFile),L(g.join(e.configDirectory,"envVars.yml")),(te??=(async()=>{let e=await Bun.file(new URL("../../package.json",import.meta.url)).json()
return{name:e.name??"tldw",description:e.description??"Generate README files from package metadata and configurable fragments.",version:e.version??"0.0.0"}})(),te),ce(t),...n]),w=(e=>"string"==typeof e?e:e?.url?e.url:null)(a.repository),$=w?(e=>{let t=e.trim().replace(/^git\+/u,"").replace(/[#?].*$/u,"").replace(/\.git$/u,"").replace(/\/$/u,""),n=[/^github:(?<owner>[^/]+)\/(?<repo>[^/]+)$/u,/github\.com[/:](?<owner>[^/]+)\/(?<repo>[^/]+)$/iu,/^(?<owner>[^/]+)\/(?<repo>[^/]+)$/u]
for(let e of n){let n=e.exec(t)
if(n?.groups?.owner&&n.groups.repo)return`${n.groups.owner}/${n.groups.repo}`}return null})(w):null
if(!$)return null
let x={...r.environmentVariables,...d}
null===r.link&&a.domain&&(r.link=`https://${a.domain}`),r.link&&null===r.linkName&&(r.linkName=(e=>{try{return new URL(e).host}catch{return null}})(r.link))
let v=!r.needsNodeRuntime
null===r.tryInBrowser&&(r.tryInBrowser=v)
let A=!1
!0===r.binName?A=(e=>{if(e.bin&&"object"==typeof e.bin&&!Array.isArray(e.bin)){let[t]=Object.keys(e.bin)
if(t)return t}if(e.name.startsWith("@")){let[,t=e.name]=e.name.split("/")
return t}return e.name})(a):"string"==typeof r.binName&&(A=r.binName)
let T=r.binExample||A||null,C=b.filter(e=>null!==e[1]),D=Object.fromEntries(C),R=D.usage??null,P=i?.content??null,I=p?.content??null,U=f,N=!1
if(U?.startsWith("MIT License")){let e=U.split(/\r?\n/u).find(e=>e.startsWith("Copyright"))
e&&(U=e),N=!0}let O=E(x)?(e=>Object.fromEntries(Object.entries(e).toSorted(([e],[t])=>j.compare(e,t))))(x):{},H=(e=>{let t=[],n=pe(e.pkg.name,e.pkg.version,e.config.versionInInstallation)
if(e.config.installation)for(let a of(e=>null==e?[]:Array.isArray(e)?[...e]:[e])(e.config.packageManagers))t.push({header:a,headerArgument:e.pkg.name,command:ue[a][e.config.installation](n)})
return e.config.githubPackage&&e.config.installation&&t.push({header:"githubPackages",headerArgument:e.slug,bonusText:"(if [configured properly](https://help.github.com/en/github/managing-packages-with-github-packages/configuring-npm-for-use-with-github-packages))",command:`npm install ${se(e.config.installation)}${pe(`@${e.slug}`,e.pkg.version,e.config.versionInInstallation)}`}),t})({config:r,pkg:a,slug:$}),G=((e,t)=>{let n=[{name:"setting up",script:`git clone git@github.com:${t}.git\ncd ${e.name}\nbun install`}]
return e.scripts?.lint&&n.push({name:"linting",script:"bun run lint"}),e.scripts?.typecheck&&n.push({name:"type checking",script:"bun run typecheck"}),e.scripts?.test&&n.push({name:"testing",script:"bun run test"}),e.scripts?.["test:dev"]&&n.push({name:"testing in development environment",script:"bun run test:dev"}),n})(a,$),V=null!==l,J=a.displayName||a.title||a.domain||a.name,_=(e=>!1===e.config.banner?null:!0===e.config.banner?K({text:e.title}):"string"==typeof e.config.banner?K({text:e.config.banner}):K({bottomColor:e.config.banner.bottomColor,font:e.config.banner.font,text:e.config.banner.text||e.title,topColor:e.config.banner.topColor}))({config:r,title:J}),z=(e=>(e.config.shields??(e=>[["npmLatest",...E(e.pkg.license)?["license"]:[],...e.isBunProject?["bun"]:[]]])(e)).map(t=>(Array.isArray(t)?t:[t]).map(t=>((e,t)=>"string"==typeof e?W(e,t):e.id&&q(t.config.excludeShields,e.id)?"":k(e))(t,e)).filter(Boolean).join(" ").trim()).filter(Boolean))({config:r,fundingLink:M(a.funding),installationCommands:H,isBunProject:y,pkg:a,slug:$,tag:`v${a.version}`}),Y=M(a.funding)
return{args:e,bannerSvg:_,binExample:T,binName:A,camelCaseName:s(a.name),config:{...r,environmentVariables:O},description:a.description??null,developmentScripts:G,example:o,exampleResults:u,fragments:D,fundingLink:Y,globalName:a.webpackConfigJaid?.endsWith("Class")?s(a.name,{pascalCase:!0}):s(a.name),hasDevelopmentSection:Boolean(D.development)||G.length>0,hasEnvironmentVariables:E(O),hasExampleSection:Boolean(o||Object.keys(u).length>0||D.example),hasOptionsSection:V||Boolean(D.options),hasUsageOptions:V,hasUsageSection:Boolean(R||P||I),installationCommands:H,isBunProject:y,isMitLicense:N,license:U,pascalCaseName:s(a.name,{pascalCase:!0}),pkg:a,shieldLines:z,slug:$,tag:`v${a.version}`,title:J,tldwVersion:h.version,usage:R,usageCode:P,usageCodeLanguage:i?.extension??"ts",usageOptions:l,usageResult:I,usageResultLanguage:p?.extension??"ts",worksAsScriptTag:v}})(e)
if(!t)return{status:"skipped",outputFile:e.outputFile,reason:"tldw is made for GitHub repositories, but package.json#repository is not set. Doing nothing."}
let n=((e,t)=>{let n=e.replaceAll(/\r\n?/gu,"\n").split("\n"),a=[],r=0,l=null
for(let e of n){let n=/^(?<indent>\s*)(?<marker>`{3,}|~{3,})/u.exec(e)?.groups?.marker??null
n&&(l===n?l=null:null===l&&(l=n))
let o=0===e.trim().length
if(null===l&&o){if(r++,r>t)continue}else r=0
a.push(e)}return`${a.join("\n").trim()}\n`})((e=>`${e.replaceAll(/\r\n?/gu,"\n").trim()}\n`)(await(async e=>(await(_??=(async()=>{let e=await Bun.file(new URL("template.hbs",import.meta.url)).text()
return z.compile(e)})(),_))(e))(t)),t.config.maxBlankLines),a=await c.pathExists(e.outputFile)?await Bun.file(e.outputFile).text():null,r=Buffer.byteLength(n)
return a===n?{status:"unchanged",outputFile:e.outputFile,readmeText:n,bytes:r}:(await c.outputFile(e.outputFile,n),{status:null===a?"created":"overwritten",outputFile:e.outputFile,readmeText:n,bytes:r})})(a);((e,t=process.cwd())=>{if("skipped"===e.status)return void(e.reason&&console.warn(e.reason))
let n=g.relative(t,e.outputFile)||g.basename(e.outputFile),a="Left unchanged"
"created"===e.status?a="Created":"overwritten"===e.status&&(a="Overwrote"),console.log(`${p.green(a)} ${p.yellow(n)} ${p.green("with")} ${p.yellow(u(e.bytes??0))}`)})(r)}),he=(e=>{let o=t.create({scriptName:e.name,description:e.description,version:e.version,name:e.name}).use(a()).use(l()).use(r()).use(n()).command(de)
return async()=>{await o.parse(void 0)}})(await(e??=(async()=>{let e=await Bun.file(new URL("../../package.json",import.meta.url)).json()
return{name:e.name??"tldw",description:e.description??"Generate README files from package metadata and configurable fragments.",version:e.version??"0.0.0"}})(),e))
await he()