🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@vyron/cli

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vyron/cli - npm Package Compare versions

Comparing version
1.2.4
to
2.1.0
+1
dist/copy-CsGJSU9I.mjs
import{copyFileSync as e,mkdirSync as t,readdirSync as n}from"node:fs";import{join as r}from"node:path";function i(a,o){t(o,{recursive:!0});let s=n(a,{withFileTypes:!0});for(let t of s){if(t.name===`.git`)continue;let n=r(a,t.name),s=r(o,t.name);t.isDirectory()?i(n,s):e(n,s)}}export{i as copyDir};
let e=require("node:fs"),t=require("node:path");function n(r,i){(0,e.mkdirSync)(i,{recursive:!0});let a=(0,e.readdirSync)(r,{withFileTypes:!0});for(let o of a){if(o.name===`.git`)continue;let a=(0,t.join)(r,o.name),s=(0,t.join)(i,o.name);o.isDirectory()?n(a,s):(0,e.copyFileSync)(a,s)}}exports.copyDir=n;
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},c=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},l=(n,r,a)=>(a=n==null?{}:e(i(n)),c(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let u=require("node:fs"),d=require("node:path");d=l(d,1);let f=require("node:child_process"),p=require("node:os"),m=require("ora");m=l(m,1);let h=require("prompts");h=l(h,1);let g=require("node:url");function _(e){if(!(0,u.existsSync)(e))return!0;let t=(0,u.readdirSync)(e);return t.length===0||t.length===1&&t[0]===`.git`}function v(e){if(!(0,u.existsSync)(e))return;let t=(0,u.readdirSync)(e);for(let n of t)n!==`.git`&&(0,u.rmSync)((0,d.join)(e,n),{recursive:!0,force:!0})}function y(e){return e?/^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e):!1}function b(e,t=!1){return(0,u.existsSync)(e)?_(e)||t?{valid:!0}:{valid:!1,error:`目标目录不为空,请使用 --force 覆盖`}:{valid:!0}}function x(e){return e.replace(/\/+$/,``)}const S=[{name:`GitHub`,value:`https://github.com`,isBuiltin:!0},{name:`Akams`,value:`https://github.akams.cn`,isBuiltin:!0,cloneStyle:`prefix`},{name:`Gitee`,value:`https://gitee.com/mirrors`,isBuiltin:!0,cloneStyle:`gitee`},{name:`GHProxy`,value:`https://gh-proxy.com`,isBuiltin:!0,cloneStyle:`prefix`},{name:`GHFast`,value:`https://ghfast.top`,isBuiltin:!0,cloneStyle:`prefix`}];function C(){return process.env.TEMP_VIIRC_PATH?process.env.TEMP_VIIRC_PATH:d.join((0,p.homedir)(),`.viirc`)}function w(){let e=C();if(!(0,u.existsSync)(e))return[];try{let t=(0,u.readFileSync)(e,`utf-8`);return JSON.parse(t).mirrors||[]}catch{return[]}}function T(){let e=w();return[...S.map(e=>({...e})),...e.map(e=>({...e,isBuiltin:!1}))]}function E(e){let t=C();try{let n=e.filter(e=>!e.isBuiltin).map(e=>({name:e.name,value:e.value}));(0,u.writeFileSync)(t,JSON.stringify({mirrors:n},null,2),`utf-8`)}catch(e){throw Error(`写入配置文件失败: ${e.message}`)}}function ee(e,t,n){let r=!!process.env.CI,i=!!process.stdout.isTTY&&!r,a=null,o=`正在下载 ${e}${t?` (分支: ${t})`:``}`,s=n?` [通过 ${n} 加速]`:``;i?a=(0,m.default)(`${o}...${s}`).start():console.log(`⌛ ${o}...${s}`);let c=0;return{update(e){let t=Date.now();if(e.percent!==100&&t-c<100)return;c=t;let n=e.percent===void 0?``:` ${e.percent}%`,r=[];e.size&&r.push(e.size),e.speed&&r.push(e.speed);let i=`${o}...${n}${r.length>0?` (${r.join(`, `)})`:``}${s}`;a&&(a.text=i)},warn(e){a?(a.warn(e),a.start()):console.warn(`⚠️ ${e}`)},succeed(t){let n=`下载 ${e} 成功 (耗时 ${t}s)`;a?a.succeed(n):console.log(`✔ ${n}`)},fail(t,n){let r=`下载 ${e} 失败`;a?a.fail(r):console.error(`✖ ${r}`),t&&console.error(`\x1b[31m${t}\x1b[0m`),n&&console.log(`\n\x1b[36m${n}\x1b[0m`)},stop(){a&&a.stop()}}}var te=s({applyGithubMirror:()=>O,downloadTemplate:()=>ie,getMirrorName:()=>ne,getRepoLabel:()=>k,parseGithubRepo:()=>D});function D(e){let t=e.replace(/\.git$/,``).replace(/\/$/,``).match(/(?:github\.com\/|github:)([^/]+)\/([^/]+)$/);return t?{owner:t[1],repo:t[2]}:null}function O(e,t){if(!t)return e;let n=t.trim().replace(/\/$/,``),r=T().find(e=>e.value.replace(/\/$/,``)===n)?.cloneStyle??`domain`,i=D(e);if(r===`gitclone`)return i?`https://gitclone.com/github.com/${i.owner}/${i.repo}.git`:`https://gitclone.com/github.com/${e.replace(/^https:\/\/github\.com\//,``)}`;if(r===`prefix`){let t=n.startsWith(`http`)?n:`https://${n}`;return i?`${t}/https://github.com/${i.owner}/${i.repo}.git`:`${t}/${e}`}if(r===`gitee`)return i?`https://gitee.com/mirrors/${i.repo}.git`:e;if(e.startsWith(`https://github.com`)){let t=n.startsWith(`http`)?n:`https://${n}`;return e.replace(`https://github.com`,t)}return e}function k(e){let t=e.replace(/\.git$/,``).replace(/\/$/,``).match(/[:/]([^/]+)\/([^/]+)$/);return t?`${t[1]}/${t[2]}`:`项目模板`}function ne(e){if(!e)return`官方源`;let t=e.trim().replace(/\/$/,``),n=S.find(e=>e.value.replace(/\/$/,``)===t);if(n)return n.name;try{return new URL(e).hostname}catch{return e}}async function re(e,t,n){return new Promise((r,i)=>{let a=(0,f.spawn)(e,{shell:!0}),o=setTimeout(()=>{a.kill(`SIGKILL`),i(Error(`Git 克隆操作超时(限时 45 秒)。请检查网络连接或更换镜像源。`))},45e3),s=[];a.stderr.on(`data`,e=>{s.push(e);let n=e.toString(),r=n.match(/(\d+)%/),i=n.match(/([\d.]+)\s*(B|KiB|MiB|GiB)\s*\|\s*([\d.]+)\s*(B|KiB|MiB|GiB)\/s/i),a={};r&&(a.percent=parseInt(r[1],10)),i&&(a.size=`${i[1]} ${i[2]}`,a.speed=`${i[3]} ${i[4]}/s`),Object.keys(a).length>0&&t.update(a)});let c=()=>{a.kill(`SIGKILL`);try{(0,f.execSync)(`rm -rf ${n}`)}catch{}process.stdout.write(`\x1B[?25h
`),process.exit(130)};process.once(`SIGINT`,c),a.on(`close`,e=>{if(clearTimeout(o),process.off(`SIGINT`,c),e===0)r();else{let t=Buffer.concat(s).toString().trim();i(Error(t||`Git 克隆进程异常退出,状态码: ${e}`))}}),a.on(`error`,e=>{clearTimeout(o),process.off(`SIGINT`,c),i(e)})})}async function ie(e,t,n){let r=`${(0,p.tmpdir)()}/scaffold-${Date.now()}`,i=e,a;if(e.includes(`#`)){let t=e.split(`#`);i=t[0],a=t[1]}let o=i;i.startsWith(`github:`)&&(o=`https://github.com/${i.slice(7)}.git`);let s=o;n&&(s=O(o,n));let c=k(o),l=a||``,u=ne(n),d=ee(c,l,n?u:``),m=Date.now();try{await re(a?`git clone --progress --depth 1 -b ${a} ${s} ${r}`:`git clone --progress --depth 1 ${s} ${r}`,d,r);let e=((Date.now()-m)/1e3).toFixed(1);d.succeed(e);let{copyDir:n}=await Promise.resolve().then(()=>require("./copy-DPm116om.cjs"));n(r,t)}catch(e){if(n){d.warn(`镜像源克隆失败,正在尝试通过 GitHub 官方源重试...`);let e=a?`git clone --progress --depth 1 -b ${a} ${o} ${r}`:`git clone --progress --depth 1 ${o} ${r}`;try{await re(e,d,r);let n=((Date.now()-m)/1e3).toFixed(1);d.succeed(n);let{copyDir:i}=await Promise.resolve().then(()=>require("./copy-DPm116om.cjs"));i(r,t)}catch(e){throw d.fail(e.message,`💡 建议:当前网络可能存在异常,您可以运行 "vii speed" 测试最新镜像延迟,或运行 "vii mirror add" 添加其他加速源。`),Error(`下载模版失败。\n1. 请检查您的网络连接或代理设置;\n2. 请确保已在本地安装 git命令;\n3. 请确认模板仓库地址及分支有效 (${o}${a?` (分支: ${a})`:``})。\n\n具体错误: ${e.message}`)}}else throw d.fail(e.message,`💡 建议:当前网络可能存在异常,您可以运行 "vii speed" 测试最新镜像延迟,或运行 "vii mirror add" 添加其他加速源。`),Error(`下载模版失败。\n1. 请检查您的网络连接或代理设置;\n2. 请确保已在本地安装 git命令;\n3. 请确认模板仓库地址及分支有效 (${o}${a?` (分支: ${a})`:``})。\n\n具体错误: ${e.message}`)}finally{try{(0,f.execSync)(`rm -rf ${r}`)}catch{}}}const A={info(e){console.log(`\x1b[36mℹ️ ${e}\x1b[0m`)},success(e){console.log(`\x1b[32m✅ ${e}\x1b[0m`)},error(e){console.error(`\x1b[31m❌ ${e}\x1b[0m`)},warn(e){console.warn(`\x1b[33m⚠️ ${e}\x1b[0m`)}};async function ae(e){let{projectName:t,template:n,targetDir:r,force:i=!1,mirror:a}=e,o=x(r);if(!y(t))throw Error(`无效的项目名: ${t}`);let s=b(o,i);if(!s.valid)throw Error(s.error);_(o)||v(o),await ie(n,o,a),A.success(`项目 ${t} 已创建在 ${o}`)}async function oe(){let{name:e}=await(0,h.default)({type:`text`,name:`name`,message:`项目名称:`,validate:e=>y(e)||`无效的项目名(需符合 NPM 包名规范)`});return e}const j=[{name:`vue-pc`,value:`github:vfiee/project-boilerplate#vue-pc`,description:`Vue 3 PC Template`},{name:`vue-mobile`,value:`github:vfiee/project-boilerplate#vue-mobile`,description:`Vue 3 Mobile Template`},{name:`nest-ts`,value:`github:vfiee/project-boilerplate#nest-ts`,description:`NestJS TypeScript Template`},{name:`uniapp-ts`,value:`github:vfiee/project-boilerplate#uniapp-ts`,description:`uni-app TypeScript Template`}];async function se(){let{template:e}=await(0,h.default)({type:`select`,name:`template`,message:`选择模板:`,choices:[...j.map(e=>({value:e.value,title:`${e.name} - ${e.description}`})),{value:`custom`,title:`自定义 GitHub 仓库地址`}]});if(e===`custom`){let{customUrl:e}=await(0,h.default)({type:`text`,name:`customUrl`,message:`请输入 GitHub 仓库地址 (例如: user/repo#branch 或 完整 git 链接):`,validate:e=>e.trim().length>0?!0:`输入不能为空`});return e?e.trim():``}return e}const ce=T(),le=[`http_proxy`,`https_proxy`,`HTTP_PROXY`,`HTTPS_PROXY`,`all_proxy`,`ALL_PROXY`,`no_proxy`,`NO_PROXY`];async function ue(e,t=`https://github.com/vuejs/vue.git`){let n={};for(let e of le)n[e]=process.env[e],delete process.env[e];try{let{applyGithubMirror:n}=await Promise.resolve().then(()=>te),r=`${n(t,e).replace(/\.git$/,``).replace(/\/$/,``)}/info/refs?service=git-upload-pack`,i=new AbortController,a=setTimeout(()=>i.abort(),2e3),o=Date.now(),s=!1;try{s=(await fetch(r,{method:`GET`,signal:i.signal})).ok}finally{clearTimeout(a)}return s?Date.now()-o:-1}catch{return-1}finally{for(let e of le)n[e]!==void 0&&(process.env[e]=n[e])}}async function de(){console.log(`
⚡️ 正在测试 GitHub 镜像源延迟 (不使用代理)...`);let e=await Promise.all(ce.map(e=>ue(e.value))),t=-1,n=1/0;for(let r=0;r<e.length;r++){let i=e[r];i>0&&i<n&&(n=i,t=r)}let r=ce.map((n,r)=>{let i=e[r],a=i>0?`${i}ms`:`超时/不可达`,o=r===t?` [推荐]`:``;return{value:n.value,title:`${n.name} (${a})${o}`}});r.push({value:`custom`,title:`自定义 GitHub 镜像源地址`});let{mirror:i}=await(0,h.default)({type:`select`,name:`mirror`,message:`选择 GitHub 镜像源:`,choices:r});if(i===`custom`){let{customMirror:e}=await(0,h.default)({type:`text`,name:`customMirror`,message:`请输入自定义 GitHub 镜像地址 (例如: https://kkgithub.com):`,validate:e=>{let t=e.trim();if(!t)return`输入不能为空`;try{return new URL(t),!0}catch{return`请输入有效的 URL 地址`}}});return e?e.trim():``}return i===`https://github.com`?``:i||``}const fe={name:`init`,description:`创建新项目`,async action(e){let t=!e.projectName||!e.template,n=e.projectName??await oe();if(!n){console.log(`
⚠️ 操作已取消。`);return}let r=e.template;if(r){let e=j.find(e=>e.name===r);e&&(r=e.value)}else r=await se();if(!r){console.log(`
⚠️ 操作已取消。`);return}let i=e.mirror;!i&&t&&(i=await de());let a=e.targetDir??x(`./${n}`),o=e.force??!1;await ae({projectName:n,template:r,targetDir:a,force:o,mirror:i})}};function pe(e){return/^@[\w-]+\/[\w-]+$/.test(e)||/^[\w-]+$/.test(e)?{valid:!0}:e.startsWith(`@`)&&!e.includes(`/`)?{valid:!1,error:`scoped 包名格式应为 @scope/name`}:{valid:!1,error:`包名只能包含字母、数字、- 和 _`}}function me(e=process.cwd()){let t=(0,d.resolve)(e,`package.json`);if(!(0,u.existsSync)(t))throw Error(`未找到 package.json,请在项目根目录执行`);let n=(0,u.readFileSync)(t,`utf-8`),r=JSON.parse(n),i=pe(r.name);if(!i.valid)throw Error(`包名 "${r.name}" 格式不正确: ${i.error}`);return{name:r.name,version:r.version,path:t}}function he(e,t){let n=(0,d.resolve)(e,`package.json`);if(!(0,u.existsSync)(n))throw Error(`未找到 package.json,请确认路径是否正确`);let r=(0,u.readFileSync)(n,`utf-8`),i=JSON.parse(r);i.version=t,(0,u.writeFileSync)(n,JSON.stringify(i,null,2)+`
`,`utf-8`)}var M=o(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),N=o(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),P=o(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=M(),a=N();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),F=o(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),ge=o(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),I=o(((e,t)=>{let n=N(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=M(),{safeRe:a,t:o}=P(),s=F(),{compareIdentifiers:c}=ge(),l=(e,t)=>{let n=t.split(`.`);if(n.length>e.length)return!1;for(let t=0;t<n.length;t++)if(c(e[t],n[t])!==0)return!1;return!0};t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];if(n===!1&&(r=[t]),l(this.prerelease,t)){let e=this.prerelease[t.split(`.`).length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),L=o(((e,t)=>{let n=I();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),_e=o(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),ve=o(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),ye=o(((e,t)=>{let n=I();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),be=o(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),xe=o(((e,t)=>{let n=I();t.exports=(e,t)=>new n(e,t).major})),Se=o(((e,t)=>{let n=I();t.exports=(e,t)=>new n(e,t).minor})),Ce=o(((e,t)=>{let n=I();t.exports=(e,t)=>new n(e,t).patch})),we=o(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),R=o(((e,t)=>{let n=I();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Te=o(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(t,e,r)})),Ee=o(((e,t)=>{let n=R();t.exports=(e,t)=>n(e,t,!0)})),z=o(((e,t)=>{let n=I();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),De=o(((e,t)=>{let n=z();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),Oe=o(((e,t)=>{let n=z();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),B=o(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)>0})),V=o(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)<0})),ke=o(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)===0})),Ae=o(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)!==0})),H=o(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)>=0})),U=o(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)<=0})),je=o(((e,t)=>{let n=ke(),r=Ae(),i=B(),a=H(),o=V(),s=U();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Me=o(((e,t)=>{let n=I(),r=L(),{safeRe:i,t:a}=P();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),Ne=o(((e,t)=>{let n=L(),r=M(),i=I(),a=(e,t,n)=>{if(!r.RELEASE_TYPES.includes(t))return null;let i=o(e,n);return i&&s(i,t)},o=(e,t)=>n(e instanceof i?e.version:e,t),s=(e,t)=>{if(c(t))return e.version;switch(e.prerelease=[],t){case`major`:e.minor=0,e.patch=0;break;case`minor`:e.patch=0;break}return e.format()},c=e=>e.startsWith(`pre`);t.exports=a})),Pe=o(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),W=o(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!_(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(g,``);let t=((this.options.includePrerelease&&m)|(this.options.loose&&h))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];e=e.replace(s,O(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[u.COMPARATORTRIM],d),o(`comparator trim`,e),e=e.replace(c[u.TILDETRIM],f),o(`tilde trim`,e),e=e.replace(c[u.CARETTRIM],p),o(`caret trim`,e);let l=e.split(` `).map(e=>b(e,this.options)).join(` `).split(/\s+/).map(e=>D(e,this.options));i&&(l=l.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[u.COMPARATORLOOSE])))),o(`range list`,l);let v=new Map,y=l.map(e=>new a(e,this.options));for(let e of y){if(_(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let x=[...v.values()];return r.set(t,x),x}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>y(e,n)&&t.set.some(t=>y(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(k(this.set[t],e,this.options))return!0;return!1}};let r=new(Pe()),i=F(),a=G(),o=N(),s=I(),{safeRe:c,src:l,t:u,comparatorTrimReplace:d,tildeTrimReplace:f,caretTrimReplace:p}=P(),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:h}=M(),g=new RegExp(l[u.BUILD],`g`),_=e=>e.value===`<0.0.0-0`,v=e=>e.value===``,y=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},b=(e,t)=>(e=e.replace(c[u.BUILD],``),o(`comp`,e,t),e=w(e,t),o(`caret`,e),e=S(e,t),o(`tildes`,e),e=E(e,t),o(`xrange`,e),e=te(e,t),o(`stars`,e),e),x=e=>!e||e.toLowerCase()===`x`||e===`*`,S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{let n=t.loose?c[u.TILDELOOSE]:c[u.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return x(n)?s=``:x(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:x(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},w=(e,t)=>e.trim().split(/\s+/).map(e=>T(e,t)).join(` `),T=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[u.CARETLOOSE]:c[u.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return x(n)?c=``:x(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:x(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},E=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ee(e,t)).join(` `)),ee=(e,t)=>{e=e.trim();let n=t.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=x(i),u=l||x(a),d=u||x(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},te=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[u.STAR],``)),D=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?u.GTE0PRE:u.GTE0],``)),O=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=x(r)?``:x(i)?`>=${r}.0.0${e?`-0`:``}`:x(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=x(l)?``:x(u)?`<${+l+1}.0.0-0`:x(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),k=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),G=o(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=F(),{safeRe:i,t:a}=P(),o=je(),s=N(),c=I(),l=W()})),K=o(((e,t)=>{let n=W();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Fe=o(((e,t)=>{let n=W();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),Ie=o(((e,t)=>{let n=I(),r=W();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),Le=o(((e,t)=>{let n=I(),r=W();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Re=o(((e,t)=>{let n=I(),r=W(),i=B();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),ze=o(((e,t)=>{let n=W();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),q=o(((e,t)=>{let n=I(),r=G(),{ANY:i}=r,a=W(),o=K(),s=B(),c=V(),l=U(),u=H();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Be=o(((e,t)=>{let n=q();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Ve=o(((e,t)=>{let n=q();t.exports=(e,t,r)=>n(e,t,`<`,r)})),He=o(((e,t)=>{let n=W();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),Ue=o(((e,t)=>{let n=K(),r=R();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),We=o(((e,t)=>{let n=W(),r=G(),{ANY:i}=r,a=K(),o=R(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!e.test(s.semver))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!e.test(u.semver))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),J=l(o(((e,t)=>{let n=P(),r=M(),i=I(),a=ge();t.exports={parse:L(),valid:_e(),clean:ve(),inc:ye(),diff:be(),major:xe(),minor:Se(),patch:Ce(),prerelease:we(),compare:R(),rcompare:Te(),compareLoose:Ee(),compareBuild:z(),sort:De(),rsort:Oe(),gt:B(),lt:V(),eq:ke(),neq:Ae(),gte:H(),lte:U(),cmp:je(),coerce:Me(),truncate:Ne(),Comparator:G(),Range:W(),satisfies:K(),toComparators:Fe(),maxSatisfying:Ie(),minSatisfying:Le(),minVersion:Re(),validRange:ze(),outside:q(),gtr:Be(),ltr:Ve(),intersects:He(),simplifyRange:Ue(),subset:We(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),1);function Y(e,t,n){let r=e;return t===`custom`||([`patch`,`minor`,`major`].includes(t)?r=J.default.inc(e,t)??e:J.default.valid(t)&&(r=t)),n&&J.default.valid(r)&&(r=J.default.inc(r,`prerelease`,n)??r),r}function Ge(e){return J.default.valid(e)!==null}function Ke(e){let t=(0,d.join)(e,`packages`);if(!(0,u.existsSync)(t))return[];try{return(0,u.readdirSync)(t,{withFileTypes:!0}).filter(e=>e.isDirectory()).filter(e=>(0,u.existsSync)((0,d.join)(t,e.name,`package.json`))).map(e=>(0,d.join)(t,e.name))}catch{return[]}}async function qe(e){let t=Ke(e);if(t.length===0)return(0,u.existsSync)((0,d.join)(e,`package.json`))?[e]:(console.error(`❌ 未找到可发布的包,请确保项目根目录有 package.json 或 packages/ 目录下有子包`),null);let{selected:n}=await(0,h.default)({type:`multiselect`,name:`selected`,message:`选择要发布的包:`,choices:[{value:`__all__`,title:`全部包`,description:`发布 packages 下的所有包`},...t.map(e=>({value:e,title:(0,d.basename)(e),description:e}))]});return!n||n.length===0?(console.log(`已取消发布`),null):n.includes(`__all__`)?t:n}async function Je(e){let t={patch:Y(e,`patch`),minor:Y(e,`minor`),major:Y(e,`major`)},{type:n}=await(0,h.default)({type:`select`,name:`type`,message:`选择版本类型:`,choices:[{value:`patch`,title:`Patch (bugfix) → ${t.patch}`,description:`向后兼容的 bug 修复`},{value:`minor`,title:`Minor (新功能) → ${t.minor}`,description:`向后兼容的新功能`},{value:`major`,title:`Major (破坏性更新) → ${t.major}`,description:`不兼容的 API 变更`},{value:`custom`,title:`自定义版本号`}]});if(!n)return console.log(`已取消发布`),null;if(n===`custom`){let{version:t}=await(0,h.default)({type:`text`,name:`version`,message:`输入版本号:`,hint:e,initial:``});return t||(console.log(`已取消发布`),null)}return n}async function Ye(e){let{message:t}=await(0,h.default)({type:`text`,name:`message`,message:`输入 commit message:`,initial:e});return t||(console.log(`已取消发布`),null)}async function Xe(e,t){let{confirm:n}=await(0,h.default)({type:`confirm`,name:`confirm`,message:`确认发布 ${e}@${t}?`,initial:!0});return n}function X(e){return(0,f.execSync)(`git ${e}`,{encoding:`utf-8`,stdio:`pipe`})}function Ze(e,t){process.stdout.write(`⏳ ${t}...`);let n=Date.now();try{let r=(0,f.execSync)(`git ${e}`,{encoding:`utf-8`,stdio:`pipe`}),i=((Date.now()-n)/1e3).toFixed(1);return console.log(`\r✅ ${t} (${i}s)\n`),r}catch(e){throw console.log(`\r❌ ${t} 失败\n`),e}}function Qe(){try{return(0,f.execSync)(`git rev-parse --is-inside-work-tree`,{stdio:`pipe`}),!0}catch{return!1}}function $e(){try{return Qe()?X(`status --porcelain`).trim().length>0:!1}catch{return!1}}function et(){try{return X(`remote get-url origin`).trim().length>0}catch{return!1}}function tt(e=`.`){try{X(`add ${e}`)}catch{throw Error(`git add 失败,请检查文件权限`)}}function nt(e){try{X(`commit -m "${e}"`)}catch{throw Error(`git commit 失败,请确认已配置用户名和邮箱`)}}function rt(e){try{X(`tag ${e}`)}catch{throw Error(`git tag 失败,标签名可能已存在`)}}function it(e=3){for(let t=0;t<e;t++)try{Ze(`push --follow-tags`,`Git push with tags (${t+1}/${e})`);return}catch{if(t===e-1)throw Error(`git push --follow-tags 失败,请检查网络或 remote 配置`);console.log(`⚠️ push --follow-tags 失败,${t+1} 秒后重试...\n`),at(t+1)}}function at(e){let t=Date.now()+e*1e3;for(;Date.now()<t;);}function ot(e){try{X(`tag -d ${e}`)}catch{throw Error(`本地删除 Tag 失败: ${e}`)}}function st(e){try{X(`reset --hard ${e}`)}catch{throw Error(`本地 reset --hard 失败: ${e}`)}}function ct(e){try{X(`push origin :refs/tags/${e}`)}catch{throw Error(`从远端删除 Tag 失败: ${e}`)}}async function lt(){if(!Qe()){let{action:e}=await(0,h.default)({type:`select`,name:`action`,message:`⚠️ 当前目录未检测到 Git 仓库,请选择操作:`,choices:[{value:`init`,title:`🔧 初始化 Git 仓库并继续发布`},{value:`cancel`,title:`❌ 取消发布`}]});if(e===`init`){let{success:e}=await ut();if(!e)throw Error(`Git init 失败,请检查目录权限`)}}if(et()||(console.log(`⚠️ 未设置 remote,无法推送`),process.exit(1)),$e()){let{action:e}=await(0,h.default)({type:`select`,name:`action`,message:`⚠️ 检测到未提交的更改,请选择操作:`,choices:[{value:`commit`,title:`📝 提交更改并继续发布`},{value:`stash`,title:`📦 暂存更改并继续发布`},{value:`cancel`,title:`❌ 取消发布`}]});if((e===`cancel`||!e)&&process.exit(0),e===`stash`){let{success:e}=await dt();if(!e)throw Error(`git stash 失败,请检查工作区状态`)}if(e===`commit`){let{message:e}=await(0,h.default)({type:`text`,name:`message`,message:`输入提交信息:`,initial:`chore: release`});e||process.exit(0),tt(),nt(e)}}}async function ut(){try{let{execSync:e}=await import(`node:child_process`);return e(`git init`,{stdio:`pipe`}),{success:!0}}catch{return{success:!1}}}async function dt(){try{let{execSync:e}=await import(`node:child_process`);return e(`git stash`,{stdio:`pipe`}),{success:!0}}catch{return{success:!1}}}function ft(e,t){try{return(0,f.execSync)(`npm view ${e}@${t} version`,{stdio:`pipe`}),!0}catch{return!1}}async function pt(e,t=3){let n=process.env.NPM_OTP||``;for(let r=0;r<t;r++){let i=n?`npm publish --otp=${n}`:`npm publish`;try{console.log(`📦 正在发布到 npm (${r+1}/${t})...`),(0,f.execSync)(i,{cwd:e,stdio:[`inherit`,`inherit`,`pipe`]}),console.log(`✅ npm publish 完成 (${r+1}/${t})\n`);return}catch(e){let i=e.stderr?e.stderr.toString():``,a=e.message||``;if(i.includes(`EOTP`)||i.includes(`one-time password`)||i.includes(`Two-factor authentication`)||i.includes(`2fa`)||a.includes(`EOTP`)||a.includes(`one-time password`)||a.includes(`Two-factor authentication`)||a.includes(`2fa`)){console.log(`
⚠️ 检测到 npm 账户已开启 2FA (双重身份验证)`);let{otp:e}=await(0,h.default)({type:`text`,name:`otp`,message:`请输入您的 OTP 动态验证码 (6位数字):`,validate:e=>/^\d{6}$/.test(e)?!0:`请输入有效的 6 位数字验证码`});if(e){n=e,r--;continue}else throw Error(`发布取消:未提供 OTP 验证码`)}if(e.stderr&&process.stderr.write(e.stderr),r===t-1)throw Error(`npm publish 失败,请确认已登录 npm(npm login)且 OTP 验证码正确`);console.log(`⚠️ npm publish 失败,${r+1} 秒后重试...\n`),mt(r+1)}}}function mt(e){let t=Date.now()+e*1e3;for(;Date.now()<t;);}function Z(){try{let e=(0,f.execSync)(`git remote get-url origin`,{encoding:`utf-8`,stdio:`pipe`}).trim(),t=e.match(/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(t)return{owner:t[1],repo:t[2].replace(/\.git$/,``)};let n=e.match(/github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/);return n?{owner:n[1],repo:n[2].replace(/\.git$/,``)}:null}catch{return null}}async function ht(e,t,n={}){let r=Z();if(!r)throw Error(`无法获取 GitHub remote 信息`);let i=n.owner||r.owner,a=n.repo||r.repo,o=n.token||process.env.GITHUB_TOKEN;if(!o)throw Error(`未设置 GITHUB_TOKEN 环境变量`);let s=!!n.draft,c=!!n.prerelease;try{let n=(0,f.execSync)(`curl -s -w "\\n%{http_code}" -X POST \
-H "Authorization: Bearer ${o}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
-d '${JSON.stringify({tag_name:e,name:e,body:t,draft:s,prerelease:c}).replace(/'/g,`'"'"'`)}' \
https://api.github.com/repos/${i}/${a}/releases`,{encoding:`utf-8`}).trim().split(`
`),r=parseInt(n[n.length-1],10),l=n.slice(0,-1).join(`
`);if(r<200||r>=300)throw Error(`HTTP ${r}: ${l}`)}catch(e){throw Error(`创建 GitHub Release 失败: ${e.message}`)}}function gt(e,t){let n=new Date().toISOString().split(`T`)[0],r=`# ${e} v${t}\n\n`;r+=`**发布日期:** ${n}\n\n`;try{let e=(0,f.execSync)(`git describe --tags --abbrev=0 2>/dev/null || echo ''`,{encoding:`utf-8`,stdio:`pipe`}).trim();if(e){let t=(0,f.execSync)(`git log ${e}..HEAD --pretty=format:"%s|%h"`,{encoding:`utf-8`,stdio:`pipe`}).trim();if(t){let e=_t(t.split(`
`).filter(Boolean));e.features.length>0&&(r+=`## ✨ 新功能
`,r+=e.features.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.fixes.length>0&&(r+=`## 🐛 Bug 修复
`,r+=e.fixes.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.breaking.length>0&&(r+=`## ⚠️ 破坏性变更
`,r+=e.breaking.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.other.length>0&&(r+=`## 其他变更
`,r+=e.other.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`)}}}catch{}return r}function _t(e){let t={features:[],fixes:[],breaking:[],other:[]};for(let n of e){let[e,r]=n.split(`|`);if(!e||!r)continue;let i=e.toLowerCase(),a={message:e,hash:r};i.startsWith(`feat`)||i.startsWith(`feature`)||i.startsWith(`新增`)?t.features.push(a):i.startsWith(`fix`)||i.startsWith(`bug`)||i.startsWith(`修复`)?t.fixes.push(a):i.includes(`breaking`)||i.includes(`破坏`)||e.includes(`!`)?t.breaking.push(a):t.other.push(a)}return t}function vt(e,t){let n=new Date().toISOString().split(`T`)[0],r=``;try{let e=(0,f.execSync)(`git describe --tags --abbrev=0 2>/dev/null || echo ''`,{encoding:`utf-8`,stdio:`pipe`}).trim(),t=``;if(t=e?(0,f.execSync)(`git log ${e}..HEAD --pretty=format:"%s|%h"`,{encoding:`utf-8`,stdio:`pipe`}).trim():(0,f.execSync)(`git log --pretty=format:"%s|%h"`,{encoding:`utf-8`,stdio:`pipe`}).trim(),t){let e=_t(t.split(`
`).filter(Boolean));e.features.length>0&&(r+=`### ✨ Features
`+e.features.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.fixes.length>0&&(r+=`### 🐛 Bug Fixes
`+e.fixes.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.breaking.length>0&&(r+=`### ⚠️ Breaking Changes
`+e.breaking.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.other.length>0&&(r+=`### Other Changes
`+e.other.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`)}}catch{}if(!r.trim())try{r=`- ${(0,f.execSync)(`git log -1 --pretty=format:%s`,{encoding:`utf-8`,stdio:`pipe`}).trim()}\n\n`}catch{r=`- Initial release
`}return`## ${t} (${n})\n\n${r}`}function yt(e,t,n,r){let i=r?(0,d.join)(e,r):(0,d.join)(e,`CHANGELOG.md`),a=vt(t,n);if((0,u.existsSync)(i)){let e=(0,u.readFileSync)(i,`utf-8`);(0,u.writeFileSync)(i,a+`
`+e,`utf-8`)}else{let e=(0,d.dirname)(i);(0,u.existsSync)(e)||(0,u.mkdirSync)(e,{recursive:!0}),(0,u.writeFileSync)(i,`# Changelog\n\n${a}`,`utf-8`)}}const bt=[`.releaserc.json`,`.releaserc.js`,`release.config.js`];async function xt(e=process.cwd()){for(let t of bt){let n=(0,d.join)(e,t);if((0,u.existsSync)(n))try{if(t.endsWith(`.json`)){let e=(0,u.readFileSync)(n,`utf-8`);return JSON.parse(e)}if(t.endsWith(`.js`)){let e=await import((0,g.pathToFileURL)(n).href);return e.default||e}}catch(e){console.warn(`⚠️ 加载配置文件 ${t} 失败:`,e)}}return null}function St(e){let t=[e.patch&&`patch`,e.minor&&`minor`,e.major&&`major`,e.custom&&`custom`].filter(Boolean);if(t.length>1)throw Error(`版本标志互斥,只能选择一个: ${t.join(`, `)}`);if(e.patch)return`patch`;if(e.minor)return`minor`;if(e.major)return`major`;if(e.custom){if(!Ge(e.custom))throw Error(`无效的版本号: ${e.custom}`);return e.custom}return null}async function Ct(e){e.dryRun?console.log(`🔍 [DRY RUN] 跳过 Git 状态检查
`):await lt()}async function wt(e,t){let n=e.package?[e.package]:await qe(t);if(!n||n.length===0)return[];let r=St(e),i=[];for(let t of n){let n=me(t),a=n.name,o=n.version;console.log(`\n${`=`.repeat(50)}`),console.log(`📦 准备发布: ${a}@${o}`),console.log(`=`.repeat(50));let s=r??await Je(o);if(s===null)return console.log(`已取消发布`),[];let c=Y(o,s,e.preRelease);if(console.log(`\n🚀 版本更新: ${a} → ${c}\n`),e.dryRun){console.log(`━━━━━━━━━━━━━━━━━━━━━━━━`),console.log(`🔍 [DRY RUN] 未实际执行更新`),console.log(`━━━━━━━━━━━━━━━━━━━━━━━━
`);continue}if(!e.skipPublish&&ft(a,c))throw Error(`版本 ${c} 已存在于 npm,请使用新版本号`);if(!e.skipConfirm&&!await Xe(a,c))return console.log(`已取消发布`),[];i.push({pkgPath:t,pkgName:a,originalVersion:o,newVersion:c})}return e.dryRun&&i.length===0&&console.log(`
🎉 [DRY RUN] 模拟全部完成!`),i}async function Tt(e,t){for(let n of e)if(he(n.pkgPath,n.newVersion),!t.skipChangelog){let e=t.config?.changelog;console.log(`📝 更新 CHANGELOG...`),yt(n.pkgPath,n.pkgName,n.newVersion,e?.output)}}async function Et(e,t,n){console.log(`
📝 统一提交 Git 并打标签...`);let r=``;if(e.length===1){let{pkgName:n,newVersion:i}=e[0],a=`chore: release ${n}@${i}`;r=t.commitMessage??await Ye(a)??a}else{let n=`chore: release [${e.map(e=>`${e.pkgName}@${e.newVersion}`).join(`, `)}]`;r=t.commitMessage??await Ye(n)??n}tt(`.`),nt(r);let i=e.length===1&&e[0].pkgPath===n,a=[];for(let t of e){let e=i?`v${t.newVersion}`:`${t.pkgName}@${t.newVersion}`;console.log(`🏷️ 打 Git 标签: ${e}`),rt(e),a.push(e)}return{createdTags:a,commitCreated:!0}}async function Dt(e,t,n,r){if(n.skipPush||(console.log(`🚀 推送到 Git 远端...`),it()),!n.skipGithubRelease&&!n.skipPush&&Z()){let t=e.length===1&&e[0].pkgPath===r;for(let r of e){let e=t?`v${r.newVersion}`:`${r.pkgName}@${r.newVersion}`;console.log(`🚀 创建 GitHub Release: ${e}...`),await ht(e,gt(r.pkgName,r.newVersion),n.config?.githubRelease)}}if(!n.skipPublish)if(n.config?.parallel)console.log(`
📦 并行发布到 npm...`),await Promise.all(e.map(async e=>{await pt(e.pkgPath)}));else{console.log(`
📦 串行发布到 npm...`);for(let t of e)await pt(t.pkgPath)}}async function Ot(e,t,n,r){if(console.log(`
⚠️ 正在启动自动回滚程序...`),r&&t.length>0){console.log(`🧹 正在删除远端 Git 标签...`);for(let e of t)try{ct(e),console.log(` ✅ 成功删除远端标签: ${e}`)}catch(t){console.error(` ❌ 删除远端标签 ${e} 失败:`,Q(t))}}if(t.length>0){console.log(`🧹 正在删除本地 Git 标签...`);for(let e of t)try{ot(e),console.log(` ✅ 成功删除本地标签: ${e}`)}catch(t){console.error(` ❌ 删除本地标签 ${e} 失败:`,Q(t))}}let i=!1;if(n){console.log(`🧹 正在撤销本地 Git 提交...`);try{st(`HEAD~1`),console.log(` ✅ 本地 Git 提交已撤销,工作区已重置`),i=!0}catch(e){console.error(` ❌ 撤销本地 Git 提交失败:`,Q(e))}r&&(console.log(`
⚠️ [手动干预提示] 本地提交已撤销,但由于更改已推送到远端分支,请手动执行强制推送以回滚远端提交:`),console.log(` git push origin <当前分支> --force
`))}if(!i&&e.length>0){console.log(`🧹 正在回滚 package.json 中的版本号...`);for(let t of e)try{he(t.pkgPath,t.originalVersion),console.log(` ✅ ${t.pkgName} 的版本已还原为 ${t.originalVersion}`)}catch(e){console.error(` ❌ 还原 ${t.pkgName} 版本失败:`,Q(e))}}console.log(`
🛑 自动回滚完成。
`)}function Q(e){if(!e)return`未知错误`;let t=(typeof e==`string`?e:e.message||String(e)).replace(/^Error:\s*/i,``);return t.includes(`git tag 失败`)||t.includes(`标签名可能已存在`)||t.includes(`tagname already exists`)?`本地 Git Tag 标签已存在。请先删除冲突的标签或使用新的版本号。`:t.includes(`创建 GitHub Release 失败`)||t.includes(`HTTP 404`)||t.includes(`Not Found`)?`GitHub Release 创建失败。请检查您的 GITHUB_TOKEN 是否有效且拥有写入(write)权限。`:t.includes(`npm publish 失败`)||t.includes(`npm login`)?`NPM 发布失败。请确保您已在本地运行 'npm login' 成功登录了有权限 of 账号。`:t.includes(`npm version exists`)||t.includes(`已存在于 npm`)?`该版本号已在 NPM 注册表中发布过,请使用新的版本号。`:t.includes(`Repository rule violations`)||t.includes(`push declined due to repository rule violations`)?`推送失败:触发了 GitHub 仓库保护规则(通常是因为提交中包含敏感的 Token/密码)。`:t}async function kt(e={}){let t=e.cwd??process.cwd(),n=await xt(t),r={...e,...n};r.config=n||void 0;let i=[],a=[],o=!1,s=!1;try{if(await Ct(r),i=await wt(r,t),i.length===0)return;await Tt(i,r);let e=await Et(i,r,t);a=e.createdTags,o=e.commitCreated,await Dt(i,a,r,t),s=!r.skipPush,console.log(`
🎉 全部发布完成!`)}catch(e){let t=Q(e);throw console.error(`
❌ 发布过程中出错:`,t),await Ot(i,a,o,s),Error(t)}}async function At(e={}){await kt(e)}const $=[fe,{name:`release`,description:`发布新版本(类似 bumpp)`,async action(e){await At(e)}},{name:`list`,description:`查看可用的项目模板列表`,async action(){console.log(`
📋 可用项目模板列表:`);for(let e of j)console.log(` - ${e.name.padEnd(8)}: ${e.description} (${e.value})`);console.log()}},{name:`mirror`,description:`GitHub 镜像源管理`,async action(e){let t=e.subcommand||`list`,n=e.args||[];if(t===`list`||t===`ls`){let e=T();console.log(`
📋 已有 GitHub 镜像源列表:`),e.forEach(e=>{let t=e.isBuiltin?`[内置]`:`[自定义]`;console.log(` - ${e.name.padEnd(12)} : ${e.value} ${t}`)}),console.log(``);return}if(t===`speed`){let e=T();console.log(`
⚡️ 开始测试 GitHub 镜像源延迟 (直连,以 vuejs/vue 为参照仓库)...`);let t=await Promise.all(e.map(e=>ue(e.value,`https://github.com/vuejs/vue.git`)));console.log(`
📋 测试结果如下:`);let n=-1,r=1/0;for(let e=0;e<t.length;e++){let i=t[e];i>0&&i<r&&(r=i,n=e)}for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=i.isBuiltin?`[内置]`:`[自定义]`;if(a>0){let e=r===n?` [最快]`:``;console.log(` ✅ ${i.name.padEnd(12)} ${o.padEnd(6)}: ${String(a).padStart(4)}ms${e}`)}else console.log(` ❌ ${i.name.padEnd(12)} ${o.padEnd(6)}: 超时/不可达`)}if(console.log(``),n!==-1){let t=e[n];t.value===`https://github.com`?A.success(`💡 官方源响应最快,无需配置任何镜像加速。`):(A.success(`💡 推荐使用: ${t.name}`),console.log(`👉 配置命令: vii init <dir> -m ${t.value}\n`))}else A.error(`⚠️ 所有镜像源均不可达,请检查您的网络连接。
`);return}if(t===`add`){let e=n[0],t=n[1];(!e||!t)&&(A.error(`❌ 参数错误!请使用: vii mirror add <name> <url>`),process.exit(1));try{new URL(t)}catch{A.error(`❌ 参数错误!无效的镜像 URL: ${t}`),process.exit(1)}let r=T();r.some(t=>t.name.toLowerCase()===e.toLowerCase())&&(A.error(`❌ 添加失败!镜像源名称 "${e}" 已存在。`),process.exit(1)),r.some(e=>e.value.replace(/\/$/,``)===t.replace(/\/$/,``))&&(A.error(`❌ 添加失败!该镜像源 URL 已存在。`),process.exit(1));let i=w();i.push({name:e,value:t}),E(i),A.success(`✅ 成功添加镜像源: ${e} (${t})`);return}if(t===`delete`){let e=n[0];e||(A.error(`❌ 参数错误!请使用: vii mirror delete <name>`),process.exit(1));let t=T().find(t=>t.name.toLowerCase()===e.toLowerCase());t||(A.error(`❌ 未找到镜像源: ${e}`),process.exit(1)),t.isBuiltin&&(A.error(`❌ 权限错误!内置镜像源 "${e}" 不允许删除。`),process.exit(1)),E(w().filter(t=>t.name.toLowerCase()!==e.toLowerCase())),A.success(`✅ 成功删除镜像源: ${e}`);return}A.error(`❌ 未知子命令: ${t}`),process.exit(1)}}];function jt(e,t){let n=Array.from({length:e.length+1},()=>Array(t.length+1).fill(0));for(let t=0;t<=e.length;t++)n[t][0]=t;for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=e.length;r++)for(let i=1;i<=t.length;i++)e[r-1]===t[i-1]?n[r][i]=n[r-1][i-1]:n[r][i]=Math.min(n[r-1][i-1]+1,n[r][i-1]+1,n[r-1][i]+1);return n[e.length][t.length]}async function Mt(e){let t=e.slice(2),n=t[0];if(n===`release`){let e={},n=t.slice(1);for(let t=0;t<n.length;t++){let r=n[t];if(r===`--dry-run`)e.dryRun=!0;else if(r===`--skip-push`)e.skipPush=!0;else if(r===`--skip-publish`)e.skipPublish=!0;else if(r===`--skip-confirm`)e.skipConfirm=!0;else if(r===`--skip-changelog`)e.skipChangelog=!0;else if(r===`--skip-github-release`)e.skipGithubRelease=!0;else if(r===`--patch`||r===`-p`)e.patch=!0;else if(r===`--minor`||r===`-m`)e.minor=!0;else if(r===`--major`)e.major=!0;else if(r===`--custom`){let r=n[t+1];r&&!r.startsWith(`-`)?(e.custom=r,t++):(A.error(`选项 --custom 需要指定版本号`),process.exit(1))}else if(r.startsWith(`--custom=`))e.custom=r.split(`=`)[1];else if(r===`--pre-release`||r===`--prerelease`){let r=n[t+1];r&&[`alpha`,`beta`,`rc`].includes(r)?(e.preRelease=r,t++):(A.error(`选项 --pre-release 需要指定 alpha|beta|rc`),process.exit(1))}else if(r.startsWith(`--pre-release=`)||r.startsWith(`--prerelease=`)){let t=r.split(`=`)[1];[`alpha`,`beta`,`rc`].includes(t)?e.preRelease=t:(A.error(`选项 --pre-release 值必须是 alpha|beta|rc`),process.exit(1))}else r.startsWith(`-`)?(A.error(`不支持的选项: ${r}`),process.exit(1)):(A.error(`不支持的参数: ${r}`),process.exit(1))}let r=$.find(e=>e.name===`release`);if(r){try{await r.action(e)}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}return}}if(n===`list`){let e=t.slice(1);e.length>0&&(A.error(`命令 "list" 不需要任何参数或选项: ${e.join(` `)}`),process.exit(1));let n=$.find(e=>e.name===`list`);if(n){try{await n.action({})}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}return}}if(n===`mirror`){let e=t[1],n=t.slice(2),r=$.find(e=>e.name===`mirror`);if(r){try{await r.action({subcommand:e,args:n})}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}return}}if(n===`init`||n===`create`)t=t.slice(1);else if(n&&!n.startsWith(`-`))for(let e of[`init`,`create`,`release`,`list`,`mirror`])jt(n,e)<=1&&(A.error(`不支持的命令: ${n}。您是不是想输入 "${e}"?`),process.exit(1));let r,i,a,o=!1,s=[];for(let e=0;e<t.length;e++){let n=t[e];if(n===`-h`||n===`--help`||n===`help`)o=!0;else if(n===`-t`||n===`--template`){let i=t[e+1];i&&!i.startsWith(`-`)?(r=i,e++):(A.error(`选项 ${n} 需要指定模板名称`),process.exit(1))}else if(n===`-m`||n===`--mirror`){let r=t[e+1];r&&!r.startsWith(`-`)?(i=r,e++):(A.error(`选项 ${n} 需要指定 GitHub 镜像地址`),process.exit(1))}else n.startsWith(`-`)?(A.error(`不支持的选项: ${n}`),process.exit(1)):s.push(n)}if(s.length>1?(A.error(`不支持的命令或多余的位置参数: ${s[0]}`),process.exit(1)):s.length===1&&(a=s[0]),o){console.log(`Usage: vii [OPTION]... [DIRECTORY]
vii init [OPTION]... [DIRECTORY]
vii create [OPTION]... [DIRECTORY]
Create a new project in JavaScript or TypeScript.
With no arguments, start the CLI in interactive mode.
Commands:
init Create a new project (optional)
create Create a new project (alias for init)
release Release a new version
list List all built-in templates
mirror 管理 GitHub 镜像源 (add/delete/list/speed)
Options:
-t, --template NAME use a specific template
-m, --mirror URL use a specific github mirror for cloning`);return}let c=$.find(e=>e.name===`init`);if(c)try{await c.action({projectName:a,template:r,targetDir:a?`./${a}`:void 0,mirror:i})}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}}const Nt=process.argv;Mt(Nt);
# @vyron/cli
> VII 工具链命令行工具(CLI)。为前端及微服务工程提供快速脚手架初始化、模板定制管理及一键版本发布等工程化支持。
---
## 🌟 核心特性
- **🚀 极速脚手架初始化**:一键生成标准项目模板,省去繁琐的基础配置工作。
- **🛠️ 内置多种精美模板**:原生提供 Vue 3 PC(Vite)、Vue 3 Mobile(Vite)、NestJS、uni-app TS 等丰富模板,均源自统一的模板代码仓库(`project-boilerplate`)分支,保持底层脚手架极简与轻量。
- **🌐 支持自定义 GitHub 仓库**:除了内置模板,用户可随时输入任意公开的 GitHub 地址(支持指定 `#branch`)进行项目拉取,自由度高。
- **⚡ 镜像并发测速(零代理干扰)**:在交互模式下,CLI 自动对国内常用 GitHub 镜像(如 KKGitHub、GitClone 等)发起**不经过系统代理的并发 HEAD 延迟测速**。响应延迟实时呈现在菜单中并自动标识 `[推荐]` 镜像,大幅提升国内克隆速度与成功率。
- **🧹 自动清理 Git 历史痕迹**:克隆模板后,CLI 自动擦除模板本身的 `.git` 元数据,确保项目生成后是干净独立的本地工作树。
- **🛡️ 防呆纠偏与错误捕获**:
- **命令纠偏**:对未知指令或拼写错误(如输入 `releas` 或 `initd`)通过编辑距离算法智能推断并提示正确的命令(例如:`您是不是想输入 "release"?`)。
- **参数界限**:自动拦截未知 Option 或越界的位置参数(例如限制位置参数唯一性),并在终端醒目呈现红色错误信息。
- **📦 一键版本发布**:集成轻量级版本发布控制(功能类似于 bumpp),支持 `--dry-run`、`--release-as` 等,并全自动化构建、修改配置与 NPM 发布。
---
## 💻 安装说明
### 全局安装
```bash
pnpm add -g @vyron/cli
# 或者使用 npm
npm install -g @vyron/cli
```
### 临时运行 (免安装)
```bash
npx @vyron/cli init <your-project-name>
```
---
## 🔄 初始化与镜像管理执行流程图 (Workflow)
```mermaid
graph TD
Start["执行 vii 命令行工具"] --> Command{"识别首个命令参数"}
Command -->|init / create / 无参数| B{"是否交互模式?"}
B -->|否: 命令行指定参数| C["解析项目名/模板/镜像等参数"]
B -->|是: 交互式询问| D["输入项目名称并校验"]
D --> E["选择项目模板"]
E --> E1{"模板是否为自定义?"}
E1 -->|是| E2["手动输入自定义 GitHub 仓库地址"]
E1 -->|否| F["从内置与 ~/.viirc 加载最新镜像源列表"]
E2 --> F
F --> F1["执行并发非代理 HEAD 延迟测速"]
F1 --> G["选择或输入要使用的加速镜像源"]
G --> H["合成最终的 Git 克隆地址"]
C --> H
H --> I["执行 git clone 镜像加速下载"]
I --> J["拷贝至目标目录并擦除 .git 痕迹"]
J --> EndInit["提示项目创建成功"]
Command -->|mirror| MirrorSub{"识别二级子命令"}
MirrorSub -->|无参数 / list / ls| ReadConfig["读取内置源并合并 ~/.viirc"]
ReadConfig --> PrintMirrors["控制台打印已有镜像源列表"]
MirrorSub -->|speed| PingMirrors["并发非代理测速所有镜像源"]
PingMirrors --> PrintSpeed["输出各镜像源延迟及最优推荐"]
MirrorSub -->|add name url| ValidAdd{"校验 URL 且名称不冲突?"}
ValidAdd -->|否| ErrAdd["输出错误信息并退出"]
ValidAdd -->|是| WriteConfig["将新镜像源持久化写入 ~/.viirc"]
WriteConfig --> DoneAdd["提示添加镜像源成功"]
MirrorSub -->|delete name| ValidDel{"是否为内置镜像源?"}
ValidDel -->|是: 不允许删除| ErrDel["输出防呆拦截错误"]
ValidDel -->|否: 自定义镜像| RemoveConfig["从 ~/.viirc 移除该镜像源"]
RemoveConfig --> DoneDel["提示删除镜像源成功"]
```
---
## ⌨️ 常用命令详解
`vii` 提供了一组直观的命令来执行对应动作,格式为 `vii [Command] [Options]`。
### 1. `vii init [DIRECTORY]` 或 `vii create`
创建新的项目工程。如果未传参数,将自动启动交互式引导。
- **位置参数**:
- `DIRECTORY`:目标目录名/项目名称(必须符合 npm 包命名规范)。
- **可用选项**:
- `-t, --template NAME`:指定拉取模板的名称(支持 `vue-pc`, `vue-mobile`, `nest-ts`, `uniapp-ts` 或自定义地址 `github:user/repo#branch`)。
- `-m, --mirror URL`:指定 GitHub 镜像源进行加速(支持如 `https://kkgithub.com`、`https://gitclone.com` 或者是自定义地址)。
- `-f, --force`:当目标目录不为空时强制清空并覆盖。
**示例**:
```bash
# 1. 直接拉取内置 Vue 3 PC 模板,并指定使用 kkgithub 镜像加速
vii init my-app -t vue-pc -m https://kkgithub.com
# 2. 从自定义的 GitHub 仓库及其 release 分支拉取模板
vii init my-app -t github:my-username/my-template#release
# 3. 强制在已有目录中重新初始化
vii init my-app --force
```
---
### 2. `vii list`
列出所有内置的项目模板及其对应的 GitHub 原始分支映射,方便用户查阅。
- 该命令不接受任何参数。
**示例**:
```bash
vii list
```
---
### 2.5 `vii test-mirror` 或 `vii speed`
手动对内置的 GitHub 镜像源进行非代理并发测速,在终端中直观展示延迟报告,并自动推荐最快的源和命令样例。
- 该命令不接受任何参数。
**示例**:
```bash
vii test-mirror
# 或者使用别名
vii speed
```
---
### 2.6 `vii mirror [SUBCOMMAND] [ARGS]`
GitHub 镜像源管理器。支持查看、测速、添加及删除自定义加速镜像,配置会自动持久化在用户家目录的 `~/.viirc` 文件中。在执行交互式初始化时,CLI 会自动拉取最新的内置与自定义镜像供用户选择。
- **子命令**:
- `默认` (不传子命令) 或 `list` / `ls`:展示当前所有的内置和自定义镜像源列表。
- `speed`:对所有已有镜像源进行并发非代理延迟测速,并推荐最快的源。
- `add <name> <url>`:添加自定义镜像源,校验 URL 合法性并防止与已有镜像重名。
- `delete <name>`:删除指定的自定义镜像源(内置镜像如 GitHub、KKGitHub、GitClone 不允许被删除)。
**示例**:
```bash
# 1. 查看当前所有镜像源(含 [内置] 和 [自定义] 标识)
vii mirror
# 或
vii mirror list
# 2. 对所有已有镜像源进行并发测速
vii mirror speed
# 3. 添加一个自定义的 GitHub 镜像加速源
vii mirror add my-mirror https://github.com.cnps.org
# 4. 删除指定的自定义镜像源
vii mirror delete my-mirror
```
---
### 3. `vii release`
一键版本发布工具。帮助您快速修改包版本、生成 Git Tag 并自动发布到 NPM。
- **可用选项**:
- `--dry-run`:只模拟发布过程,不实际写入 package.json,也不执行 git push 或 npm publish。
- `--release-as <version_or_type>`:指定发布版本或升级类型(如 `patch`, `minor`, `major` 或具体的 `1.2.0`)。
- `--skip-push`:跳过执行 `git push` 步骤。
- `--skip-publish`:跳过执行 `npm publish` 步骤。
**示例**:
```bash
# 模拟发布次要版本 (minor)
vii release --release-as minor --dry-run
# 跳过发布到 npm,只在本地更新版本和 git tag
vii release --skip-publish
```
---
## 🛡️ 智能防呆与校验反馈
CLI 拥有健全的参数拦截和拼写报错提醒机制,保证命令行的执行可靠度:
- **未知选项校验**:执行 `vii init my-app --tempalte vue`(由于将 `template` 拼错)会抛出报错:
`❌ 不支持的选项: --tempalte`
- **未知命令模糊匹配**:执行 `vii releas` 拼错命令时,会自动启动编辑距离计算并友好提示:
`❌ 不支持的命令: releas。您是不是想输入 "release"?`
- **多余参数控制**:`vii init my-app extra-arg` 会被检测到有多余的位置参数而安全拦截,防止参数覆盖。
---
## 📄 授权协议
MIT
+88
-58

@@ -1,64 +0,94 @@

import D from"node:fs";import A from"node:path";import Jt from"child_process";import J from"path";import U from"fs";import Ut from"download-git-repo";import Kt from"readline";import Gt from"events";var Zt=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function L(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var j={exports:{}},K,We;function Xt(){if(We)return K;We=1,K=e,e.sync=a;var t=U;function o(l,r){var d=r.pathExt!==void 0?r.pathExt:process.env.PATHEXT;if(!d||(d=d.split(";"),d.indexOf("")!==-1))return!0;for(var i=0;i<d.length;i++){var n=d[i].toLowerCase();if(n&&l.substr(-n.length).toLowerCase()===n)return!0}return!1}function f(l,r,d){return!l.isSymbolicLink()&&!l.isFile()?!1:o(r,d)}function e(l,r,d){t.stat(l,function(i,n){d(i,i?!1:f(n,l,r))})}function a(l,r){return f(t.statSync(l),l,r)}return K}var G,ze;function Qt(){if(ze)return G;ze=1,G=o,o.sync=f;var t=U;function o(l,r,d){t.stat(l,function(i,n){d(i,i?!1:e(n,r))})}function f(l,r){return e(t.statSync(l),r)}function e(l,r){return l.isFile()&&a(l,r)}function a(l,r){var d=l.mode,i=l.uid,n=l.gid,s=r.uid!==void 0?r.uid:process.getuid&&process.getuid(),u=r.gid!==void 0?r.gid:process.getgid&&process.getgid(),m=parseInt("100",8),h=parseInt("010",8),c=parseInt("001",8),p=m|h,g=d&c||d&h&&n===u||d&m&&i===s||d&p&&s===0;return g}return G}var Z,Je;function ei(){if(Je)return Z;Je=1;var t;process.platform==="win32"||Zt.TESTING_WINDOWS?t=Xt():t=Qt(),Z=o,o.sync=f;function o(e,a,l){if(typeof a=="function"&&(l=a,a={}),!l){if(typeof Promise!="function")throw new TypeError("callback not provided");return new Promise(function(r,d){o(e,a||{},function(i,n){i?d(i):r(n)})})}t(e,a||{},function(r,d){r&&(r.code==="EACCES"||a&&a.ignoreErrors)&&(r=null,d=!1),l(r,d)})}function f(e,a){try{return t.sync(e,a||{})}catch(l){if(a&&a.ignoreErrors||l.code==="EACCES")return!1;throw l}}return Z}var X,Ue;function ti(){if(Ue)return X;Ue=1;const t=process.platform==="win32"||process.env.OSTYPE==="cygwin"||process.env.OSTYPE==="msys",o=J,f=t?";":":",e=ei(),a=i=>Object.assign(new Error(`not found: ${i}`),{code:"ENOENT"}),l=(i,n)=>{const s=n.colon||f,u=i.match(/\//)||t&&i.match(/\\/)?[""]:[...t?[process.cwd()]:[],...(n.path||process.env.PATH||"").split(s)],m=t?n.pathExt||process.env.PATHEXT||".EXE;.CMD;.BAT;.COM":"",h=t?m.split(s):[""];return t&&i.indexOf(".")!==-1&&h[0]!==""&&h.unshift(""),{pathEnv:u,pathExt:h,pathExtExe:m}},r=(i,n,s)=>{typeof n=="function"&&(s=n,n={}),n||(n={});const{pathEnv:u,pathExt:m,pathExtExe:h}=l(i,n),c=[],p=y=>new Promise((E,v)=>{if(y===u.length)return n.all&&c.length?E(c):v(a(i));const b=u[y],w=/^".*"$/.test(b)?b.slice(1,-1):b,S=o.join(w,i),x=!w&&/^\.[\\\/]/.test(i)?i.slice(0,2)+S:S;E(g(x,y,0))}),g=(y,E,v)=>new Promise((b,w)=>{if(v===m.length)return b(p(E+1));const S=m[v];e(y+S,{pathExt:h},(x,$)=>{if(!x&&$)if(n.all)c.push(y+S);else return b(y+S);return b(g(y,E,v+1))})});return s?p(0).then(y=>s(null,y),s):p(0)},d=(i,n)=>{n=n||{};const{pathEnv:s,pathExt:u,pathExtExe:m}=l(i,n),h=[];for(let c=0;c<s.length;c++){const p=s[c],g=/^".*"$/.test(p)?p.slice(1,-1):p,y=o.join(g,i),E=!g&&/^\.[\\\/]/.test(i)?i.slice(0,2)+y:y;for(let v=0;v<u.length;v++){const b=E+u[v];try{if(e.sync(b,{pathExt:m}))if(n.all)h.push(b);else return b}catch{}}}if(n.all&&h.length)return h;if(n.nothrow)return null;throw a(i)};return X=r,r.sync=d,X}var k={exports:{}},Ke;function ii(){if(Ke)return k.exports;Ke=1;const t=(o={})=>{const f=o.env||process.env;return(o.platform||process.platform)!=="win32"?"PATH":Object.keys(f).reverse().find(a=>a.toUpperCase()==="PATH")||"Path"};return k.exports=t,k.exports.default=t,k.exports}var Q,Ge;function ri(){if(Ge)return Q;Ge=1;const t=J,o=ti(),f=ii();function e(l,r){const d=l.options.env||process.env,i=process.cwd(),n=l.options.cwd!=null,s=n&&process.chdir!==void 0&&!process.chdir.disabled;if(s)try{process.chdir(l.options.cwd)}catch{}let u;try{u=o.sync(l.command,{path:d[f({env:d})],pathExt:r?t.delimiter:void 0})}catch{}finally{s&&process.chdir(i)}return u&&(u=t.resolve(n?l.options.cwd:"",u)),u}function a(l){return e(l)||e(l,!0)}return Q=a,Q}var V={},Ze;function si(){if(Ze)return V;Ze=1;const t=/([()\][%!^"`<>&|;, *?])/g;function o(e){return e=e.replace(t,"^$1"),e}function f(e,a){return e=`${e}`,e=e.replace(/(?=(\\+?)?)\1"/g,'$1$1\\"'),e=e.replace(/(?=(\\+?)?)\1$/,"$1$1"),e=`"${e}"`,e=e.replace(t,"^$1"),a&&(e=e.replace(t,"^$1")),e}return V.command=o,V.argument=f,V}var ee,Xe;function ni(){return Xe||(Xe=1,ee=/^#!(.*)/),ee}var te,Qe;function oi(){if(Qe)return te;Qe=1;const t=ni();return te=(o="")=>{const f=o.match(t);if(!f)return null;const[e,a]=f[0].replace(/#! ?/,"").split(" "),l=e.split("/").pop();return l==="env"?a:a?`${l} ${a}`:l},te}var ie,et;function li(){if(et)return ie;et=1;const t=U,o=oi();function f(e){const l=Buffer.alloc(150);let r;try{r=t.openSync(e,"r"),t.readSync(r,l,0,150,0),t.closeSync(r)}catch{}return o(l.toString())}return ie=f,ie}var re,tt;function ai(){if(tt)return re;tt=1;const t=J,o=ri(),f=si(),e=li(),a=process.platform==="win32",l=/\.(?:com|exe)$/i,r=/node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;function d(s){s.file=o(s);const u=s.file&&e(s.file);return u?(s.args.unshift(s.file),s.command=u,o(s)):s.file}function i(s){if(!a)return s;const u=d(s),m=!l.test(u);if(s.options.forceShell||m){const h=r.test(u);s.command=t.normalize(s.command),s.command=f.command(s.command),s.args=s.args.map(p=>f.argument(p,h));const c=[s.command].concat(s.args).join(" ");s.args=["/d","/s","/c",`"${c}"`],s.command=process.env.comspec||"cmd.exe",s.options.windowsVerbatimArguments=!0}return s}function n(s,u,m){u&&!Array.isArray(u)&&(m=u,u=null),u=u?u.slice(0):[],m=Object.assign({},m);const h={command:s,args:u,options:m,file:void 0,original:{command:s,args:u}};return m.shell?h:i(h)}return re=n,re}var se,it;function ui(){if(it)return se;it=1;const t=process.platform==="win32";function o(l,r){return Object.assign(new Error(`${r} ${l.command} ENOENT`),{code:"ENOENT",errno:"ENOENT",syscall:`${r} ${l.command}`,path:l.command,spawnargs:l.args})}function f(l,r){if(!t)return;const d=l.emit;l.emit=function(i,n){if(i==="exit"){const s=e(n,r);if(s)return d.call(l,"error",s)}return d.apply(l,arguments)}}function e(l,r){return t&&l===1&&!r.file?o(r.original,"spawn"):null}function a(l,r){return t&&l===1&&!r.file?o(r.original,"spawnSync"):null}return se={hookChildProcess:f,verifyENOENT:e,verifyENOENTSync:a,notFoundError:o},se}var rt;function hi(){if(rt)return j.exports;rt=1;const t=Jt,o=ai(),f=ui();function e(l,r,d){const i=o(l,r,d),n=t.spawn(i.command,i.args,i.options);return f.hookChildProcess(n,i),n}function a(l,r,d){const i=o(l,r,d),n=t.spawnSync(i.command,i.args,i.options);return n.error=n.error||f.verifyENOENTSync(n.status,i),n}return j.exports=e,j.exports.spawn=e,j.exports.sync=a,j.exports._parse=o,j.exports._enoent=f,j.exports}var ci=hi();const di=L(ci);var ne,st;function fi(){if(st)return ne;st=1;function t(e,a){var l=e;a.slice(0,-1).forEach(function(d){l=l[d]||{}});var r=a[a.length-1];return r in l}function o(e){return typeof e=="number"||/^0x[0-9a-f]+$/i.test(e)?!0:/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(e)}function f(e,a){return a==="constructor"&&typeof e[a]=="function"||a==="__proto__"}return ne=function(e,a){a||(a={});var l={bools:{},strings:{},unknownFn:null};typeof a.unknown=="function"&&(l.unknownFn=a.unknown),typeof a.boolean=="boolean"&&a.boolean?l.allBools=!0:[].concat(a.boolean).filter(Boolean).forEach(function(x){l.bools[x]=!0});var r={};function d(x){return r[x].some(function($){return l.bools[$]})}Object.keys(a.alias||{}).forEach(function(x){r[x]=[].concat(a.alias[x]),r[x].forEach(function($){r[$]=[x].concat(r[x].filter(function(O){return $!==O}))})}),[].concat(a.string).filter(Boolean).forEach(function(x){l.strings[x]=!0,r[x]&&[].concat(r[x]).forEach(function($){l.strings[$]=!0})});var i=a.default||{},n={_:[]};function s(x,$){return l.allBools&&/^--[^=]+$/.test($)||l.strings[x]||l.bools[x]||r[x]}function u(x,$,O){for(var C=x,F=0;F<$.length-1;F++){var R=$[F];if(f(C,R))return;C[R]===void 0&&(C[R]={}),(C[R]===Object.prototype||C[R]===Number.prototype||C[R]===String.prototype)&&(C[R]={}),C[R]===Array.prototype&&(C[R]=[]),C=C[R]}var q=$[$.length-1];f(C,q)||((C===Object.prototype||C===Number.prototype||C===String.prototype)&&(C={}),C===Array.prototype&&(C=[]),C[q]===void 0||l.bools[q]||typeof C[q]=="boolean"?C[q]=O:Array.isArray(C[q])?C[q].push(O):C[q]=[C[q],O])}function m(x,$,O){if(!(O&&l.unknownFn&&!s(x,O)&&l.unknownFn(O)===!1)){var C=!l.strings[x]&&o($)?Number($):$;u(n,x.split("."),C),(r[x]||[]).forEach(function(F){u(n,F.split("."),C)})}}Object.keys(l.bools).forEach(function(x){m(x,i[x]===void 0?!1:i[x])});var h=[];e.indexOf("--")!==-1&&(h=e.slice(e.indexOf("--")+1),e=e.slice(0,e.indexOf("--")));for(var c=0;c<e.length;c++){var p=e[c],g,y;if(/^--.+=/.test(p)){var E=p.match(/^--([^=]+)=([\s\S]*)$/);g=E[1];var v=E[2];l.bools[g]&&(v=v!=="false"),m(g,v,p)}else if(/^--no-.+/.test(p))g=p.match(/^--no-(.+)/)[1],m(g,!1,p);else if(/^--.+/.test(p))g=p.match(/^--(.+)/)[1],y=e[c+1],y!==void 0&&!/^(-|--)[^-]/.test(y)&&!l.bools[g]&&!l.allBools&&(!r[g]||!d(g))?(m(g,y,p),c+=1):/^(true|false)$/.test(y)?(m(g,y==="true",p),c+=1):m(g,l.strings[g]?"":!0,p);else if(/^-[^-]+/.test(p)){for(var b=p.slice(1,-1).split(""),w=!1,S=0;S<b.length;S++){if(y=p.slice(S+2),y==="-"){m(b[S],y,p);continue}if(/[A-Za-z]/.test(b[S])&&y[0]==="="){m(b[S],y.slice(1),p),w=!0;break}if(/[A-Za-z]/.test(b[S])&&/-?\d+(\.\d*)?(e-?\d+)?$/.test(y)){m(b[S],y,p),w=!0;break}if(b[S+1]&&b[S+1].match(/\W/)){m(b[S],p.slice(S+2),p),w=!0;break}else m(b[S],l.strings[b[S]]?"":!0,p)}g=p.slice(-1)[0],!w&&g!=="-"&&(e[c+1]&&!/^(-|--)[^-]/.test(e[c+1])&&!l.bools[g]&&(!r[g]||!d(g))?(m(g,e[c+1],p),c+=1):e[c+1]&&/^(true|false)$/.test(e[c+1])?(m(g,e[c+1]==="true",p),c+=1):m(g,l.strings[g]?"":!0,p))}else if((!l.unknownFn||l.unknownFn(p)!==!1)&&n._.push(l.strings._||!o(p)?p:Number(p)),a.stopEarly){n._.push.apply(n._,e.slice(c+1));break}}return Object.keys(i).forEach(function(x){t(n,x.split("."))||(u(n,x.split("."),i[x]),(r[x]||[]).forEach(function($){u(n,$.split("."),i[x])}))}),a["--"]?n["--"]=h.slice():h.forEach(function(x){n._.push(x)}),n},ne}var mi=fi();const pi=L(mi);var W={exports:{}},nt;function gi(){if(nt)return W.exports;nt=1;let t=process||{},o=t.argv||[],f=t.env||{},e=!(f.NO_COLOR||o.includes("--no-color"))&&(!!f.FORCE_COLOR||o.includes("--color")||t.platform==="win32"||(t.stdout||{}).isTTY&&f.TERM!=="dumb"||!!f.CI),a=(d,i,n=d)=>s=>{let u=""+s,m=u.indexOf(i,d.length);return~m?d+l(u,i,n,m)+i:d+u+i},l=(d,i,n,s)=>{let u="",m=0;do u+=d.substring(m,s)+n,m=s+i.length,s=d.indexOf(i,m);while(~s);return u+d.substring(m)},r=(d=e)=>{let i=d?a:()=>String;return{isColorSupported:d,reset:i("\x1B[0m","\x1B[0m"),bold:i("\x1B[1m","\x1B[22m","\x1B[22m\x1B[1m"),dim:i("\x1B[2m","\x1B[22m","\x1B[22m\x1B[2m"),italic:i("\x1B[3m","\x1B[23m"),underline:i("\x1B[4m","\x1B[24m"),inverse:i("\x1B[7m","\x1B[27m"),hidden:i("\x1B[8m","\x1B[28m"),strikethrough:i("\x1B[9m","\x1B[29m"),black:i("\x1B[30m","\x1B[39m"),red:i("\x1B[31m","\x1B[39m"),green:i("\x1B[32m","\x1B[39m"),yellow:i("\x1B[33m","\x1B[39m"),blue:i("\x1B[34m","\x1B[39m"),magenta:i("\x1B[35m","\x1B[39m"),cyan:i("\x1B[36m","\x1B[39m"),white:i("\x1B[37m","\x1B[39m"),gray:i("\x1B[90m","\x1B[39m"),bgBlack:i("\x1B[40m","\x1B[49m"),bgRed:i("\x1B[41m","\x1B[49m"),bgGreen:i("\x1B[42m","\x1B[49m"),bgYellow:i("\x1B[43m","\x1B[49m"),bgBlue:i("\x1B[44m","\x1B[49m"),bgMagenta:i("\x1B[45m","\x1B[49m"),bgCyan:i("\x1B[46m","\x1B[49m"),bgWhite:i("\x1B[47m","\x1B[49m"),blackBright:i("\x1B[90m","\x1B[39m"),redBright:i("\x1B[91m","\x1B[39m"),greenBright:i("\x1B[92m","\x1B[39m"),yellowBright:i("\x1B[93m","\x1B[39m"),blueBright:i("\x1B[94m","\x1B[39m"),magentaBright:i("\x1B[95m","\x1B[39m"),cyanBright:i("\x1B[96m","\x1B[39m"),whiteBright:i("\x1B[97m","\x1B[39m"),bgBlackBright:i("\x1B[100m","\x1B[49m"),bgRedBright:i("\x1B[101m","\x1B[49m"),bgGreenBright:i("\x1B[102m","\x1B[49m"),bgYellowBright:i("\x1B[103m","\x1B[49m"),bgBlueBright:i("\x1B[104m","\x1B[49m"),bgMagentaBright:i("\x1B[105m","\x1B[49m"),bgCyanBright:i("\x1B[106m","\x1B[49m"),bgWhiteBright:i("\x1B[107m","\x1B[49m")}};return W.exports=r(),W.exports.createColors=r,W.exports}var bi=gi();const vi=L(bi);var oe={},le,ot;function M(){if(ot)return le;ot=1;const{FORCE_COLOR:t,NODE_DISABLE_COLORS:o,TERM:f}=process.env,e={enabled:!o&&f!=="dumb"&&t!=="0",reset:r(0,0),bold:r(1,22),dim:r(2,22),italic:r(3,23),underline:r(4,24),inverse:r(7,27),hidden:r(8,28),strikethrough:r(9,29),black:r(30,39),red:r(31,39),green:r(32,39),yellow:r(33,39),blue:r(34,39),magenta:r(35,39),cyan:r(36,39),white:r(37,39),gray:r(90,39),grey:r(90,39),bgBlack:r(40,49),bgRed:r(41,49),bgGreen:r(42,49),bgYellow:r(43,49),bgBlue:r(44,49),bgMagenta:r(45,49),bgCyan:r(46,49),bgWhite:r(47,49)};function a(d,i){let n=0,s,u="",m="";for(;n<d.length;n++)s=d[n],u+=s.open,m+=s.close,i.includes(s.close)&&(i=i.replace(s.rgx,s.close+s.open));return u+i+m}function l(d,i){let n={has:d,keys:i};return n.reset=e.reset.bind(n),n.bold=e.bold.bind(n),n.dim=e.dim.bind(n),n.italic=e.italic.bind(n),n.underline=e.underline.bind(n),n.inverse=e.inverse.bind(n),n.hidden=e.hidden.bind(n),n.strikethrough=e.strikethrough.bind(n),n.black=e.black.bind(n),n.red=e.red.bind(n),n.green=e.green.bind(n),n.yellow=e.yellow.bind(n),n.blue=e.blue.bind(n),n.magenta=e.magenta.bind(n),n.cyan=e.cyan.bind(n),n.white=e.white.bind(n),n.gray=e.gray.bind(n),n.grey=e.grey.bind(n),n.bgBlack=e.bgBlack.bind(n),n.bgRed=e.bgRed.bind(n),n.bgGreen=e.bgGreen.bind(n),n.bgYellow=e.bgYellow.bind(n),n.bgBlue=e.bgBlue.bind(n),n.bgMagenta=e.bgMagenta.bind(n),n.bgCyan=e.bgCyan.bind(n),n.bgWhite=e.bgWhite.bind(n),n}function r(d,i){let n={open:`\x1B[${d}m`,close:`\x1B[${i}m`,rgx:new RegExp(`\\x1b\\[${i}m`,"g")};return function(s){return this!==void 0&&this.has!==void 0?(this.has.includes(d)||(this.has.push(d),this.keys.push(n)),s===void 0?this:e.enabled?a(this.keys,s+""):s+""):s===void 0?l([d],[n]):e.enabled?a([n],s+""):s+""}}return le=e,le}var ae,lt;function wi(){return lt||(lt=1,ae=(t,o)=>{if(!(t.meta&&t.name!=="escape")){if(t.ctrl){if(t.name==="a")return"first";if(t.name==="c"||t.name==="d")return"abort";if(t.name==="e")return"last";if(t.name==="g")return"reset"}if(o){if(t.name==="j")return"down";if(t.name==="k")return"up"}return t.name==="return"||t.name==="enter"?"submit":t.name==="backspace"?"delete":t.name==="delete"?"deleteForward":t.name==="abort"?"abort":t.name==="escape"?"exit":t.name==="tab"?"next":t.name==="pagedown"?"nextPage":t.name==="pageup"?"prevPage":t.name==="home"?"home":t.name==="end"?"end":t.name==="up"?"up":t.name==="down"?"down":t.name==="right"?"right":t.name==="left"?"left":!1}}),ae}var ue,at;function he(){return at||(at=1,ue=t=>{const o=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))"].join("|"),f=new RegExp(o,"g");return typeof t=="string"?t.replace(f,""):t}),ue}var ce,ut;function P(){if(ut)return ce;ut=1;const t="\x1B",o=`${t}[`,f="\x07",e={to(r,d){return d?`${o}${d+1};${r+1}H`:`${o}${r+1}G`},move(r,d){let i="";return r<0?i+=`${o}${-r}D`:r>0&&(i+=`${o}${r}C`),d<0?i+=`${o}${-d}A`:d>0&&(i+=`${o}${d}B`),i},up:(r=1)=>`${o}${r}A`,down:(r=1)=>`${o}${r}B`,forward:(r=1)=>`${o}${r}C`,backward:(r=1)=>`${o}${r}D`,nextLine:(r=1)=>`${o}E`.repeat(r),prevLine:(r=1)=>`${o}F`.repeat(r),left:`${o}G`,hide:`${o}?25l`,show:`${o}?25h`,save:`${t}7`,restore:`${t}8`},a={up:(r=1)=>`${o}S`.repeat(r),down:(r=1)=>`${o}T`.repeat(r)},l={screen:`${o}2J`,up:(r=1)=>`${o}1J`.repeat(r),down:(r=1)=>`${o}J`.repeat(r),line:`${o}2K`,lineEnd:`${o}K`,lineStart:`${o}1K`,lines(r){let d="";for(let i=0;i<r;i++)d+=this.line+(i<r-1?e.up():"");return r&&(d+=e.left),d}};return ce={cursor:e,scroll:a,erase:l,beep:f},ce}var de,ht;function xi(){if(ht)return de;ht=1;const t=he(),{erase:o,cursor:f}=P(),e=a=>[...t(a)].length;return de=function(a,l){if(!l)return o.line+f.to(0);let r=0;const d=a.split(/\r?\n/);for(let i of d)r+=1+Math.floor(Math.max(e(i)-1,0)/l);return o.lines(r)},de}var fe,ct;function dt(){if(ct)return fe;ct=1;const t={arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",radioOn:"\u25C9",radioOff:"\u25EF",tick:"\u2714",cross:"\u2716",ellipsis:"\u2026",pointerSmall:"\u203A",line:"\u2500",pointer:"\u276F"},o={arrowUp:t.arrowUp,arrowDown:t.arrowDown,arrowLeft:t.arrowLeft,arrowRight:t.arrowRight,radioOn:"(*)",radioOff:"( )",tick:"\u221A",cross:"\xD7",ellipsis:"...",pointerSmall:"\xBB",line:"\u2500",pointer:">"};return fe=process.platform==="win32"?o:t,fe}var me,ft;function yi(){if(ft)return me;ft=1;const t=M(),o=dt(),f=Object.freeze({password:{scale:1,render:i=>"*".repeat(i.length)},emoji:{scale:2,render:i=>"\u{1F603}".repeat(i.length)},invisible:{scale:0,render:i=>""},default:{scale:1,render:i=>`${i}`}}),e=i=>f[i]||f.default,a=Object.freeze({aborted:t.red(o.cross),done:t.green(o.tick),exited:t.yellow(o.cross),default:t.cyan("?")});return me={styles:f,render:e,symbols:a,symbol:(i,n,s)=>n?a.aborted:s?a.exited:i?a.done:a.default,delimiter:i=>t.gray(i?o.ellipsis:o.pointerSmall),item:(i,n)=>t.gray(i?n?o.pointerSmall:"+":o.line)},me}var pe,mt;function Si(){if(mt)return pe;mt=1;const t=he();return pe=function(o,f){let e=String(t(o)||"").split(/\r?\n/);return f?e.map(a=>Math.ceil(a.length/f)).reduce((a,l)=>a+l):e.length},pe}var ge,pt;function $i(){return pt||(pt=1,ge=(t,o={})=>{const f=Number.isSafeInteger(parseInt(o.margin))?new Array(parseInt(o.margin)).fill(" ").join(""):o.margin||"",e=o.width;return(t||"").split(/\r?\n/g).map(a=>a.split(/\s+/g).reduce((l,r)=>(r.length+f.length>=e||l[l.length-1].length+r.length+1<e?l[l.length-1]+=` ${r}`:l.push(`${f}${r}`),l),[f]).join(`
`)).join(`
`)}),ge}var be,gt;function Ei(){return gt||(gt=1,be=(t,o,f)=>{f=f||o;let e=Math.min(o-f,t-Math.floor(f/2));e<0&&(e=0);let a=Math.min(e+f,o);return{startIndex:e,endIndex:a}}),be}var ve,bt;function T(){return bt||(bt=1,ve={action:wi(),clear:xi(),style:yi(),strip:he(),figures:dt(),lines:Si(),wrap:$i(),entriesToDisplay:Ei()}),ve}var we,vt;function I(){if(vt)return we;vt=1;const t=Kt,{action:o}=T(),f=Gt,{beep:e,cursor:a}=P(),l=M();class r extends f{constructor(i={}){super(),this.firstRender=!0,this.in=i.stdin||process.stdin,this.out=i.stdout||process.stdout,this.onRender=(i.onRender||(()=>{})).bind(this);const n=t.createInterface({input:this.in,escapeCodeTimeout:50});t.emitKeypressEvents(this.in,n),this.in.isTTY&&this.in.setRawMode(!0);const s=["SelectPrompt","MultiselectPrompt"].indexOf(this.constructor.name)>-1,u=(m,h)=>{let c=o(h,s);c===!1?this._&&this._(m,h):typeof this[c]=="function"?this[c](h):this.bell()};this.close=()=>{this.out.write(a.show),this.in.removeListener("keypress",u),this.in.isTTY&&this.in.setRawMode(!1),n.close(),this.emit(this.aborted?"abort":this.exited?"exit":"submit",this.value),this.closed=!0},this.in.on("keypress",u)}fire(){this.emit("state",{value:this.value,aborted:!!this.aborted,exited:!!this.exited})}bell(){this.out.write(e)}render(){this.onRender(l),this.firstRender&&(this.firstRender=!1)}}return we=r,we}var xe,wt;function Ci(){if(wt)return xe;wt=1;const t=M(),o=I(),{erase:f,cursor:e}=P(),{style:a,clear:l,lines:r,figures:d}=T();class i extends o{constructor(s={}){super(s),this.transform=a.render(s.style),this.scale=this.transform.scale,this.msg=s.message,this.initial=s.initial||"",this.validator=s.validate||(()=>!0),this.value="",this.errorMsg=s.error||"Please Enter A Valid Value",this.cursor=+!!this.initial,this.cursorOffset=0,this.clear=l("",this.out.columns),this.render()}set value(s){!s&&this.initial?(this.placeholder=!0,this.rendered=t.gray(this.transform.render(this.initial))):(this.placeholder=!1,this.rendered=this.transform.render(s)),this._value=s,this.fire()}get value(){return this._value}reset(){this.value="",this.cursor=+!!this.initial,this.cursorOffset=0,this.fire(),this.render()}exit(){this.abort()}abort(){this.value=this.value||this.initial,this.done=this.aborted=!0,this.error=!1,this.red=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let s=await this.validator(this.value);typeof s=="string"&&(this.errorMsg=s,s=!1),this.error=!s}async submit(){if(this.value=this.value||this.initial,this.cursorOffset=0,this.cursor=this.rendered.length,await this.validate(),this.error){this.red=!0,this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}next(){if(!this.placeholder)return this.bell();this.value=this.initial,this.cursor=this.rendered.length,this.fire(),this.render()}moveCursor(s){this.placeholder||(this.cursor=this.cursor+s,this.cursorOffset+=s)}_(s,u){let m=this.value.slice(0,this.cursor),h=this.value.slice(this.cursor);this.value=`${m}${s}${h}`,this.red=!1,this.cursor=this.placeholder?0:m.length+1,this.render()}delete(){if(this.isCursorAtStart())return this.bell();let s=this.value.slice(0,this.cursor-1),u=this.value.slice(this.cursor);this.value=`${s}${u}`,this.red=!1,this.isCursorAtStart()?this.cursorOffset=0:(this.cursorOffset++,this.moveCursor(-1)),this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();let s=this.value.slice(0,this.cursor),u=this.value.slice(this.cursor+1);this.value=`${s}${u}`,this.red=!1,this.isCursorAtEnd()?this.cursorOffset=0:this.cursorOffset++,this.render()}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length,this.render()}left(){if(this.cursor<=0||this.placeholder)return this.bell();this.moveCursor(-1),this.render()}right(){if(this.cursor*this.scale>=this.rendered.length||this.placeholder)return this.bell();this.moveCursor(1),this.render()}isCursorAtStart(){return this.cursor===0||this.placeholder&&this.cursor===1}isCursorAtEnd(){return this.cursor===this.rendered.length||this.placeholder&&this.cursor===this.rendered.length+1}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(e.down(r(this.outputError,this.out.columns)-1)+l(this.outputError,this.out.columns)),this.out.write(l(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[a.symbol(this.done,this.aborted),t.bold(this.msg),a.delimiter(this.done),this.red?t.red(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((s,u,m)=>s+`
${m?" ":d.pointerSmall} ${t.red().italic(u)}`,"")),this.out.write(f.line+e.to(0)+this.outputText+e.save+this.outputError+e.restore+e.move(this.cursorOffset,0)))}}return xe=i,xe}var ye,xt;function Oi(){if(xt)return ye;xt=1;const t=M(),o=I(),{style:f,clear:e,figures:a,wrap:l,entriesToDisplay:r}=T(),{cursor:d}=P();class i extends o{constructor(s={}){super(s),this.msg=s.message,this.hint=s.hint||"- Use arrow-keys. Return to submit.",this.warn=s.warn||"- This option is disabled",this.cursor=s.initial||0,this.choices=s.choices.map((u,m)=>(typeof u=="string"&&(u={title:u,value:m}),{title:u&&(u.title||u.value||u),value:u&&(u.value===void 0?m:u.value),description:u&&u.description,selected:u&&u.selected,disabled:u&&u.disabled})),this.optionsPerPage=s.optionsPerPage||10,this.value=(this.choices[this.cursor]||{}).value,this.clear=e("",this.out.columns),this.render()}moveCursor(s){this.cursor=s,this.value=this.choices[s].value,this.fire()}reset(){this.moveCursor(0),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.selection.disabled?this.bell():(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.moveCursor(0),this.render()}last(){this.moveCursor(this.choices.length-1),this.render()}up(){this.cursor===0?this.moveCursor(this.choices.length-1):this.moveCursor(this.cursor-1),this.render()}down(){this.cursor===this.choices.length-1?this.moveCursor(0):this.moveCursor(this.cursor+1),this.render()}next(){this.moveCursor((this.cursor+1)%this.choices.length),this.render()}_(s,u){if(s===" ")return this.submit()}get selection(){return this.choices[this.cursor]}render(){if(this.closed)return;this.firstRender?this.out.write(d.hide):this.out.write(e(this.outputText,this.out.columns)),super.render();let{startIndex:s,endIndex:u}=r(this.cursor,this.choices.length,this.optionsPerPage);if(this.outputText=[f.symbol(this.done,this.aborted),t.bold(this.msg),f.delimiter(!1),this.done?this.selection.title:this.selection.disabled?t.yellow(this.warn):t.gray(this.hint)].join(" "),!this.done){this.outputText+=`
`;for(let m=s;m<u;m++){let h,c,p="",g=this.choices[m];m===s&&s>0?c=a.arrowUp:m===u-1&&u<this.choices.length?c=a.arrowDown:c=" ",g.disabled?(h=this.cursor===m?t.gray().underline(g.title):t.strikethrough().gray(g.title),c=(this.cursor===m?t.bold().gray(a.pointer)+" ":" ")+c):(h=this.cursor===m?t.cyan().underline(g.title):g.title,c=(this.cursor===m?t.cyan(a.pointer)+" ":" ")+c,g.description&&this.cursor===m&&(p=` - ${g.description}`,(c.length+h.length+p.length>=this.out.columns||g.description.split(/\r?\n/).length>1)&&(p=`
`+l(g.description,{margin:3,width:this.out.columns})))),this.outputText+=`${c} ${h}${t.gray(p)}
`}}this.out.write(this.outputText)}}return ye=i,ye}var Se,yt;function Mi(){if(yt)return Se;yt=1;const t=M(),o=I(),{style:f,clear:e}=T(),{cursor:a,erase:l}=P();class r extends o{constructor(i={}){super(i),this.msg=i.message,this.value=!!i.initial,this.active=i.active||"on",this.inactive=i.inactive||"off",this.initialValue=this.value,this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}deactivate(){if(this.value===!1)return this.bell();this.value=!1,this.render()}activate(){if(this.value===!0)return this.bell();this.value=!0,this.render()}delete(){this.deactivate()}left(){this.deactivate()}right(){this.activate()}down(){this.deactivate()}up(){this.activate()}next(){this.value=!this.value,this.fire(),this.render()}_(i,n){if(i===" ")this.value=!this.value;else if(i==="1")this.value=!0;else if(i==="0")this.value=!1;else return this.bell();this.render()}render(){this.closed||(this.firstRender?this.out.write(a.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[f.symbol(this.done,this.aborted),t.bold(this.msg),f.delimiter(this.done),this.value?this.inactive:t.cyan().underline(this.inactive),t.gray("/"),this.value?t.cyan().underline(this.active):this.active].join(" "),this.out.write(l.line+a.to(0)+this.outputText))}}return Se=r,Se}var $e,St;function _(){if(St)return $e;St=1;class t{constructor({token:f,date:e,parts:a,locales:l}){this.token=f,this.date=e||new Date,this.parts=a||[this],this.locales=l||{}}up(){}down(){}next(){const f=this.parts.indexOf(this);return this.parts.find((e,a)=>a>f&&e instanceof t)}setTo(f){}prev(){let f=[].concat(this.parts).reverse();const e=f.indexOf(this);return f.find((a,l)=>l>e&&a instanceof t)}toString(){return String(this.date)}}return $e=t,$e}var Ee,$t;function Pi(){if($t)return Ee;$t=1;const t=_();class o extends t{constructor(e={}){super(e)}up(){this.date.setHours((this.date.getHours()+12)%24)}down(){this.up()}toString(){let e=this.date.getHours()>12?"pm":"am";return/\A/.test(this.token)?e.toUpperCase():e}}return Ee=o,Ee}var Ce,Et;function Ri(){if(Et)return Ce;Et=1;const t=_(),o=e=>(e=e%10,e===1?"st":e===2?"nd":e===3?"rd":"th");class f extends t{constructor(a={}){super(a)}up(){this.date.setDate(this.date.getDate()+1)}down(){this.date.setDate(this.date.getDate()-1)}setTo(a){this.date.setDate(parseInt(a.substr(-2)))}toString(){let a=this.date.getDate(),l=this.date.getDay();return this.token==="DD"?String(a).padStart(2,"0"):this.token==="Do"?a+o(a):this.token==="d"?l+1:this.token==="ddd"?this.locales.weekdaysShort[l]:this.token==="dddd"?this.locales.weekdays[l]:a}}return Ce=f,Ce}var Oe,Ct;function Ti(){if(Ct)return Oe;Ct=1;const t=_();class o extends t{constructor(e={}){super(e)}up(){this.date.setHours(this.date.getHours()+1)}down(){this.date.setHours(this.date.getHours()-1)}setTo(e){this.date.setHours(parseInt(e.substr(-2)))}toString(){let e=this.date.getHours();return/h/.test(this.token)&&(e=e%12||12),this.token.length>1?String(e).padStart(2,"0"):e}}return Oe=o,Oe}var Me,Ot;function qi(){if(Ot)return Me;Ot=1;const t=_();class o extends t{constructor(e={}){super(e)}up(){this.date.setMilliseconds(this.date.getMilliseconds()+1)}down(){this.date.setMilliseconds(this.date.getMilliseconds()-1)}setTo(e){this.date.setMilliseconds(parseInt(e.substr(-this.token.length)))}toString(){return String(this.date.getMilliseconds()).padStart(4,"0").substr(0,this.token.length)}}return Me=o,Me}var Pe,Mt;function Di(){if(Mt)return Pe;Mt=1;const t=_();class o extends t{constructor(e={}){super(e)}up(){this.date.setMinutes(this.date.getMinutes()+1)}down(){this.date.setMinutes(this.date.getMinutes()-1)}setTo(e){this.date.setMinutes(parseInt(e.substr(-2)))}toString(){let e=this.date.getMinutes();return this.token.length>1?String(e).padStart(2,"0"):e}}return Pe=o,Pe}var Re,Pt;function _i(){if(Pt)return Re;Pt=1;const t=_();class o extends t{constructor(e={}){super(e)}up(){this.date.setMonth(this.date.getMonth()+1)}down(){this.date.setMonth(this.date.getMonth()-1)}setTo(e){e=parseInt(e.substr(-2))-1,this.date.setMonth(e<0?0:e)}toString(){let e=this.date.getMonth(),a=this.token.length;return a===2?String(e+1).padStart(2,"0"):a===3?this.locales.monthsShort[e]:a===4?this.locales.months[e]:String(e+1)}}return Re=o,Re}var Te,Rt;function Ii(){if(Rt)return Te;Rt=1;const t=_();class o extends t{constructor(e={}){super(e)}up(){this.date.setSeconds(this.date.getSeconds()+1)}down(){this.date.setSeconds(this.date.getSeconds()-1)}setTo(e){this.date.setSeconds(parseInt(e.substr(-2)))}toString(){let e=this.date.getSeconds();return this.token.length>1?String(e).padStart(2,"0"):e}}return Te=o,Te}var qe,Tt;function Ai(){if(Tt)return qe;Tt=1;const t=_();class o extends t{constructor(e={}){super(e)}up(){this.date.setFullYear(this.date.getFullYear()+1)}down(){this.date.setFullYear(this.date.getFullYear()-1)}setTo(e){this.date.setFullYear(e.substr(-4))}toString(){let e=String(this.date.getFullYear()).padStart(4,"0");return this.token.length===2?e.substr(-2):e}}return qe=o,qe}var De,qt;function ji(){return qt||(qt=1,De={DatePart:_(),Meridiem:Pi(),Day:Ri(),Hours:Ti(),Milliseconds:qi(),Minutes:Di(),Month:_i(),Seconds:Ii(),Year:Ai()}),De}var _e,Dt;function Ni(){if(Dt)return _e;Dt=1;const t=M(),o=I(),{style:f,clear:e,figures:a}=T(),{erase:l,cursor:r}=P(),{DatePart:d,Meridiem:i,Day:n,Hours:s,Milliseconds:u,Minutes:m,Month:h,Seconds:c,Year:p}=ji(),g=/\\(.)|"((?:\\["\\]|[^"])+)"|(D[Do]?|d{3,4}|d)|(M{1,4})|(YY(?:YY)?)|([aA])|([Hh]{1,2})|(m{1,2})|(s{1,2})|(S{1,4})|./g,y={1:({token:b})=>b.replace(/\\(.)/g,"$1"),2:b=>new n(b),3:b=>new h(b),4:b=>new p(b),5:b=>new i(b),6:b=>new s(b),7:b=>new m(b),8:b=>new c(b),9:b=>new u(b)},E={months:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),monthsShort:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),weekdays:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),weekdaysShort:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(",")};class v extends o{constructor(w={}){super(w),this.msg=w.message,this.cursor=0,this.typed="",this.locales=Object.assign(E,w.locales),this._date=w.initial||new Date,this.errorMsg=w.error||"Please Enter A Valid Value",this.validator=w.validate||(()=>!0),this.mask=w.mask||"YYYY-MM-DD HH:mm:ss",this.clear=e("",this.out.columns),this.render()}get value(){return this.date}get date(){return this._date}set date(w){w&&this._date.setTime(w.getTime())}set mask(w){let S;for(this.parts=[];S=g.exec(w);){let $=S.shift(),O=S.findIndex(C=>C!=null);this.parts.push(O in y?y[O]({token:S[O]||$,date:this.date,parts:this.parts,locales:this.locales}):S[O]||$)}let x=this.parts.reduce(($,O)=>(typeof O=="string"&&typeof $[$.length-1]=="string"?$[$.length-1]+=O:$.push(O),$),[]);this.parts.splice(0),this.parts.push(...x),this.reset()}moveCursor(w){this.typed="",this.cursor=w,this.fire()}reset(){this.moveCursor(this.parts.findIndex(w=>w instanceof d)),this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let w=await this.validator(this.value);typeof w=="string"&&(this.errorMsg=w,w=!1),this.error=!w}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}up(){this.typed="",this.parts[this.cursor].up(),this.render()}down(){this.typed="",this.parts[this.cursor].down(),this.render()}left(){let w=this.parts[this.cursor].prev();if(w==null)return this.bell();this.moveCursor(this.parts.indexOf(w)),this.render()}right(){let w=this.parts[this.cursor].next();if(w==null)return this.bell();this.moveCursor(this.parts.indexOf(w)),this.render()}next(){let w=this.parts[this.cursor].next();this.moveCursor(w?this.parts.indexOf(w):this.parts.findIndex(S=>S instanceof d)),this.render()}_(w){/\d/.test(w)&&(this.typed+=w,this.parts[this.cursor].setTo(this.typed),this.render())}render(){this.closed||(this.firstRender?this.out.write(r.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[f.symbol(this.done,this.aborted),t.bold(this.msg),f.delimiter(!1),this.parts.reduce((w,S,x)=>w.concat(x===this.cursor&&!this.done?t.cyan().underline(S.toString()):S),[]).join("")].join(" "),this.error&&(this.outputText+=this.errorMsg.split(`
`).reduce((w,S,x)=>w+`
${x?" ":a.pointerSmall} ${t.red().italic(S)}`,"")),this.out.write(l.line+r.to(0)+this.outputText))}}return _e=v,_e}var Ie,_t;function Fi(){if(_t)return Ie;_t=1;const t=M(),o=I(),{cursor:f,erase:e}=P(),{style:a,figures:l,clear:r,lines:d}=T(),i=/[0-9]/,n=m=>m!==void 0,s=(m,h)=>{let c=Math.pow(10,h);return Math.round(m*c)/c};class u extends o{constructor(h={}){super(h),this.transform=a.render(h.style),this.msg=h.message,this.initial=n(h.initial)?h.initial:"",this.float=!!h.float,this.round=h.round||2,this.inc=h.increment||1,this.min=n(h.min)?h.min:-1/0,this.max=n(h.max)?h.max:1/0,this.errorMsg=h.error||"Please Enter A Valid Value",this.validator=h.validate||(()=>!0),this.color="cyan",this.value="",this.typed="",this.lastHit=0,this.render()}set value(h){!h&&h!==0?(this.placeholder=!0,this.rendered=t.gray(this.transform.render(`${this.initial}`)),this._value=""):(this.placeholder=!1,this.rendered=this.transform.render(`${s(h,this.round)}`),this._value=s(h,this.round)),this.fire()}get value(){return this._value}parse(h){return this.float?parseFloat(h):parseInt(h)}valid(h){return h==="-"||h==="."&&this.float||i.test(h)}reset(){this.typed="",this.value="",this.fire(),this.render()}exit(){this.abort()}abort(){let h=this.value;this.value=h!==""?h:this.initial,this.done=this.aborted=!0,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}async validate(){let h=await this.validator(this.value);typeof h=="string"&&(this.errorMsg=h,h=!1),this.error=!h}async submit(){if(await this.validate(),this.error){this.color="red",this.fire(),this.render();return}let h=this.value;this.value=h!==""?h:this.initial,this.done=!0,this.aborted=!1,this.error=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}up(){if(this.typed="",this.value===""&&(this.value=this.min-this.inc),this.value>=this.max)return this.bell();this.value+=this.inc,this.color="cyan",this.fire(),this.render()}down(){if(this.typed="",this.value===""&&(this.value=this.min+this.inc),this.value<=this.min)return this.bell();this.value-=this.inc,this.color="cyan",this.fire(),this.render()}delete(){let h=this.value.toString();if(h.length===0)return this.bell();this.value=this.parse(h=h.slice(0,-1))||"",this.value!==""&&this.value<this.min&&(this.value=this.min),this.color="cyan",this.fire(),this.render()}next(){this.value=this.initial,this.fire(),this.render()}_(h,c){if(!this.valid(h))return this.bell();const p=Date.now();if(p-this.lastHit>1e3&&(this.typed=""),this.typed+=h,this.lastHit=p,this.color="cyan",h===".")return this.fire();this.value=Math.min(this.parse(this.typed),this.max),this.value>this.max&&(this.value=this.max),this.value<this.min&&(this.value=this.min),this.fire(),this.render()}render(){this.closed||(this.firstRender||(this.outputError&&this.out.write(f.down(d(this.outputError,this.out.columns)-1)+r(this.outputError,this.out.columns)),this.out.write(r(this.outputText,this.out.columns))),super.render(),this.outputError="",this.outputText=[a.symbol(this.done,this.aborted),t.bold(this.msg),a.delimiter(this.done),!this.done||!this.done&&!this.placeholder?t[this.color]().underline(this.rendered):this.rendered].join(" "),this.error&&(this.outputError+=this.errorMsg.split(`
`).reduce((h,c,p)=>h+`
${p?" ":l.pointerSmall} ${t.red().italic(c)}`,"")),this.out.write(e.line+f.to(0)+this.outputText+f.save+this.outputError+f.restore))}}return Ie=u,Ie}var Ae,It;function At(){if(It)return Ae;It=1;const t=M(),{cursor:o}=P(),f=I(),{clear:e,figures:a,style:l,wrap:r,entriesToDisplay:d}=T();class i extends f{constructor(s={}){super(s),this.msg=s.message,this.cursor=s.cursor||0,this.scrollIndex=s.cursor||0,this.hint=s.hint||"",this.warn=s.warn||"- This option is disabled -",this.minSelected=s.min,this.showMinError=!1,this.maxChoices=s.max,this.instructions=s.instructions,this.optionsPerPage=s.optionsPerPage||10,this.value=s.choices.map((u,m)=>(typeof u=="string"&&(u={title:u,value:m}),{title:u&&(u.title||u.value||u),description:u&&u.description,value:u&&(u.value===void 0?m:u.value),selected:u&&u.selected,disabled:u&&u.disabled})),this.clear=e("",this.out.columns),s.overrideRender||this.render()}reset(){this.value.map(s=>!s.selected),this.cursor=0,this.fire(),this.render()}selected(){return this.value.filter(s=>s.selected)}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){const s=this.value.filter(u=>u.selected);this.minSelected&&s.length<this.minSelected?(this.showMinError=!0,this.render()):(this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}first(){this.cursor=0,this.render()}last(){this.cursor=this.value.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.value.length,this.render()}up(){this.cursor===0?this.cursor=this.value.length-1:this.cursor--,this.render()}down(){this.cursor===this.value.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.value[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(s=>s.selected).length>=this.maxChoices)return this.bell();this.value[this.cursor].selected=!0,this.render()}handleSpaceToggle(){const s=this.value[this.cursor];if(s.selected)s.selected=!1,this.render();else{if(s.disabled||this.value.filter(u=>u.selected).length>=this.maxChoices)return this.bell();s.selected=!0,this.render()}}toggleAll(){if(this.maxChoices!==void 0||this.value[this.cursor].disabled)return this.bell();const s=!this.value[this.cursor].selected;this.value.filter(u=>!u.disabled).forEach(u=>u.selected=s),this.render()}_(s,u){if(s===" ")this.handleSpaceToggle();else if(s==="a")this.toggleAll();else return this.bell()}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
Instructions:
${a.arrowUp}/${a.arrowDown}: Highlight option
${a.arrowLeft}/${a.arrowRight}/[space]: Toggle selection
`+(this.maxChoices===void 0?` a: Toggle all
`:"")+" enter/return: Complete answer":""}renderOption(s,u,m,h){const c=(u.selected?t.green(a.radioOn):a.radioOff)+" "+h+" ";let p,g;return u.disabled?p=s===m?t.gray().underline(u.title):t.strikethrough().gray(u.title):(p=s===m?t.cyan().underline(u.title):u.title,s===m&&u.description&&(g=` - ${u.description}`,(c.length+p.length+g.length>=this.out.columns||u.description.split(/\r?\n/).length>1)&&(g=`
`+r(u.description,{margin:c.length,width:this.out.columns})))),c+p+t.gray(g||"")}paginateOptions(s){if(s.length===0)return t.red("No matches for this query.");let{startIndex:u,endIndex:m}=d(this.cursor,s.length,this.optionsPerPage),h,c=[];for(let p=u;p<m;p++)p===u&&u>0?h=a.arrowUp:p===m-1&&m<s.length?h=a.arrowDown:h=" ",c.push(this.renderOption(this.cursor,s[p],p,h));return`
`+c.join(`
`)}renderOptions(s){return this.done?"":this.paginateOptions(s)}renderDoneOrInstructions(){if(this.done)return this.value.filter(u=>u.selected).map(u=>u.title).join(", ");const s=[t.gray(this.hint),this.renderInstructions()];return this.value[this.cursor].disabled&&s.push(t.yellow(this.warn)),s.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(o.hide),super.render();let s=[l.symbol(this.done,this.aborted),t.bold(this.msg),l.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(s+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),s+=this.renderOptions(this.value),this.out.write(this.clear+s),this.clear=e(s,this.out.columns)}}return Ae=i,Ae}var je,jt;function Bi(){if(jt)return je;jt=1;const t=M(),o=I(),{erase:f,cursor:e}=P(),{style:a,clear:l,figures:r,wrap:d,entriesToDisplay:i}=T(),n=(h,c)=>h[c]&&(h[c].value||h[c].title||h[c]),s=(h,c)=>h[c]&&(h[c].title||h[c].value||h[c]),u=(h,c)=>{const p=h.findIndex(g=>g.value===c||g.title===c);return p>-1?p:void 0};class m extends o{constructor(c={}){super(c),this.msg=c.message,this.suggest=c.suggest,this.choices=c.choices,this.initial=typeof c.initial=="number"?c.initial:u(c.choices,c.initial),this.select=this.initial||c.cursor||0,this.i18n={noMatches:c.noMatches||"no matches found"},this.fallback=c.fallback||this.initial,this.clearFirst=c.clearFirst||!1,this.suggestions=[],this.input="",this.limit=c.limit||10,this.cursor=0,this.transform=a.render(c.style),this.scale=this.transform.scale,this.render=this.render.bind(this),this.complete=this.complete.bind(this),this.clear=l("",this.out.columns),this.complete(this.render),this.render()}set fallback(c){this._fb=Number.isSafeInteger(parseInt(c))?parseInt(c):c}get fallback(){let c;return typeof this._fb=="number"?c=this.choices[this._fb]:typeof this._fb=="string"&&(c={title:this._fb}),c||this._fb||{title:this.i18n.noMatches}}moveSelect(c){this.select=c,this.suggestions.length>0?this.value=n(this.suggestions,c):this.value=this.fallback.value,this.fire()}async complete(c){const p=this.completing=this.suggest(this.input,this.choices),g=await p;if(this.completing!==p)return;this.suggestions=g.map((E,v,b)=>({title:s(b,v),value:n(b,v),description:E.description})),this.completing=!1;const y=Math.max(g.length-1,0);this.moveSelect(Math.min(y,this.select)),c&&c()}reset(){this.input="",this.complete(()=>{this.moveSelect(this.initial!==void 0?this.initial:0),this.render()}),this.render()}exit(){this.clearFirst&&this.input.length>0?this.reset():(this.done=this.exited=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close())}abort(){this.done=this.aborted=!0,this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.done=!0,this.aborted=this.exited=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(c,p){let g=this.input.slice(0,this.cursor),y=this.input.slice(this.cursor);this.input=`${g}${c}${y}`,this.cursor=g.length+1,this.complete(this.render),this.render()}delete(){if(this.cursor===0)return this.bell();let c=this.input.slice(0,this.cursor-1),p=this.input.slice(this.cursor);this.input=`${c}${p}`,this.complete(this.render),this.cursor=this.cursor-1,this.render()}deleteForward(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();let c=this.input.slice(0,this.cursor),p=this.input.slice(this.cursor+1);this.input=`${c}${p}`,this.complete(this.render),this.render()}first(){this.moveSelect(0),this.render()}last(){this.moveSelect(this.suggestions.length-1),this.render()}up(){this.select===0?this.moveSelect(this.suggestions.length-1):this.moveSelect(this.select-1),this.render()}down(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}next(){this.select===this.suggestions.length-1?this.moveSelect(0):this.moveSelect(this.select+1),this.render()}nextPage(){this.moveSelect(Math.min(this.select+this.limit,this.suggestions.length-1)),this.render()}prevPage(){this.moveSelect(Math.max(this.select-this.limit,0)),this.render()}left(){if(this.cursor<=0)return this.bell();this.cursor=this.cursor-1,this.render()}right(){if(this.cursor*this.scale>=this.rendered.length)return this.bell();this.cursor=this.cursor+1,this.render()}renderOption(c,p,g,y){let E,v=g?r.arrowUp:y?r.arrowDown:" ",b=p?t.cyan().underline(c.title):c.title;return v=(p?t.cyan(r.pointer)+" ":" ")+v,c.description&&(E=` - ${c.description}`,(v.length+b.length+E.length>=this.out.columns||c.description.split(/\r?\n/).length>1)&&(E=`
`+d(c.description,{margin:3,width:this.out.columns}))),v+" "+b+t.gray(E||"")}render(){if(this.closed)return;this.firstRender?this.out.write(e.hide):this.out.write(l(this.outputText,this.out.columns)),super.render();let{startIndex:c,endIndex:p}=i(this.select,this.choices.length,this.limit);if(this.outputText=[a.symbol(this.done,this.aborted,this.exited),t.bold(this.msg),a.delimiter(this.completing),this.done&&this.suggestions[this.select]?this.suggestions[this.select].title:this.rendered=this.transform.render(this.input)].join(" "),!this.done){const g=this.suggestions.slice(c,p).map((y,E)=>this.renderOption(y,this.select===E+c,E===0&&c>0,E+c===p-1&&p<this.choices.length)).join(`
`);this.outputText+=`
`+(g||t.gray(this.fallback.title))}this.out.write(f.line+e.to(0)+this.outputText)}}return je=m,je}var Ne,Nt;function Yi(){if(Nt)return Ne;Nt=1;const t=M(),{cursor:o}=P(),f=At(),{clear:e,style:a,figures:l}=T();class r extends f{constructor(i={}){i.overrideRender=!0,super(i),this.inputValue="",this.clear=e("",this.out.columns),this.filteredOptions=this.value,this.render()}last(){this.cursor=this.filteredOptions.length-1,this.render()}next(){this.cursor=(this.cursor+1)%this.filteredOptions.length,this.render()}up(){this.cursor===0?this.cursor=this.filteredOptions.length-1:this.cursor--,this.render()}down(){this.cursor===this.filteredOptions.length-1?this.cursor=0:this.cursor++,this.render()}left(){this.filteredOptions[this.cursor].selected=!1,this.render()}right(){if(this.value.filter(i=>i.selected).length>=this.maxChoices)return this.bell();this.filteredOptions[this.cursor].selected=!0,this.render()}delete(){this.inputValue.length&&(this.inputValue=this.inputValue.substr(0,this.inputValue.length-1),this.updateFilteredOptions())}updateFilteredOptions(){const i=this.filteredOptions[this.cursor];this.filteredOptions=this.value.filter(s=>this.inputValue?!!(typeof s.title=="string"&&s.title.toLowerCase().includes(this.inputValue.toLowerCase())||typeof s.value=="string"&&s.value.toLowerCase().includes(this.inputValue.toLowerCase())):!0);const n=this.filteredOptions.findIndex(s=>s===i);this.cursor=n<0?0:n,this.render()}handleSpaceToggle(){const i=this.filteredOptions[this.cursor];if(i.selected)i.selected=!1,this.render();else{if(i.disabled||this.value.filter(n=>n.selected).length>=this.maxChoices)return this.bell();i.selected=!0,this.render()}}handleInputChange(i){this.inputValue=this.inputValue+i,this.updateFilteredOptions()}_(i,n){i===" "?this.handleSpaceToggle():this.handleInputChange(i)}renderInstructions(){return this.instructions===void 0||this.instructions?typeof this.instructions=="string"?this.instructions:`
Instructions:
${l.arrowUp}/${l.arrowDown}: Highlight option
${l.arrowLeft}/${l.arrowRight}/[space]: Toggle selection
[a,b,c]/delete: Filter choices
enter/return: Complete answer
`:""}renderCurrentInput(){return`
Filtered results for: ${this.inputValue?this.inputValue:t.gray("Enter something to filter")}
`}renderOption(i,n,s){let u;return n.disabled?u=i===s?t.gray().underline(n.title):t.strikethrough().gray(n.title):u=i===s?t.cyan().underline(n.title):n.title,(n.selected?t.green(l.radioOn):l.radioOff)+" "+u}renderDoneOrInstructions(){if(this.done)return this.value.filter(n=>n.selected).map(n=>n.title).join(", ");const i=[t.gray(this.hint),this.renderInstructions(),this.renderCurrentInput()];return this.filteredOptions.length&&this.filteredOptions[this.cursor].disabled&&i.push(t.yellow(this.warn)),i.join(" ")}render(){if(this.closed)return;this.firstRender&&this.out.write(o.hide),super.render();let i=[a.symbol(this.done,this.aborted),t.bold(this.msg),a.delimiter(!1),this.renderDoneOrInstructions()].join(" ");this.showMinError&&(i+=t.red(`You must select a minimum of ${this.minSelected} choices.`),this.showMinError=!1),i+=this.renderOptions(this.filteredOptions),this.out.write(this.clear+i),this.clear=e(i,this.out.columns)}}return Ne=r,Ne}var Fe,Ft;function Hi(){if(Ft)return Fe;Ft=1;const t=M(),o=I(),{style:f,clear:e}=T(),{erase:a,cursor:l}=P();class r extends o{constructor(i={}){super(i),this.msg=i.message,this.value=i.initial,this.initialValue=!!i.initial,this.yesMsg=i.yes||"yes",this.yesOption=i.yesOption||"(Y/n)",this.noMsg=i.no||"no",this.noOption=i.noOption||"(y/N)",this.render()}reset(){this.value=this.initialValue,this.fire(),this.render()}exit(){this.abort()}abort(){this.done=this.aborted=!0,this.fire(),this.render(),this.out.write(`
`),this.close()}submit(){this.value=this.value||!1,this.done=!0,this.aborted=!1,this.fire(),this.render(),this.out.write(`
`),this.close()}_(i,n){return i.toLowerCase()==="y"?(this.value=!0,this.submit()):i.toLowerCase()==="n"?(this.value=!1,this.submit()):this.bell()}render(){this.closed||(this.firstRender?this.out.write(l.hide):this.out.write(e(this.outputText,this.out.columns)),super.render(),this.outputText=[f.symbol(this.done,this.aborted),t.bold(this.msg),f.delimiter(this.done),this.done?this.value?this.yesMsg:this.noMsg:t.gray(this.initialValue?this.yesOption:this.noOption)].join(" "),this.out.write(a.line+l.to(0)+this.outputText))}}return Fe=r,Fe}var Be,Bt;function Li(){return Bt||(Bt=1,Be={TextPrompt:Ci(),SelectPrompt:Oi(),TogglePrompt:Mi(),DatePrompt:Ni(),NumberPrompt:Fi(),MultiselectPrompt:At(),AutocompletePrompt:Bi(),AutocompleteMultiselectPrompt:Yi(),ConfirmPrompt:Hi()}),Be}var Yt;function ki(){return Yt||(Yt=1,function(t){const o=t,f=Li(),e=r=>r;function a(r,d,i={}){return new Promise((n,s)=>{const u=new f[r](d),m=i.onAbort||e,h=i.onSubmit||e,c=i.onExit||e;u.on("state",d.onState||e),u.on("submit",p=>n(h(p))),u.on("exit",p=>n(c(p))),u.on("abort",p=>s(m(p)))})}o.text=r=>a("TextPrompt",r),o.password=r=>(r.style="password",o.text(r)),o.invisible=r=>(r.style="invisible",o.text(r)),o.number=r=>a("NumberPrompt",r),o.date=r=>a("DatePrompt",r),o.confirm=r=>a("ConfirmPrompt",r),o.list=r=>{const d=r.separator||",";return a("TextPrompt",r,{onSubmit:i=>i.split(d).map(n=>n.trim())})},o.toggle=r=>a("TogglePrompt",r),o.select=r=>a("SelectPrompt",r),o.multiselect=r=>{r.choices=[].concat(r.choices||[]);const d=i=>i.filter(n=>n.selected).map(n=>n.value);return a("MultiselectPrompt",r,{onAbort:d,onSubmit:d})},o.autocompleteMultiselect=r=>{r.choices=[].concat(r.choices||[]);const d=i=>i.filter(n=>n.selected).map(n=>n.value);return a("AutocompleteMultiselectPrompt",r,{onAbort:d,onSubmit:d})};const l=(r,d)=>Promise.resolve(d.filter(i=>i.title.slice(0,r.length).toLowerCase()===r.toLowerCase()));o.autocomplete=r=>(r.suggest=r.suggest||l,r.choices=[].concat(r.choices||[]),a("AutocompletePrompt",r))}(oe)),oe}var Ye,Ht;function Vi(){if(Ht)return Ye;Ht=1;const t=ki(),o=["suggest","format","onState","validate","onRender","type"],f=()=>{};async function e(d=[],{onSubmit:i=f,onCancel:n=f}={}){const s={},u=e._override||{};d=[].concat(d);let m,h,c,p,g,y;const E=async(v,b,w=!1)=>{if(!(!w&&v.validate&&v.validate(b)!==!0))return v.format?await v.format(b,s):b};for(h of d)if({name:p,type:g}=h,typeof g=="function"&&(g=await g(m,{...s},h),h.type=g),!!g){for(let v in h){if(o.includes(v))continue;let b=h[v];h[v]=typeof b=="function"?await b(m,{...s},y):b}if(y=h,typeof h.message!="string")throw new Error("prompt message is required");if({name:p,type:g}=h,t[g]===void 0)throw new Error(`prompt type (${g}) is not defined`);if(u[h.name]!==void 0&&(m=await E(h,u[h.name]),m!==void 0)){s[p]=m;continue}try{m=e._injected?a(e._injected,h.initial):await t[g](h),s[p]=m=await E(h,m,!0),c=await i(h,m,s)}catch{c=!await n(h,s)}if(c)return s}return s}function a(d,i){const n=d.shift();if(n instanceof Error)throw n;return n===void 0?i:n}function l(d){e._injected=(e._injected||[]).concat(d)}function r(d){e._override=Object.assign({},d)}return Ye=Object.assign(e,{prompt:e,prompts:t,inject:l,override:r}),Ye}var Wi=Vi();const Lt=L(Wi),zi="1.2.4";process.env.NODE_OPTIONS="--no-deprecation";const{green:B,red:Y,reset:H,yellow:He,blue:z,magenta:kt,redBright:Ji}=vi,N=pi(process.argv.slice(2),{default:{help:!1},alias:{h:"help",t:"template",v:"version"},string:["_"]}),Le=process.cwd(),Ui=`Usage: vii [OPTION]... [DIRECTORY]
import{existsSync as e,mkdirSync as t,readFileSync as n,readdirSync as r,rmSync as i,writeFileSync as a}from"node:fs";import*as o from"node:path";import{basename as s,dirname as c,join as l,resolve as u}from"node:path";import{execSync as d,spawn as f}from"node:child_process";import{homedir as p,tmpdir as m}from"node:os";import h from"ora";import g from"prompts";import{pathToFileURL as _}from"node:url";var v=Object.create,y=Object.defineProperty,b=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyNames,ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty,S=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),C=(e,t)=>{let n={};for(var r in e)y(n,r,{get:e[r],enumerable:!0});return t||y(n,Symbol.toStringTag,{value:`Module`}),n},w=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=x(t),a=0,o=i.length,s;a<o;a++)s=i[a],!te.call(e,s)&&s!==n&&y(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=b(t,s))||r.enumerable});return e},ne=(e,t,n)=>(n=e==null?{}:v(ee(e)),w(t||!e||!e.__esModule?y(n,`default`,{value:e,enumerable:!0}):n,e));function T(t){if(!e(t))return!0;let n=r(t);return n.length===0||n.length===1&&n[0]===`.git`}function re(t){if(!e(t))return;let n=r(t);for(let e of n)e!==`.git`&&i(l(t,e),{recursive:!0,force:!0})}function E(e){return e?/^(?:@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(e):!1}function ie(t,n=!1){return e(t)?T(t)||n?{valid:!0}:{valid:!1,error:`目标目录不为空,请使用 --force 覆盖`}:{valid:!0}}function ae(e){return e.replace(/\/+$/,``)}const oe=[{name:`GitHub`,value:`https://github.com`,isBuiltin:!0},{name:`Akams`,value:`https://github.akams.cn`,isBuiltin:!0,cloneStyle:`prefix`},{name:`Gitee`,value:`https://gitee.com/mirrors`,isBuiltin:!0,cloneStyle:`gitee`},{name:`GHProxy`,value:`https://gh-proxy.com`,isBuiltin:!0,cloneStyle:`prefix`},{name:`GHFast`,value:`https://ghfast.top`,isBuiltin:!0,cloneStyle:`prefix`}];function se(){return process.env.TEMP_VIIRC_PATH?process.env.TEMP_VIIRC_PATH:o.join(p(),`.viirc`)}function D(){let t=se();if(!e(t))return[];try{let e=n(t,`utf-8`);return JSON.parse(e).mirrors||[]}catch{return[]}}function O(){let e=D();return[...oe.map(e=>({...e})),...e.map(e=>({...e,isBuiltin:!1}))]}function ce(e){let t=se();try{let n=e.filter(e=>!e.isBuiltin).map(e=>({name:e.name,value:e.value}));a(t,JSON.stringify({mirrors:n},null,2),`utf-8`)}catch(e){throw Error(`写入配置文件失败: ${e.message}`)}}function le(e,t,n){let r=!!process.env.CI,i=!!process.stdout.isTTY&&!r,a=null,o=`正在下载 ${e}${t?` (分支: ${t})`:``}`,s=n?` [通过 ${n} 加速]`:``;i?a=h(`${o}...${s}`).start():console.log(`⌛ ${o}...${s}`);let c=0;return{update(e){let t=Date.now();if(e.percent!==100&&t-c<100)return;c=t;let n=e.percent===void 0?``:` ${e.percent}%`,r=[];e.size&&r.push(e.size),e.speed&&r.push(e.speed);let i=`${o}...${n}${r.length>0?` (${r.join(`, `)})`:``}${s}`;a&&(a.text=i)},warn(e){a?(a.warn(e),a.start()):console.warn(`⚠️ ${e}`)},succeed(t){let n=`下载 ${e} 成功 (耗时 ${t}s)`;a?a.succeed(n):console.log(`✔ ${n}`)},fail(t,n){let r=`下载 ${e} 失败`;a?a.fail(r):console.error(`✖ ${r}`),t&&console.error(`\x1b[31m${t}\x1b[0m`),n&&console.log(`\n\x1b[36m${n}\x1b[0m`)},stop(){a&&a.stop()}}}var ue=C({applyGithubMirror:()=>fe,downloadTemplate:()=>he,getMirrorName:()=>pe,getRepoLabel:()=>k,parseGithubRepo:()=>de});function de(e){let t=e.replace(/\.git$/,``).replace(/\/$/,``).match(/(?:github\.com\/|github:)([^/]+)\/([^/]+)$/);return t?{owner:t[1],repo:t[2]}:null}function fe(e,t){if(!t)return e;let n=t.trim().replace(/\/$/,``),r=O().find(e=>e.value.replace(/\/$/,``)===n)?.cloneStyle??`domain`,i=de(e);if(r===`gitclone`)return i?`https://gitclone.com/github.com/${i.owner}/${i.repo}.git`:`https://gitclone.com/github.com/${e.replace(/^https:\/\/github\.com\//,``)}`;if(r===`prefix`){let t=n.startsWith(`http`)?n:`https://${n}`;return i?`${t}/https://github.com/${i.owner}/${i.repo}.git`:`${t}/${e}`}if(r===`gitee`)return i?`https://gitee.com/mirrors/${i.repo}.git`:e;if(e.startsWith(`https://github.com`)){let t=n.startsWith(`http`)?n:`https://${n}`;return e.replace(`https://github.com`,t)}return e}function k(e){let t=e.replace(/\.git$/,``).replace(/\/$/,``).match(/[:/]([^/]+)\/([^/]+)$/);return t?`${t[1]}/${t[2]}`:`项目模板`}function pe(e){if(!e)return`官方源`;let t=e.trim().replace(/\/$/,``),n=oe.find(e=>e.value.replace(/\/$/,``)===t);if(n)return n.name;try{return new URL(e).hostname}catch{return e}}async function me(e,t,n){return new Promise((r,i)=>{let a=f(e,{shell:!0}),o=setTimeout(()=>{a.kill(`SIGKILL`),i(Error(`Git 克隆操作超时(限时 45 秒)。请检查网络连接或更换镜像源。`))},45e3),s=[];a.stderr.on(`data`,e=>{s.push(e);let n=e.toString(),r=n.match(/(\d+)%/),i=n.match(/([\d.]+)\s*(B|KiB|MiB|GiB)\s*\|\s*([\d.]+)\s*(B|KiB|MiB|GiB)\/s/i),a={};r&&(a.percent=parseInt(r[1],10)),i&&(a.size=`${i[1]} ${i[2]}`,a.speed=`${i[3]} ${i[4]}/s`),Object.keys(a).length>0&&t.update(a)});let c=()=>{a.kill(`SIGKILL`);try{d(`rm -rf ${n}`)}catch{}process.stdout.write(`\x1B[?25h
`),process.exit(130)};process.once(`SIGINT`,c),a.on(`close`,e=>{if(clearTimeout(o),process.off(`SIGINT`,c),e===0)r();else{let t=Buffer.concat(s).toString().trim();i(Error(t||`Git 克隆进程异常退出,状态码: ${e}`))}}),a.on(`error`,e=>{clearTimeout(o),process.off(`SIGINT`,c),i(e)})})}async function he(e,t,n){let r=`${m()}/scaffold-${Date.now()}`,i=e,a;if(e.includes(`#`)){let t=e.split(`#`);i=t[0],a=t[1]}let o=i;i.startsWith(`github:`)&&(o=`https://github.com/${i.slice(7)}.git`);let s=o;n&&(s=fe(o,n));let c=k(o),l=a||``,u=pe(n),f=le(c,l,n?u:``),p=Date.now();try{await me(a?`git clone --progress --depth 1 -b ${a} ${s} ${r}`:`git clone --progress --depth 1 ${s} ${r}`,f,r);let e=((Date.now()-p)/1e3).toFixed(1);f.succeed(e);let{copyDir:n}=await import(`./copy-CsGJSU9I.mjs`);n(r,t)}catch(e){if(n){f.warn(`镜像源克隆失败,正在尝试通过 GitHub 官方源重试...`);let e=a?`git clone --progress --depth 1 -b ${a} ${o} ${r}`:`git clone --progress --depth 1 ${o} ${r}`;try{await me(e,f,r);let n=((Date.now()-p)/1e3).toFixed(1);f.succeed(n);let{copyDir:i}=await import(`./copy-CsGJSU9I.mjs`);i(r,t)}catch(e){throw f.fail(e.message,`💡 建议:当前网络可能存在异常,您可以运行 "vii speed" 测试最新镜像延迟,或运行 "vii mirror add" 添加其他加速源。`),Error(`下载模版失败。\n1. 请检查您的网络连接或代理设置;\n2. 请确保已在本地安装 git命令;\n3. 请确认模板仓库地址及分支有效 (${o}${a?` (分支: ${a})`:``})。\n\n具体错误: ${e.message}`)}}else throw f.fail(e.message,`💡 建议:当前网络可能存在异常,您可以运行 "vii speed" 测试最新镜像延迟,或运行 "vii mirror add" 添加其他加速源。`),Error(`下载模版失败。\n1. 请检查您的网络连接或代理设置;\n2. 请确保已在本地安装 git命令;\n3. 请确认模板仓库地址及分支有效 (${o}${a?` (分支: ${a})`:``})。\n\n具体错误: ${e.message}`)}finally{try{d(`rm -rf ${r}`)}catch{}}}const A={info(e){console.log(`\x1b[36mℹ️ ${e}\x1b[0m`)},success(e){console.log(`\x1b[32m✅ ${e}\x1b[0m`)},error(e){console.error(`\x1b[31m❌ ${e}\x1b[0m`)},warn(e){console.warn(`\x1b[33m⚠️ ${e}\x1b[0m`)}};async function ge(e){let{projectName:t,template:n,targetDir:r,force:i=!1,mirror:a}=e,o=ae(r);if(!E(t))throw Error(`无效的项目名: ${t}`);let s=ie(o,i);if(!s.valid)throw Error(s.error);T(o)||re(o),await he(n,o,a),A.success(`项目 ${t} 已创建在 ${o}`)}async function _e(){let{name:e}=await g({type:`text`,name:`name`,message:`项目名称:`,validate:e=>E(e)||`无效的项目名(需符合 NPM 包名规范)`});return e}const j=[{name:`vue-pc`,value:`github:vfiee/project-boilerplate#vue-pc`,description:`Vue 3 PC Template`},{name:`vue-mobile`,value:`github:vfiee/project-boilerplate#vue-mobile`,description:`Vue 3 Mobile Template`},{name:`nest-ts`,value:`github:vfiee/project-boilerplate#nest-ts`,description:`NestJS TypeScript Template`},{name:`uniapp-ts`,value:`github:vfiee/project-boilerplate#uniapp-ts`,description:`uni-app TypeScript Template`}];async function ve(){let{template:e}=await g({type:`select`,name:`template`,message:`选择模板:`,choices:[...j.map(e=>({value:e.value,title:`${e.name} - ${e.description}`})),{value:`custom`,title:`自定义 GitHub 仓库地址`}]});if(e===`custom`){let{customUrl:e}=await g({type:`text`,name:`customUrl`,message:`请输入 GitHub 仓库地址 (例如: user/repo#branch 或 完整 git 链接):`,validate:e=>e.trim().length>0?!0:`输入不能为空`});return e?e.trim():``}return e}const ye=O(),be=[`http_proxy`,`https_proxy`,`HTTP_PROXY`,`HTTPS_PROXY`,`all_proxy`,`ALL_PROXY`,`no_proxy`,`NO_PROXY`];async function xe(e,t=`https://github.com/vuejs/vue.git`){let n={};for(let e of be)n[e]=process.env[e],delete process.env[e];try{let{applyGithubMirror:n}=await Promise.resolve().then(()=>ue),r=`${n(t,e).replace(/\.git$/,``).replace(/\/$/,``)}/info/refs?service=git-upload-pack`,i=new AbortController,a=setTimeout(()=>i.abort(),2e3),o=Date.now(),s=!1;try{s=(await fetch(r,{method:`GET`,signal:i.signal})).ok}finally{clearTimeout(a)}return s?Date.now()-o:-1}catch{return-1}finally{for(let e of be)n[e]!==void 0&&(process.env[e]=n[e])}}async function Se(){console.log(`
⚡️ 正在测试 GitHub 镜像源延迟 (不使用代理)...`);let e=await Promise.all(ye.map(e=>xe(e.value))),t=-1,n=1/0;for(let r=0;r<e.length;r++){let i=e[r];i>0&&i<n&&(n=i,t=r)}let r=ye.map((n,r)=>{let i=e[r],a=i>0?`${i}ms`:`超时/不可达`,o=r===t?` [推荐]`:``;return{value:n.value,title:`${n.name} (${a})${o}`}});r.push({value:`custom`,title:`自定义 GitHub 镜像源地址`});let{mirror:i}=await g({type:`select`,name:`mirror`,message:`选择 GitHub 镜像源:`,choices:r});if(i===`custom`){let{customMirror:e}=await g({type:`text`,name:`customMirror`,message:`请输入自定义 GitHub 镜像地址 (例如: https://kkgithub.com):`,validate:e=>{let t=e.trim();if(!t)return`输入不能为空`;try{return new URL(t),!0}catch{return`请输入有效的 URL 地址`}}});return e?e.trim():``}return i===`https://github.com`?``:i||``}const Ce={name:`init`,description:`创建新项目`,async action(e){let t=!e.projectName||!e.template,n=e.projectName??await _e();if(!n){console.log(`
⚠️ 操作已取消。`);return}let r=e.template;if(r){let e=j.find(e=>e.name===r);e&&(r=e.value)}else r=await ve();if(!r){console.log(`
⚠️ 操作已取消。`);return}let i=e.mirror;!i&&t&&(i=await Se());let a=e.targetDir??ae(`./${n}`),o=e.force??!1;await ge({projectName:n,template:r,targetDir:a,force:o,mirror:i})}};function we(e){return/^@[\w-]+\/[\w-]+$/.test(e)||/^[\w-]+$/.test(e)?{valid:!0}:e.startsWith(`@`)&&!e.includes(`/`)?{valid:!1,error:`scoped 包名格式应为 @scope/name`}:{valid:!1,error:`包名只能包含字母、数字、- 和 _`}}function Te(t=process.cwd()){let r=u(t,`package.json`);if(!e(r))throw Error(`未找到 package.json,请在项目根目录执行`);let i=n(r,`utf-8`),a=JSON.parse(i),o=we(a.name);if(!o.valid)throw Error(`包名 "${a.name}" 格式不正确: ${o.error}`);return{name:a.name,version:a.version,path:r}}function Ee(t,r){let i=u(t,`package.json`);if(!e(i))throw Error(`未找到 package.json,请确认路径是否正确`);let o=n(i,`utf-8`),s=JSON.parse(o);s.version=r,a(i,JSON.stringify(s,null,2)+`
`,`utf-8`)}var M=S(((e,t)=>{t.exports={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:2**53-1||9007199254740991,RELEASE_TYPES:[`major`,`premajor`,`minor`,`preminor`,`patch`,`prepatch`,`prerelease`],SEMVER_SPEC_VERSION:`2.0.0`,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2}})),N=S(((e,t)=>{t.exports=typeof process==`object`&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error(`SEMVER`,...e):()=>{}})),P=S(((e,t)=>{let{MAX_SAFE_COMPONENT_LENGTH:n,MAX_SAFE_BUILD_LENGTH:r,MAX_LENGTH:i}=M(),a=N();e=t.exports={};let o=e.re=[],s=e.safeRe=[],c=e.src=[],l=e.safeSrc=[],u=e.t={},d=0,f=`[a-zA-Z0-9-]`,p=[[`\\s`,1],[`\\d`,i],[f,r]],m=e=>{for(let[t,n]of p)e=e.split(`${t}*`).join(`${t}{0,${n}}`).split(`${t}+`).join(`${t}{1,${n}}`);return e},h=(e,t,n)=>{let r=m(t),i=d++;a(e,i,t),u[e]=i,c[i]=t,l[i]=r,o[i]=new RegExp(t,n?`g`:void 0),s[i]=new RegExp(r,n?`g`:void 0)};h(`NUMERICIDENTIFIER`,`0|[1-9]\\d*`),h(`NUMERICIDENTIFIERLOOSE`,`\\d+`),h(`NONNUMERICIDENTIFIER`,`\\d*[a-zA-Z-]${f}*`),h(`MAINVERSION`,`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),h(`MAINVERSIONLOOSE`,`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASEIDENTIFIER`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIER]})`),h(`PRERELEASEIDENTIFIERLOOSE`,`(?:${c[u.NONNUMERICIDENTIFIER]}|${c[u.NUMERICIDENTIFIERLOOSE]})`),h(`PRERELEASE`,`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),h(`PRERELEASELOOSE`,`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),h(`BUILDIDENTIFIER`,`${f}+`),h(`BUILD`,`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),h(`FULLPLAIN`,`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),h(`FULL`,`^${c[u.FULLPLAIN]}$`),h(`LOOSEPLAIN`,`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),h(`LOOSE`,`^${c[u.LOOSEPLAIN]}$`),h(`GTLT`,`((?:<|>)?=?)`),h(`XRANGEIDENTIFIERLOOSE`,`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),h(`XRANGEIDENTIFIER`,`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),h(`XRANGEPLAIN`,`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),h(`XRANGEPLAINLOOSE`,`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),h(`XRANGE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),h(`XRANGELOOSE`,`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),h(`COERCEPLAIN`,`(^|[^\\d])(\\d{1,${n}})(?:\\.(\\d{1,${n}}))?(?:\\.(\\d{1,${n}}))?`),h(`COERCE`,`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),h(`COERCEFULL`,c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),h(`COERCERTL`,c[u.COERCE],!0),h(`COERCERTLFULL`,c[u.COERCEFULL],!0),h(`LONETILDE`,`(?:~>?)`),h(`TILDETRIM`,`(\\s*)${c[u.LONETILDE]}\\s+`,!0),e.tildeTrimReplace=`$1~`,h(`TILDE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),h(`TILDELOOSE`,`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),h(`LONECARET`,`(?:\\^)`),h(`CARETTRIM`,`(\\s*)${c[u.LONECARET]}\\s+`,!0),e.caretTrimReplace=`$1^`,h(`CARET`,`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),h(`CARETLOOSE`,`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),h(`COMPARATORLOOSE`,`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),h(`COMPARATOR`,`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),h(`COMPARATORTRIM`,`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace=`$1$2$3`,h(`HYPHENRANGE`,`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),h(`HYPHENRANGELOOSE`,`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),h(`STAR`,`(<|>)?=?\\s*\\*`),h(`GTE0`,`^\\s*>=\\s*0\\.0\\.0\\s*$`),h(`GTE0PRE`,`^\\s*>=\\s*0\\.0\\.0-0\\s*$`)})),F=S(((e,t)=>{let n=Object.freeze({loose:!0}),r=Object.freeze({});t.exports=e=>e?typeof e==`object`?e:n:r})),De=S(((e,t)=>{let n=/^[0-9]+$/,r=(e,t)=>{if(typeof e==`number`&&typeof t==`number`)return e===t?0:e<t?-1:1;let r=n.test(e),i=n.test(t);return r&&i&&(e=+e,t=+t),e===t?0:r&&!i?-1:i&&!r?1:e<t?-1:1};t.exports={compareIdentifiers:r,rcompareIdentifiers:(e,t)=>r(t,e)}})),I=S(((e,t)=>{let n=N(),{MAX_LENGTH:r,MAX_SAFE_INTEGER:i}=M(),{safeRe:a,t:o}=P(),s=F(),{compareIdentifiers:c}=De(),l=(e,t)=>{let n=t.split(`.`);if(n.length>e.length)return!1;for(let t=0;t<n.length;t++)if(c(e[t],n[t])!==0)return!1;return!0};t.exports=class e{constructor(t,c){if(c=s(c),t instanceof e){if(t.loose===!!c.loose&&t.includePrerelease===!!c.includePrerelease)return t;t=t.version}else if(typeof t!=`string`)throw TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>r)throw TypeError(`version is longer than ${r} characters`);n(`SemVer`,t,c),this.options=c,this.loose=!!c.loose,this.includePrerelease=!!c.includePrerelease;let l=t.trim().match(c.loose?a[o.LOOSE]:a[o.FULL]);if(!l)throw TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+l[1],this.minor=+l[2],this.patch=+l[3],this.major>i||this.major<0)throw TypeError(`Invalid major version`);if(this.minor>i||this.minor<0)throw TypeError(`Invalid minor version`);if(this.patch>i||this.patch<0)throw TypeError(`Invalid patch version`);l[4]?this.prerelease=l[4].split(`.`).map(e=>{if(/^[0-9]+$/.test(e)){let t=+e;if(t>=0&&t<i)return t}return e}):this.prerelease=[],this.build=l[5]?l[5].split(`.`):[],this.format()}format(){return this.version=`${this.major}.${this.minor}.${this.patch}`,this.prerelease.length&&(this.version+=`-${this.prerelease.join(`.`)}`),this.version}toString(){return this.version}compare(t){if(n(`SemVer.compare`,this.version,this.options,t),!(t instanceof e)){if(typeof t==`string`&&t===this.version)return 0;t=new e(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof e||(t=new e(t,this.options)),this.major<t.major?-1:this.major>t.major?1:this.minor<t.minor?-1:this.minor>t.minor?1:this.patch<t.patch?-1:+(this.patch>t.patch)}comparePre(t){if(t instanceof e||(t=new e(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{let e=this.prerelease[r],i=t.prerelease[r];if(n(`prerelease compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}compareBuild(t){t instanceof e||(t=new e(t,this.options));let r=0;do{let e=this.build[r],i=t.build[r];if(n(`build compare`,r,e,i),e===void 0&&i===void 0)return 0;if(i===void 0)return 1;if(e===void 0)return-1;if(e===i)continue;return c(e,i)}while(++r)}inc(e,t,n){if(e.startsWith(`pre`)){if(!t&&n===!1)throw Error(`invalid increment argument: identifier is empty`);if(t){let e=`-${t}`.match(this.options.loose?a[o.PRERELEASELOOSE]:a[o.PRERELEASE]);if(!e||e[1]!==t)throw Error(`invalid identifier: ${t}`)}}switch(e){case`premajor`:this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc(`pre`,t,n);break;case`preminor`:this.prerelease.length=0,this.patch=0,this.minor++,this.inc(`pre`,t,n);break;case`prepatch`:this.prerelease.length=0,this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`prerelease`:this.prerelease.length===0&&this.inc(`patch`,t,n),this.inc(`pre`,t,n);break;case`release`:if(this.prerelease.length===0)throw Error(`version ${this.raw} is not a prerelease`);this.prerelease.length=0;break;case`major`:(this.minor!==0||this.patch!==0||this.prerelease.length===0)&&this.major++,this.minor=0,this.patch=0,this.prerelease=[];break;case`minor`:(this.patch!==0||this.prerelease.length===0)&&this.minor++,this.patch=0,this.prerelease=[];break;case`patch`:this.prerelease.length===0&&this.patch++,this.prerelease=[];break;case`pre`:{let e=+!!Number(n);if(this.prerelease.length===0)this.prerelease=[e];else{let r=this.prerelease.length;for(;--r>=0;)typeof this.prerelease[r]==`number`&&(this.prerelease[r]++,r=-2);if(r===-1){if(t===this.prerelease.join(`.`)&&n===!1)throw Error(`invalid increment argument: identifier already exists`);this.prerelease.push(e)}}if(t){let r=[t,e];if(n===!1&&(r=[t]),l(this.prerelease,t)){let e=this.prerelease[t.split(`.`).length];isNaN(e)&&(this.prerelease=r)}else this.prerelease=r}break}default:throw Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(`.`)}`),this}}})),L=S(((e,t)=>{let n=I();t.exports=(e,t,r=!1)=>{if(e instanceof n)return e;try{return new n(e,t)}catch(e){if(!r)return null;throw e}}})),Oe=S(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e,t);return r?r.version:null}})),ke=S(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e.trim().replace(/^[=v]+/,``),t);return r?r.version:null}})),Ae=S(((e,t)=>{let n=I();t.exports=(e,t,r,i,a)=>{typeof r==`string`&&(a=i,i=r,r=void 0);try{return new n(e instanceof n?e.version:e,r).inc(t,i,a).version}catch{return null}}})),je=S(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e,null,!0),i=n(t,null,!0),a=r.compare(i);if(a===0)return null;let o=a>0,s=o?r:i,c=o?i:r,l=!!s.prerelease.length;if(c.prerelease.length&&!l){if(!c.patch&&!c.minor)return`major`;if(c.compareMain(s)===0)return c.minor&&!c.patch?`minor`:`patch`}let u=l?`pre`:``;return r.major===i.major?r.minor===i.minor?r.patch===i.patch?`prerelease`:u+`patch`:u+`minor`:u+`major`}})),Me=S(((e,t)=>{let n=I();t.exports=(e,t)=>new n(e,t).major})),Ne=S(((e,t)=>{let n=I();t.exports=(e,t)=>new n(e,t).minor})),Pe=S(((e,t)=>{let n=I();t.exports=(e,t)=>new n(e,t).patch})),Fe=S(((e,t)=>{let n=L();t.exports=(e,t)=>{let r=n(e,t);return r&&r.prerelease.length?r.prerelease:null}})),R=S(((e,t)=>{let n=I();t.exports=(e,t,r)=>new n(e,r).compare(new n(t,r))})),Ie=S(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(t,e,r)})),Le=S(((e,t)=>{let n=R();t.exports=(e,t)=>n(e,t,!0)})),z=S(((e,t)=>{let n=I();t.exports=(e,t,r)=>{let i=new n(e,r),a=new n(t,r);return i.compare(a)||i.compareBuild(a)}})),Re=S(((e,t)=>{let n=z();t.exports=(e,t)=>e.sort((e,r)=>n(e,r,t))})),ze=S(((e,t)=>{let n=z();t.exports=(e,t)=>e.sort((e,r)=>n(r,e,t))})),B=S(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)>0})),V=S(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)<0})),Be=S(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)===0})),Ve=S(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)!==0})),H=S(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)>=0})),U=S(((e,t)=>{let n=R();t.exports=(e,t,r)=>n(e,t,r)<=0})),He=S(((e,t)=>{let n=Be(),r=Ve(),i=B(),a=H(),o=V(),s=U();t.exports=(e,t,c,l)=>{switch(t){case`===`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e===c;case`!==`:return typeof e==`object`&&(e=e.version),typeof c==`object`&&(c=c.version),e!==c;case``:case`=`:case`==`:return n(e,c,l);case`!=`:return r(e,c,l);case`>`:return i(e,c,l);case`>=`:return a(e,c,l);case`<`:return o(e,c,l);case`<=`:return s(e,c,l);default:throw TypeError(`Invalid operator: ${t}`)}}})),Ue=S(((e,t)=>{let n=I(),r=L(),{safeRe:i,t:a}=P();t.exports=(e,t)=>{if(e instanceof n)return e;if(typeof e==`number`&&(e=String(e)),typeof e!=`string`)return null;t||={};let o=null;if(!t.rtl)o=e.match(t.includePrerelease?i[a.COERCEFULL]:i[a.COERCE]);else{let n=t.includePrerelease?i[a.COERCERTLFULL]:i[a.COERCERTL],r;for(;(r=n.exec(e))&&(!o||o.index+o[0].length!==e.length);)(!o||r.index+r[0].length!==o.index+o[0].length)&&(o=r),n.lastIndex=r.index+r[1].length+r[2].length;n.lastIndex=-1}if(o===null)return null;let s=o[2];return r(`${s}.${o[3]||`0`}.${o[4]||`0`}${t.includePrerelease&&o[5]?`-${o[5]}`:``}${t.includePrerelease&&o[6]?`+${o[6]}`:``}`,t)}})),We=S(((e,t)=>{let n=L(),r=M(),i=I(),a=(e,t,n)=>{if(!r.RELEASE_TYPES.includes(t))return null;let i=o(e,n);return i&&s(i,t)},o=(e,t)=>n(e instanceof i?e.version:e,t),s=(e,t)=>{if(c(t))return e.version;switch(e.prerelease=[],t){case`major`:e.minor=0,e.patch=0;break;case`minor`:e.patch=0;break}return e.format()},c=e=>e.startsWith(`pre`);t.exports=a})),Ge=S(((e,t)=>{t.exports=class{constructor(){this.max=1e3,this.map=new Map}get(e){let t=this.map.get(e);if(t!==void 0)return this.map.delete(e),this.map.set(e,t),t}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&t!==void 0){if(this.map.size>=this.max){let e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}}})),W=S(((e,t)=>{let n=/\s+/g;t.exports=class e{constructor(t,r){if(r=i(r),t instanceof e)return t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease?t:new e(t.raw,r);if(t instanceof a)return this.raw=t.value,this.set=[[t]],this.formatted=void 0,this;if(this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease,this.raw=t.trim().replace(n,` `),this.set=this.raw.split(`||`).map(e=>this.parseRange(e.trim())).filter(e=>e.length),!this.set.length)throw TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){let e=this.set[0];if(this.set=this.set.filter(e=>!_(e[0])),this.set.length===0)this.set=[e];else if(this.set.length>1){for(let e of this.set)if(e.length===1&&v(e[0])){this.set=[e];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted=``;for(let e=0;e<this.set.length;e++){e>0&&(this.formatted+=`||`);let t=this.set[e];for(let e=0;e<t.length;e++)e>0&&(this.formatted+=` `),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){e=e.replace(g,``);let t=((this.options.includePrerelease&&m)|(this.options.loose&&h))+`:`+e,n=r.get(t);if(n)return n;let i=this.options.loose,s=i?c[u.HYPHENRANGELOOSE]:c[u.HYPHENRANGE];e=e.replace(s,E(this.options.includePrerelease)),o(`hyphen replace`,e),e=e.replace(c[u.COMPARATORTRIM],d),o(`comparator trim`,e),e=e.replace(c[u.TILDETRIM],f),o(`tilde trim`,e),e=e.replace(c[u.CARETTRIM],p),o(`caret trim`,e);let l=e.split(` `).map(e=>b(e,this.options)).join(` `).split(/\s+/).map(e=>re(e,this.options));i&&(l=l.filter(e=>(o(`loose invalid filter`,e,this.options),!!e.match(c[u.COMPARATORLOOSE])))),o(`range list`,l);let v=new Map,y=l.map(e=>new a(e,this.options));for(let e of y){if(_(e))return[e];v.set(e.value,e)}v.size>1&&v.has(``)&&v.delete(``);let x=[...v.values()];return r.set(t,x),x}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Range is required`);return this.set.some(e=>y(e,n)&&t.set.some(t=>y(t,n)&&e.every(e=>t.every(t=>e.intersects(t,n)))))}test(e){if(!e)return!1;if(typeof e==`string`)try{e=new s(e,this.options)}catch{return!1}for(let t=0;t<this.set.length;t++)if(ie(this.set[t],e,this.options))return!0;return!1}};let r=new(Ge()),i=F(),a=G(),o=N(),s=I(),{safeRe:c,src:l,t:u,comparatorTrimReplace:d,tildeTrimReplace:f,caretTrimReplace:p}=P(),{FLAG_INCLUDE_PRERELEASE:m,FLAG_LOOSE:h}=M(),g=new RegExp(l[u.BUILD],`g`),_=e=>e.value===`<0.0.0-0`,v=e=>e.value===``,y=(e,t)=>{let n=!0,r=e.slice(),i=r.pop();for(;n&&r.length;)n=r.every(e=>i.intersects(e,t)),i=r.pop();return n},b=(e,t)=>(e=e.replace(c[u.BUILD],``),o(`comp`,e,t),e=S(e,t),o(`caret`,e),e=ee(e,t),o(`tildes`,e),e=w(e,t),o(`xrange`,e),e=T(e,t),o(`stars`,e),e),x=e=>!e||e.toLowerCase()===`x`||e===`*`,ee=(e,t)=>e.trim().split(/\s+/).map(e=>te(e,t)).join(` `),te=(e,t)=>{let n=t.loose?c[u.TILDELOOSE]:c[u.TILDE];return e.replace(n,(t,n,r,i,a)=>{o(`tilde`,e,t,n,r,i,a);let s;return x(n)?s=``:x(r)?s=`>=${n}.0.0 <${+n+1}.0.0-0`:x(i)?s=`>=${n}.${r}.0 <${n}.${+r+1}.0-0`:a?(o(`replaceTilde pr`,a),s=`>=${n}.${r}.${i}-${a} <${n}.${+r+1}.0-0`):s=`>=${n}.${r}.${i} <${n}.${+r+1}.0-0`,o(`tilde return`,s),s})},S=(e,t)=>e.trim().split(/\s+/).map(e=>C(e,t)).join(` `),C=(e,t)=>{o(`caret`,e,t);let n=t.loose?c[u.CARETLOOSE]:c[u.CARET],r=t.includePrerelease?`-0`:``;return e.replace(n,(t,n,i,a,s)=>{o(`caret`,e,t,n,i,a,s);let c;return x(n)?c=``:x(i)?c=`>=${n}.0.0${r} <${+n+1}.0.0-0`:x(a)?c=n===`0`?`>=${n}.${i}.0${r} <${n}.${+i+1}.0-0`:`>=${n}.${i}.0${r} <${+n+1}.0.0-0`:s?(o(`replaceCaret pr`,s),c=n===`0`?i===`0`?`>=${n}.${i}.${a}-${s} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a}-${s} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a}-${s} <${+n+1}.0.0-0`):(o(`no pr`),c=n===`0`?i===`0`?`>=${n}.${i}.${a} <${n}.${i}.${+a+1}-0`:`>=${n}.${i}.${a} <${n}.${+i+1}.0-0`:`>=${n}.${i}.${a} <${+n+1}.0.0-0`),o(`caret return`,c),c})},w=(e,t)=>(o(`replaceXRanges`,e,t),e.split(/\s+/).map(e=>ne(e,t)).join(` `)),ne=(e,t)=>{e=e.trim();let n=t.loose?c[u.XRANGELOOSE]:c[u.XRANGE];return e.replace(n,(n,r,i,a,s,c)=>{o(`xRange`,e,n,r,i,a,s,c);let l=x(i),u=l||x(a),d=u||x(s),f=d;return r===`=`&&f&&(r=``),c=t.includePrerelease?`-0`:``,l?n=r===`>`||r===`<`?`<0.0.0-0`:`*`:r&&f?(u&&(a=0),s=0,r===`>`?(r=`>=`,u?(i=+i+1,a=0,s=0):(a=+a+1,s=0)):r===`<=`&&(r=`<`,u?i=+i+1:a=+a+1),r===`<`&&(c=`-0`),n=`${r+i}.${a}.${s}${c}`):u?n=`>=${i}.0.0${c} <${+i+1}.0.0-0`:d&&(n=`>=${i}.${a}.0${c} <${i}.${+a+1}.0-0`),o(`xRange return`,n),n})},T=(e,t)=>(o(`replaceStars`,e,t),e.trim().replace(c[u.STAR],``)),re=(e,t)=>(o(`replaceGTE0`,e,t),e.trim().replace(c[t.includePrerelease?u.GTE0PRE:u.GTE0],``)),E=e=>(t,n,r,i,a,o,s,c,l,u,d,f)=>(n=x(r)?``:x(i)?`>=${r}.0.0${e?`-0`:``}`:x(a)?`>=${r}.${i}.0${e?`-0`:``}`:o?`>=${n}`:`>=${n}${e?`-0`:``}`,c=x(l)?``:x(u)?`<${+l+1}.0.0-0`:x(d)?`<${l}.${+u+1}.0-0`:f?`<=${l}.${u}.${d}-${f}`:e?`<${l}.${u}.${+d+1}-0`:`<=${c}`,`${n} ${c}`.trim()),ie=(e,t,n)=>{for(let n=0;n<e.length;n++)if(!e[n].test(t))return!1;if(t.prerelease.length&&!n.includePrerelease){for(let n=0;n<e.length;n++)if(o(e[n].semver),e[n].semver!==a.ANY&&e[n].semver.prerelease.length>0){let r=e[n].semver;if(r.major===t.major&&r.minor===t.minor&&r.patch===t.patch)return!0}return!1}return!0}})),G=S(((e,t)=>{let n=Symbol(`SemVer ANY`);t.exports=class e{static get ANY(){return n}constructor(t,i){if(i=r(i),t instanceof e){if(t.loose===!!i.loose)return t;t=t.value}t=t.trim().split(/\s+/).join(` `),s(`comparator`,t,i),this.options=i,this.loose=!!i.loose,this.parse(t),this.semver===n?this.value=``:this.value=this.operator+this.semver.version,s(`comp`,this)}parse(e){let t=this.options.loose?i[a.COMPARATORLOOSE]:i[a.COMPARATOR],r=e.match(t);if(!r)throw TypeError(`Invalid comparator: ${e}`);this.operator=r[1]===void 0?``:r[1],this.operator===`=`&&(this.operator=``),r[2]?this.semver=new c(r[2],this.options.loose):this.semver=n}toString(){return this.value}test(e){if(s(`Comparator.test`,e,this.options.loose),this.semver===n||e===n)return!0;if(typeof e==`string`)try{e=new c(e,this.options)}catch{return!1}return o(e,this.operator,this.semver,this.options)}intersects(t,n){if(!(t instanceof e))throw TypeError(`a Comparator is required`);return this.operator===``?this.value===``?!0:new l(t.value,n).test(this.value):t.operator===``?t.value===``?!0:new l(this.value,n).test(t.semver):(n=r(n),n.includePrerelease&&(this.value===`<0.0.0-0`||t.value===`<0.0.0-0`)||!n.includePrerelease&&(this.value.startsWith(`<0.0.0`)||t.value.startsWith(`<0.0.0`))?!1:!!(this.operator.startsWith(`>`)&&t.operator.startsWith(`>`)||this.operator.startsWith(`<`)&&t.operator.startsWith(`<`)||this.semver.version===t.semver.version&&this.operator.includes(`=`)&&t.operator.includes(`=`)||o(this.semver,`<`,t.semver,n)&&this.operator.startsWith(`>`)&&t.operator.startsWith(`<`)||o(this.semver,`>`,t.semver,n)&&this.operator.startsWith(`<`)&&t.operator.startsWith(`>`)))}};let r=F(),{safeRe:i,t:a}=P(),o=He(),s=N(),c=I(),l=W()})),K=S(((e,t)=>{let n=W();t.exports=(e,t,r)=>{try{t=new n(t,r)}catch{return!1}return t.test(e)}})),Ke=S(((e,t)=>{let n=W();t.exports=(e,t)=>new n(e,t).set.map(e=>e.map(e=>e.value).join(` `).trim().split(` `))})),qe=S(((e,t)=>{let n=I(),r=W();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===-1)&&(a=e,o=new n(a,i))}),a}})),Je=S(((e,t)=>{let n=I(),r=W();t.exports=(e,t,i)=>{let a=null,o=null,s=null;try{s=new r(t,i)}catch{return null}return e.forEach(e=>{s.test(e)&&(!a||o.compare(e)===1)&&(a=e,o=new n(a,i))}),a}})),Ye=S(((e,t)=>{let n=I(),r=W(),i=B();t.exports=(e,t)=>{e=new r(e,t);let a=new n(`0.0.0`);if(e.test(a)||(a=new n(`0.0.0-0`),e.test(a)))return a;a=null;for(let t=0;t<e.set.length;++t){let r=e.set[t],o=null;r.forEach(e=>{let t=new n(e.semver.version);switch(e.operator){case`>`:t.prerelease.length===0?t.patch++:t.prerelease.push(0),t.raw=t.format();case``:case`>=`:(!o||i(t,o))&&(o=t);break;case`<`:case`<=`:break;default:throw Error(`Unexpected operation: ${e.operator}`)}}),o&&(!a||i(a,o))&&(a=o)}return a&&e.test(a)?a:null}})),Xe=S(((e,t)=>{let n=W();t.exports=(e,t)=>{try{return new n(e,t).range||`*`}catch{return null}}})),q=S(((e,t)=>{let n=I(),r=G(),{ANY:i}=r,a=W(),o=K(),s=B(),c=V(),l=U(),u=H();t.exports=(e,t,d,f)=>{e=new n(e,f),t=new a(t,f);let p,m,h,g,_;switch(d){case`>`:p=s,m=l,h=c,g=`>`,_=`>=`;break;case`<`:p=c,m=u,h=s,g=`<`,_=`<=`;break;default:throw TypeError(`Must provide a hilo val of "<" or ">"`)}if(o(e,t,f))return!1;for(let n=0;n<t.set.length;++n){let a=t.set[n],o=null,s=null;if(a.forEach(e=>{e.semver===i&&(e=new r(`>=0.0.0`)),o||=e,s||=e,p(e.semver,o.semver,f)?o=e:h(e.semver,s.semver,f)&&(s=e)}),o.operator===g||o.operator===_||(!s.operator||s.operator===g)&&m(e,s.semver)||s.operator===_&&h(e,s.semver))return!1}return!0}})),Ze=S(((e,t)=>{let n=q();t.exports=(e,t,r)=>n(e,t,`>`,r)})),Qe=S(((e,t)=>{let n=q();t.exports=(e,t,r)=>n(e,t,`<`,r)})),$e=S(((e,t)=>{let n=W();t.exports=(e,t,r)=>(e=new n(e,r),t=new n(t,r),e.intersects(t,r))})),et=S(((e,t)=>{let n=K(),r=R();t.exports=(e,t,i)=>{let a=[],o=null,s=null,c=e.sort((e,t)=>r(e,t,i));for(let e of c)n(e,t,i)?(s=e,o||=e):(s&&a.push([o,s]),s=null,o=null);o&&a.push([o,null]);let l=[];for(let[e,t]of a)e===t?l.push(e):!t&&e===c[0]?l.push(`*`):t?e===c[0]?l.push(`<=${t}`):l.push(`${e} - ${t}`):l.push(`>=${e}`);let u=l.join(` || `),d=typeof t.raw==`string`?t.raw:String(t);return u.length<d.length?u:t}})),tt=S(((e,t)=>{let n=W(),r=G(),{ANY:i}=r,a=K(),o=R(),s=(e,t,r={})=>{if(e===t)return!0;e=new n(e,r),t=new n(t,r);let i=!1;OUTER:for(let n of e.set){for(let e of t.set){let t=u(n,e,r);if(i||=t!==null,t)continue OUTER}if(i)return!1}return!0},c=[new r(`>=0.0.0-0`)],l=[new r(`>=0.0.0`)],u=(e,t,n)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===i){if(t.length===1&&t[0].semver===i)return!0;e=n.includePrerelease?c:l}if(t.length===1&&t[0].semver===i){if(n.includePrerelease)return!0;t=l}let r=new Set,s,u;for(let t of e)t.operator===`>`||t.operator===`>=`?s=d(s,t,n):t.operator===`<`||t.operator===`<=`?u=f(u,t,n):r.add(t.semver);if(r.size>1)return null;let p;if(s&&u&&(p=o(s.semver,u.semver,n),p>0||p===0&&(s.operator!==`>=`||u.operator!==`<=`)))return null;for(let e of r){if(s&&!a(e,String(s),n)||u&&!a(e,String(u),n))return null;for(let r of t)if(!a(e,String(r),n))return!1;return!0}let m,h,g,_,v=u&&!n.includePrerelease&&u.semver.prerelease.length?u.semver:!1,y=s&&!n.includePrerelease&&s.semver.prerelease.length?s.semver:!1;v&&v.prerelease.length===1&&u.operator===`<`&&v.prerelease[0]===0&&(v=!1);for(let e of t){if(_=_||e.operator===`>`||e.operator===`>=`,g=g||e.operator===`<`||e.operator===`<=`,s){if(y&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===y.major&&e.semver.minor===y.minor&&e.semver.patch===y.patch&&(y=!1),e.operator===`>`||e.operator===`>=`){if(m=d(s,e,n),m===e&&m!==s)return!1}else if(s.operator===`>=`&&!e.test(s.semver))return!1}if(u){if(v&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===v.major&&e.semver.minor===v.minor&&e.semver.patch===v.patch&&(v=!1),e.operator===`<`||e.operator===`<=`){if(h=f(u,e,n),h===e&&h!==u)return!1}else if(u.operator===`<=`&&!e.test(u.semver))return!1}if(!e.operator&&(u||s)&&p!==0)return!1}return!(s&&g&&!u&&p!==0||u&&_&&!s&&p!==0||y||v)},d=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r>0?e:r<0||t.operator===`>`&&e.operator===`>=`?t:e},f=(e,t,n)=>{if(!e)return t;let r=o(e.semver,t.semver,n);return r<0?e:r>0||t.operator===`<`&&e.operator===`<=`?t:e};t.exports=s})),J=ne(S(((e,t)=>{let n=P(),r=M(),i=I(),a=De();t.exports={parse:L(),valid:Oe(),clean:ke(),inc:Ae(),diff:je(),major:Me(),minor:Ne(),patch:Pe(),prerelease:Fe(),compare:R(),rcompare:Ie(),compareLoose:Le(),compareBuild:z(),sort:Re(),rsort:ze(),gt:B(),lt:V(),eq:Be(),neq:Ve(),gte:H(),lte:U(),cmp:He(),coerce:Ue(),truncate:We(),Comparator:G(),Range:W(),satisfies:K(),toComparators:Ke(),maxSatisfying:qe(),minSatisfying:Je(),minVersion:Ye(),validRange:Xe(),outside:q(),gtr:Ze(),ltr:Qe(),intersects:$e(),simplifyRange:et(),subset:tt(),SemVer:i,re:n.re,src:n.src,tokens:n.t,SEMVER_SPEC_VERSION:r.SEMVER_SPEC_VERSION,RELEASE_TYPES:r.RELEASE_TYPES,compareIdentifiers:a.compareIdentifiers,rcompareIdentifiers:a.rcompareIdentifiers}}))(),1);function Y(e,t,n){let r=e;return t===`custom`||([`patch`,`minor`,`major`].includes(t)?r=J.default.inc(e,t)??e:J.default.valid(t)&&(r=t)),n&&J.default.valid(r)&&(r=J.default.inc(r,`prerelease`,n)??r),r}function nt(e){return J.default.valid(e)!==null}function rt(t){let n=l(t,`packages`);if(!e(n))return[];try{return r(n,{withFileTypes:!0}).filter(e=>e.isDirectory()).filter(t=>e(l(n,t.name,`package.json`))).map(e=>l(n,e.name))}catch{return[]}}async function it(t){let n=rt(t);if(n.length===0)return e(l(t,`package.json`))?[t]:(console.error(`❌ 未找到可发布的包,请确保项目根目录有 package.json 或 packages/ 目录下有子包`),null);let{selected:r}=await g({type:`multiselect`,name:`selected`,message:`选择要发布的包:`,choices:[{value:`__all__`,title:`全部包`,description:`发布 packages 下的所有包`},...n.map(e=>({value:e,title:s(e),description:e}))]});return!r||r.length===0?(console.log(`已取消发布`),null):r.includes(`__all__`)?n:r}async function at(e){let t={patch:Y(e,`patch`),minor:Y(e,`minor`),major:Y(e,`major`)},{type:n}=await g({type:`select`,name:`type`,message:`选择版本类型:`,choices:[{value:`patch`,title:`Patch (bugfix) → ${t.patch}`,description:`向后兼容的 bug 修复`},{value:`minor`,title:`Minor (新功能) → ${t.minor}`,description:`向后兼容的新功能`},{value:`major`,title:`Major (破坏性更新) → ${t.major}`,description:`不兼容的 API 变更`},{value:`custom`,title:`自定义版本号`}]});if(!n)return console.log(`已取消发布`),null;if(n===`custom`){let{version:t}=await g({type:`text`,name:`version`,message:`输入版本号:`,hint:e,initial:``});return t||(console.log(`已取消发布`),null)}return n}async function ot(e){let{message:t}=await g({type:`text`,name:`message`,message:`输入 commit message:`,initial:e});return t||(console.log(`已取消发布`),null)}async function st(e,t){let{confirm:n}=await g({type:`confirm`,name:`confirm`,message:`确认发布 ${e}@${t}?`,initial:!0});return n}function X(e){return d(`git ${e}`,{encoding:`utf-8`,stdio:`pipe`})}function ct(e,t){process.stdout.write(`⏳ ${t}...`);let n=Date.now();try{let r=d(`git ${e}`,{encoding:`utf-8`,stdio:`pipe`}),i=((Date.now()-n)/1e3).toFixed(1);return console.log(`\r✅ ${t} (${i}s)\n`),r}catch(e){throw console.log(`\r❌ ${t} 失败\n`),e}}function Z(){try{return d(`git rev-parse --is-inside-work-tree`,{stdio:`pipe`}),!0}catch{return!1}}function lt(){try{return Z()?X(`status --porcelain`).trim().length>0:!1}catch{return!1}}function ut(){try{return X(`remote get-url origin`).trim().length>0}catch{return!1}}function dt(e=`.`){try{X(`add ${e}`)}catch{throw Error(`git add 失败,请检查文件权限`)}}function ft(e){try{X(`commit -m "${e}"`)}catch{throw Error(`git commit 失败,请确认已配置用户名和邮箱`)}}function pt(e){try{X(`tag ${e}`)}catch{throw Error(`git tag 失败,标签名可能已存在`)}}function mt(e=3){for(let t=0;t<e;t++)try{ct(`push --follow-tags`,`Git push with tags (${t+1}/${e})`);return}catch{if(t===e-1)throw Error(`git push --follow-tags 失败,请检查网络或 remote 配置`);console.log(`⚠️ push --follow-tags 失败,${t+1} 秒后重试...\n`),ht(t+1)}}function ht(e){let t=Date.now()+e*1e3;for(;Date.now()<t;);}function gt(e){try{X(`tag -d ${e}`)}catch{throw Error(`本地删除 Tag 失败: ${e}`)}}function _t(e){try{X(`reset --hard ${e}`)}catch{throw Error(`本地 reset --hard 失败: ${e}`)}}function vt(e){try{X(`push origin :refs/tags/${e}`)}catch{throw Error(`从远端删除 Tag 失败: ${e}`)}}async function yt(){if(!Z()){let{action:e}=await g({type:`select`,name:`action`,message:`⚠️ 当前目录未检测到 Git 仓库,请选择操作:`,choices:[{value:`init`,title:`🔧 初始化 Git 仓库并继续发布`},{value:`cancel`,title:`❌ 取消发布`}]});if(e===`init`){let{success:e}=await bt();if(!e)throw Error(`Git init 失败,请检查目录权限`)}}if(ut()||(console.log(`⚠️ 未设置 remote,无法推送`),process.exit(1)),lt()){let{action:e}=await g({type:`select`,name:`action`,message:`⚠️ 检测到未提交的更改,请选择操作:`,choices:[{value:`commit`,title:`📝 提交更改并继续发布`},{value:`stash`,title:`📦 暂存更改并继续发布`},{value:`cancel`,title:`❌ 取消发布`}]});if((e===`cancel`||!e)&&process.exit(0),e===`stash`){let{success:e}=await xt();if(!e)throw Error(`git stash 失败,请检查工作区状态`)}if(e===`commit`){let{message:e}=await g({type:`text`,name:`message`,message:`输入提交信息:`,initial:`chore: release`});e||process.exit(0),dt(),ft(e)}}}async function bt(){try{let{execSync:e}=await import(`node:child_process`);return e(`git init`,{stdio:`pipe`}),{success:!0}}catch{return{success:!1}}}async function xt(){try{let{execSync:e}=await import(`node:child_process`);return e(`git stash`,{stdio:`pipe`}),{success:!0}}catch{return{success:!1}}}function St(e,t){try{return d(`npm view ${e}@${t} version`,{stdio:`pipe`}),!0}catch{return!1}}async function Ct(e,t=3){let n=process.env.NPM_OTP||``;for(let r=0;r<t;r++){let i=n?`npm publish --otp=${n}`:`npm publish`;try{console.log(`📦 正在发布到 npm (${r+1}/${t})...`),d(i,{cwd:e,stdio:[`inherit`,`inherit`,`pipe`]}),console.log(`✅ npm publish 完成 (${r+1}/${t})\n`);return}catch(e){let i=e.stderr?e.stderr.toString():``,a=e.message||``;if(i.includes(`EOTP`)||i.includes(`one-time password`)||i.includes(`Two-factor authentication`)||i.includes(`2fa`)||a.includes(`EOTP`)||a.includes(`one-time password`)||a.includes(`Two-factor authentication`)||a.includes(`2fa`)){console.log(`
⚠️ 检测到 npm 账户已开启 2FA (双重身份验证)`);let{otp:e}=await g({type:`text`,name:`otp`,message:`请输入您的 OTP 动态验证码 (6位数字):`,validate:e=>/^\d{6}$/.test(e)?!0:`请输入有效的 6 位数字验证码`});if(e){n=e,r--;continue}else throw Error(`发布取消:未提供 OTP 验证码`)}if(e.stderr&&process.stderr.write(e.stderr),r===t-1)throw Error(`npm publish 失败,请确认已登录 npm(npm login)且 OTP 验证码正确`);console.log(`⚠️ npm publish 失败,${r+1} 秒后重试...\n`),wt(r+1)}}}function wt(e){let t=Date.now()+e*1e3;for(;Date.now()<t;);}function Tt(){try{let e=d(`git remote get-url origin`,{encoding:`utf-8`,stdio:`pipe`}).trim(),t=e.match(/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(t)return{owner:t[1],repo:t[2].replace(/\.git$/,``)};let n=e.match(/github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/);return n?{owner:n[1],repo:n[2].replace(/\.git$/,``)}:null}catch{return null}}async function Et(e,t,n={}){let r=Tt();if(!r)throw Error(`无法获取 GitHub remote 信息`);let i=n.owner||r.owner,a=n.repo||r.repo,o=n.token||process.env.GITHUB_TOKEN;if(!o)throw Error(`未设置 GITHUB_TOKEN 环境变量`);let s=!!n.draft,c=!!n.prerelease;try{let n=d(`curl -s -w "\\n%{http_code}" -X POST \
-H "Authorization: Bearer ${o}" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/json" \
-d '${JSON.stringify({tag_name:e,name:e,body:t,draft:s,prerelease:c}).replace(/'/g,`'"'"'`)}' \
https://api.github.com/repos/${i}/${a}/releases`,{encoding:`utf-8`}).trim().split(`
`),r=parseInt(n[n.length-1],10),l=n.slice(0,-1).join(`
`);if(r<200||r>=300)throw Error(`HTTP ${r}: ${l}`)}catch(e){throw Error(`创建 GitHub Release 失败: ${e.message}`)}}function Dt(e,t){let n=new Date().toISOString().split(`T`)[0],r=`# ${e} v${t}\n\n`;r+=`**发布日期:** ${n}\n\n`;try{let e=d(`git describe --tags --abbrev=0 2>/dev/null || echo ''`,{encoding:`utf-8`,stdio:`pipe`}).trim();if(e){let t=d(`git log ${e}..HEAD --pretty=format:"%s|%h"`,{encoding:`utf-8`,stdio:`pipe`}).trim();if(t){let e=Ot(t.split(`
`).filter(Boolean));e.features.length>0&&(r+=`## ✨ 新功能
`,r+=e.features.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.fixes.length>0&&(r+=`## 🐛 Bug 修复
`,r+=e.fixes.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.breaking.length>0&&(r+=`## ⚠️ 破坏性变更
`,r+=e.breaking.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.other.length>0&&(r+=`## 其他变更
`,r+=e.other.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`)}}}catch{}return r}function Ot(e){let t={features:[],fixes:[],breaking:[],other:[]};for(let n of e){let[e,r]=n.split(`|`);if(!e||!r)continue;let i=e.toLowerCase(),a={message:e,hash:r};i.startsWith(`feat`)||i.startsWith(`feature`)||i.startsWith(`新增`)?t.features.push(a):i.startsWith(`fix`)||i.startsWith(`bug`)||i.startsWith(`修复`)?t.fixes.push(a):i.includes(`breaking`)||i.includes(`破坏`)||e.includes(`!`)?t.breaking.push(a):t.other.push(a)}return t}function kt(e,t){let n=new Date().toISOString().split(`T`)[0],r=``;try{let e=d(`git describe --tags --abbrev=0 2>/dev/null || echo ''`,{encoding:`utf-8`,stdio:`pipe`}).trim(),t=``;if(t=e?d(`git log ${e}..HEAD --pretty=format:"%s|%h"`,{encoding:`utf-8`,stdio:`pipe`}).trim():d(`git log --pretty=format:"%s|%h"`,{encoding:`utf-8`,stdio:`pipe`}).trim(),t){let e=Ot(t.split(`
`).filter(Boolean));e.features.length>0&&(r+=`### ✨ Features
`+e.features.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.fixes.length>0&&(r+=`### 🐛 Bug Fixes
`+e.fixes.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.breaking.length>0&&(r+=`### ⚠️ Breaking Changes
`+e.breaking.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`),e.other.length>0&&(r+=`### Other Changes
`+e.other.map(e=>`- ${e.message} (${e.hash})`).join(`
`)+`
`)}}catch{}if(!r.trim())try{r=`- ${d(`git log -1 --pretty=format:%s`,{encoding:`utf-8`,stdio:`pipe`}).trim()}\n\n`}catch{r=`- Initial release
`}return`## ${t} (${n})\n\n${r}`}function At(r,i,o,s){let u=s?l(r,s):l(r,`CHANGELOG.md`),d=kt(i,o);if(e(u)){let e=n(u,`utf-8`);a(u,d+`
`+e,`utf-8`)}else{let n=c(u);e(n)||t(n,{recursive:!0}),a(u,`# Changelog\n\n${d}`,`utf-8`)}}const jt=[`.releaserc.json`,`.releaserc.js`,`release.config.js`];async function Mt(t=process.cwd()){for(let r of jt){let i=l(t,r);if(e(i))try{if(r.endsWith(`.json`)){let e=n(i,`utf-8`);return JSON.parse(e)}if(r.endsWith(`.js`)){let e=await import(_(i).href);return e.default||e}}catch(e){console.warn(`⚠️ 加载配置文件 ${r} 失败:`,e)}}return null}function Nt(e){let t=[e.patch&&`patch`,e.minor&&`minor`,e.major&&`major`,e.custom&&`custom`].filter(Boolean);if(t.length>1)throw Error(`版本标志互斥,只能选择一个: ${t.join(`, `)}`);if(e.patch)return`patch`;if(e.minor)return`minor`;if(e.major)return`major`;if(e.custom){if(!nt(e.custom))throw Error(`无效的版本号: ${e.custom}`);return e.custom}return null}async function Pt(e){e.dryRun?console.log(`🔍 [DRY RUN] 跳过 Git 状态检查
`):await yt()}async function Ft(e,t){let n=e.package?[e.package]:await it(t);if(!n||n.length===0)return[];let r=Nt(e),i=[];for(let t of n){let n=Te(t),a=n.name,o=n.version;console.log(`\n${`=`.repeat(50)}`),console.log(`📦 准备发布: ${a}@${o}`),console.log(`=`.repeat(50));let s=r??await at(o);if(s===null)return console.log(`已取消发布`),[];let c=Y(o,s,e.preRelease);if(console.log(`\n🚀 版本更新: ${a} → ${c}\n`),e.dryRun){console.log(`━━━━━━━━━━━━━━━━━━━━━━━━`),console.log(`🔍 [DRY RUN] 未实际执行更新`),console.log(`━━━━━━━━━━━━━━━━━━━━━━━━
`);continue}if(!e.skipPublish&&St(a,c))throw Error(`版本 ${c} 已存在于 npm,请使用新版本号`);if(!e.skipConfirm&&!await st(a,c))return console.log(`已取消发布`),[];i.push({pkgPath:t,pkgName:a,originalVersion:o,newVersion:c})}return e.dryRun&&i.length===0&&console.log(`
🎉 [DRY RUN] 模拟全部完成!`),i}async function It(e,t){for(let n of e)if(Ee(n.pkgPath,n.newVersion),!t.skipChangelog){let e=t.config?.changelog;console.log(`📝 更新 CHANGELOG...`),At(n.pkgPath,n.pkgName,n.newVersion,e?.output)}}async function Lt(e,t,n){console.log(`
📝 统一提交 Git 并打标签...`);let r=``;if(e.length===1){let{pkgName:n,newVersion:i}=e[0],a=`chore: release ${n}@${i}`;r=t.commitMessage??await ot(a)??a}else{let n=`chore: release [${e.map(e=>`${e.pkgName}@${e.newVersion}`).join(`, `)}]`;r=t.commitMessage??await ot(n)??n}dt(`.`),ft(r);let i=e.length===1&&e[0].pkgPath===n,a=[];for(let t of e){let e=i?`v${t.newVersion}`:`${t.pkgName}@${t.newVersion}`;console.log(`🏷️ 打 Git 标签: ${e}`),pt(e),a.push(e)}return{createdTags:a,commitCreated:!0}}async function Rt(e,t,n,r){if(n.skipPush||(console.log(`🚀 推送到 Git 远端...`),mt()),!n.skipGithubRelease&&!n.skipPush&&Tt()){let t=e.length===1&&e[0].pkgPath===r;for(let r of e){let e=t?`v${r.newVersion}`:`${r.pkgName}@${r.newVersion}`;console.log(`🚀 创建 GitHub Release: ${e}...`),await Et(e,Dt(r.pkgName,r.newVersion),n.config?.githubRelease)}}if(!n.skipPublish)if(n.config?.parallel)console.log(`
📦 并行发布到 npm...`),await Promise.all(e.map(async e=>{await Ct(e.pkgPath)}));else{console.log(`
📦 串行发布到 npm...`);for(let t of e)await Ct(t.pkgPath)}}async function zt(e,t,n,r){if(console.log(`
⚠️ 正在启动自动回滚程序...`),r&&t.length>0){console.log(`🧹 正在删除远端 Git 标签...`);for(let e of t)try{vt(e),console.log(` ✅ 成功删除远端标签: ${e}`)}catch(t){console.error(` ❌ 删除远端标签 ${e} 失败:`,Q(t))}}if(t.length>0){console.log(`🧹 正在删除本地 Git 标签...`);for(let e of t)try{gt(e),console.log(` ✅ 成功删除本地标签: ${e}`)}catch(t){console.error(` ❌ 删除本地标签 ${e} 失败:`,Q(t))}}let i=!1;if(n){console.log(`🧹 正在撤销本地 Git 提交...`);try{_t(`HEAD~1`),console.log(` ✅ 本地 Git 提交已撤销,工作区已重置`),i=!0}catch(e){console.error(` ❌ 撤销本地 Git 提交失败:`,Q(e))}r&&(console.log(`
⚠️ [手动干预提示] 本地提交已撤销,但由于更改已推送到远端分支,请手动执行强制推送以回滚远端提交:`),console.log(` git push origin <当前分支> --force
`))}if(!i&&e.length>0){console.log(`🧹 正在回滚 package.json 中的版本号...`);for(let t of e)try{Ee(t.pkgPath,t.originalVersion),console.log(` ✅ ${t.pkgName} 的版本已还原为 ${t.originalVersion}`)}catch(e){console.error(` ❌ 还原 ${t.pkgName} 版本失败:`,Q(e))}}console.log(`
🛑 自动回滚完成。
`)}function Q(e){if(!e)return`未知错误`;let t=(typeof e==`string`?e:e.message||String(e)).replace(/^Error:\s*/i,``);return t.includes(`git tag 失败`)||t.includes(`标签名可能已存在`)||t.includes(`tagname already exists`)?`本地 Git Tag 标签已存在。请先删除冲突的标签或使用新的版本号。`:t.includes(`创建 GitHub Release 失败`)||t.includes(`HTTP 404`)||t.includes(`Not Found`)?`GitHub Release 创建失败。请检查您的 GITHUB_TOKEN 是否有效且拥有写入(write)权限。`:t.includes(`npm publish 失败`)||t.includes(`npm login`)?`NPM 发布失败。请确保您已在本地运行 'npm login' 成功登录了有权限 of 账号。`:t.includes(`npm version exists`)||t.includes(`已存在于 npm`)?`该版本号已在 NPM 注册表中发布过,请使用新的版本号。`:t.includes(`Repository rule violations`)||t.includes(`push declined due to repository rule violations`)?`推送失败:触发了 GitHub 仓库保护规则(通常是因为提交中包含敏感的 Token/密码)。`:t}async function Bt(e={}){let t=e.cwd??process.cwd(),n=await Mt(t),r={...e,...n};r.config=n||void 0;let i=[],a=[],o=!1,s=!1;try{if(await Pt(r),i=await Ft(r,t),i.length===0)return;await It(i,r);let e=await Lt(i,r,t);a=e.createdTags,o=e.commitCreated,await Rt(i,a,r,t),s=!r.skipPush,console.log(`
🎉 全部发布完成!`)}catch(e){let t=Q(e);throw console.error(`
❌ 发布过程中出错:`,t),await zt(i,a,o,s),Error(t)}}async function Vt(e={}){await Bt(e)}const $=[Ce,{name:`release`,description:`发布新版本(类似 bumpp)`,async action(e){await Vt(e)}},{name:`list`,description:`查看可用的项目模板列表`,async action(){console.log(`
📋 可用项目模板列表:`);for(let e of j)console.log(` - ${e.name.padEnd(8)}: ${e.description} (${e.value})`);console.log()}},{name:`mirror`,description:`GitHub 镜像源管理`,async action(e){let t=e.subcommand||`list`,n=e.args||[];if(t===`list`||t===`ls`){let e=O();console.log(`
📋 已有 GitHub 镜像源列表:`),e.forEach(e=>{let t=e.isBuiltin?`[内置]`:`[自定义]`;console.log(` - ${e.name.padEnd(12)} : ${e.value} ${t}`)}),console.log(``);return}if(t===`speed`){let e=O();console.log(`
⚡️ 开始测试 GitHub 镜像源延迟 (直连,以 vuejs/vue 为参照仓库)...`);let t=await Promise.all(e.map(e=>xe(e.value,`https://github.com/vuejs/vue.git`)));console.log(`
📋 测试结果如下:`);let n=-1,r=1/0;for(let e=0;e<t.length;e++){let i=t[e];i>0&&i<r&&(r=i,n=e)}for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=i.isBuiltin?`[内置]`:`[自定义]`;if(a>0){let e=r===n?` [最快]`:``;console.log(` ✅ ${i.name.padEnd(12)} ${o.padEnd(6)}: ${String(a).padStart(4)}ms${e}`)}else console.log(` ❌ ${i.name.padEnd(12)} ${o.padEnd(6)}: 超时/不可达`)}if(console.log(``),n!==-1){let t=e[n];t.value===`https://github.com`?A.success(`💡 官方源响应最快,无需配置任何镜像加速。`):(A.success(`💡 推荐使用: ${t.name}`),console.log(`👉 配置命令: vii init <dir> -m ${t.value}\n`))}else A.error(`⚠️ 所有镜像源均不可达,请检查您的网络连接。
`);return}if(t===`add`){let e=n[0],t=n[1];(!e||!t)&&(A.error(`❌ 参数错误!请使用: vii mirror add <name> <url>`),process.exit(1));try{new URL(t)}catch{A.error(`❌ 参数错误!无效的镜像 URL: ${t}`),process.exit(1)}let r=O();r.some(t=>t.name.toLowerCase()===e.toLowerCase())&&(A.error(`❌ 添加失败!镜像源名称 "${e}" 已存在。`),process.exit(1)),r.some(e=>e.value.replace(/\/$/,``)===t.replace(/\/$/,``))&&(A.error(`❌ 添加失败!该镜像源 URL 已存在。`),process.exit(1));let i=D();i.push({name:e,value:t}),ce(i),A.success(`✅ 成功添加镜像源: ${e} (${t})`);return}if(t===`delete`){let e=n[0];e||(A.error(`❌ 参数错误!请使用: vii mirror delete <name>`),process.exit(1));let t=O().find(t=>t.name.toLowerCase()===e.toLowerCase());t||(A.error(`❌ 未找到镜像源: ${e}`),process.exit(1)),t.isBuiltin&&(A.error(`❌ 权限错误!内置镜像源 "${e}" 不允许删除。`),process.exit(1)),ce(D().filter(t=>t.name.toLowerCase()!==e.toLowerCase())),A.success(`✅ 成功删除镜像源: ${e}`);return}A.error(`❌ 未知子命令: ${t}`),process.exit(1)}}];function Ht(e,t){let n=Array.from({length:e.length+1},()=>Array(t.length+1).fill(0));for(let t=0;t<=e.length;t++)n[t][0]=t;for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=e.length;r++)for(let i=1;i<=t.length;i++)e[r-1]===t[i-1]?n[r][i]=n[r-1][i-1]:n[r][i]=Math.min(n[r-1][i-1]+1,n[r][i-1]+1,n[r-1][i]+1);return n[e.length][t.length]}async function Ut(e){let t=e.slice(2),n=t[0];if(n===`release`){let e={},n=t.slice(1);for(let t=0;t<n.length;t++){let r=n[t];if(r===`--dry-run`)e.dryRun=!0;else if(r===`--skip-push`)e.skipPush=!0;else if(r===`--skip-publish`)e.skipPublish=!0;else if(r===`--skip-confirm`)e.skipConfirm=!0;else if(r===`--skip-changelog`)e.skipChangelog=!0;else if(r===`--skip-github-release`)e.skipGithubRelease=!0;else if(r===`--patch`||r===`-p`)e.patch=!0;else if(r===`--minor`||r===`-m`)e.minor=!0;else if(r===`--major`)e.major=!0;else if(r===`--custom`){let r=n[t+1];r&&!r.startsWith(`-`)?(e.custom=r,t++):(A.error(`选项 --custom 需要指定版本号`),process.exit(1))}else if(r.startsWith(`--custom=`))e.custom=r.split(`=`)[1];else if(r===`--pre-release`||r===`--prerelease`){let r=n[t+1];r&&[`alpha`,`beta`,`rc`].includes(r)?(e.preRelease=r,t++):(A.error(`选项 --pre-release 需要指定 alpha|beta|rc`),process.exit(1))}else if(r.startsWith(`--pre-release=`)||r.startsWith(`--prerelease=`)){let t=r.split(`=`)[1];[`alpha`,`beta`,`rc`].includes(t)?e.preRelease=t:(A.error(`选项 --pre-release 值必须是 alpha|beta|rc`),process.exit(1))}else r.startsWith(`-`)?(A.error(`不支持的选项: ${r}`),process.exit(1)):(A.error(`不支持的参数: ${r}`),process.exit(1))}let r=$.find(e=>e.name===`release`);if(r){try{await r.action(e)}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}return}}if(n===`list`){let e=t.slice(1);e.length>0&&(A.error(`命令 "list" 不需要任何参数或选项: ${e.join(` `)}`),process.exit(1));let n=$.find(e=>e.name===`list`);if(n){try{await n.action({})}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}return}}if(n===`mirror`){let e=t[1],n=t.slice(2),r=$.find(e=>e.name===`mirror`);if(r){try{await r.action({subcommand:e,args:n})}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}return}}if(n===`init`||n===`create`)t=t.slice(1);else if(n&&!n.startsWith(`-`))for(let e of[`init`,`create`,`release`,`list`,`mirror`])Ht(n,e)<=1&&(A.error(`不支持的命令: ${n}。您是不是想输入 "${e}"?`),process.exit(1));let r,i,a,o=!1,s=[];for(let e=0;e<t.length;e++){let n=t[e];if(n===`-h`||n===`--help`||n===`help`)o=!0;else if(n===`-t`||n===`--template`){let i=t[e+1];i&&!i.startsWith(`-`)?(r=i,e++):(A.error(`选项 ${n} 需要指定模板名称`),process.exit(1))}else if(n===`-m`||n===`--mirror`){let r=t[e+1];r&&!r.startsWith(`-`)?(i=r,e++):(A.error(`选项 ${n} 需要指定 GitHub 镜像地址`),process.exit(1))}else n.startsWith(`-`)?(A.error(`不支持的选项: ${n}`),process.exit(1)):s.push(n)}if(s.length>1?(A.error(`不支持的命令或多余的位置参数: ${s[0]}`),process.exit(1)):s.length===1&&(a=s[0]),o){console.log(`Usage: vii [OPTION]... [DIRECTORY]
vii init [OPTION]... [DIRECTORY]
vii create [OPTION]... [DIRECTORY]
Create a new project in JavaScript or TypeScript.
With no arguments, start the CLI in interactive mode.
Commands:
init Create a new project (optional)
create Create a new project (alias for init)
release Release a new version
list List all built-in templates
mirror 管理 GitHub 镜像源 (add/delete/list/speed)
Options:
-t, --template NAME use a specific template
Available templates:
${B("vue-pc")}
${Y("vue-mobile")}
${kt("nest-ts")}
${z("uniapp-ts")}`,Ki=`${B(`vii current version: v${zi}`)}`,ke=[{name:"vue",display:"vue",color:B,variants:[{name:"vue-mobile",display:"JavaScript(Mobile)",color:He},{name:"vue-pc",display:"JavaScript(PC)",color:He},{name:"custom-create-vite",display:"Customize with create-cite \u2197",color:B,customCommand:"pnpm create vite"}]},{name:"nest",display:"nestjs",color:Ji,variants:[{name:"nest-ts",display:"TypeScript",color:z},{name:"custom-create-nest",display:"Customize with create-nest \u2197",color:kt,customCommand:"pnpm dlx @nestjs/cli new"}]},{name:"uniapp",display:"uni-app",color:Y,variants:[{name:"uniapp-ts",display:"TypeScript",color:z},{name:"uniapp",display:"JavaScript",color:He}]},{name:"crm",display:"crm",color:Y,variants:[{name:"crm",display:"JavaScript",color:z},{name:"crm-mobile",display:"JavaScript",color:B}]}],Vt=ke.map(t=>t.variants.map(o=>o.name)).reduce((t,o)=>t.concat(o),[]),Ve="vii-project";async function Gi(){const t=Wt(N._[0]),o=N.template||N.t,f=N.version||N.v;if(N.help){console.log(Ui);return}else if(f){console.log(Ki);return}let e=t||Ve;const a=()=>A.basename(A.resolve(e));let l;Lt.override({overwrite:N.overwrite});try{l=await Lt([{type:t?null:"text",name:"projectName",message:H("Project name:"),initial:Ve,onState:v=>{e=Wt(v.value)||Ve}},{type:()=>!D.existsSync(e)||Xi(e)?null:"select",name:"overwrite",message:()=>(e==="."?"Current directory":`Target directory "${e}"`)+" is not empty. Please choose how to proceed:",initial:0,choices:[{title:"Cancel operation",value:"no"},{title:"Remove existing files and continue",value:"yes"},{title:"Ignore files and continue",value:"ignore"}]},{type:(v,{overwrite:b})=>{if(b==="no")throw new Error(Y("\u2716")+" Operation cancelled");return null},name:"overwriteChecker"},{type:()=>zt(a())?null:"text",name:"packageName",message:H("Package name:"),initial:()=>Zi(a()),validate:v=>zt(v)||"Invalid package.json name"},{type:o&&Vt.includes(o)?null:"select",name:"framework",message:typeof o=="string"&&!Vt.includes(o)?H(`"${o}" isn't a valid template. Please choose from below: `):H("Select a framework:"),initial:0,choices:ke.map(v=>{const b=v.color;return{title:b(v.display||v.name),value:v}})},{type:v=>typeof v=="object"?"select":null,name:"variant",message:H("Select a variant:"),choices:v=>v.variants.map(b=>{const w=b.color;return{title:w(b.name||b.display),value:b.name}})}],{onCancel:()=>{throw new Error(Y("\u2716")+" Operation cancelled")}})}catch(v){console.log(v.message);return}const{framework:r,overwrite:d,packageName:i,variant:n}=l,s=A.join(Le,e);d==="yes"?Qi(s):D.existsSync(s)||D.mkdirSync(s,{recursive:!0});const u=n||r?.name||o,m=er(process.env.npm_config_user_agent),h=m?m.name:"pnpm",c=h==="yarn"&&m?.version.startsWith("1."),{customCommand:p}=ke.flatMap(v=>v.variants).find(v=>v.name===u)??{};if(p){const v=p.replace(/^npm create /,()=>h==="bun"?"bun x create-":`${h} create `).replace("@latest",()=>c?"":"@latest").replace(/^npm exec/,()=>h==="pnpm"?"pnpm dlx":h==="yarn"&&!c?"yarn dlx":h==="bun"?"bun x":"npm exec"),[b,...w]=v.split(" "),S=w.map($=>$.replace("TARGET_DIR",()=>e)),{status:x}=di.sync(b,S,{stdio:"inherit"});process.exit(x??0)}console.log(`
Scaffolding project in ${s}...`),await tr("vfiee/project-boilerplate",s,n);const g=(v,b)=>{const w=A.join(s,v);D.writeFileSync(w,b)},y=JSON.parse(D.readFileSync(A.join(s,"package.json"),"utf-8"));y.name=i||a(),g("package.json",JSON.stringify(y,null,2)+`
`);const E=A.relative(Le,s);switch(console.log(`
Done. Now run:
`),s!==Le&&console.log(` cd ${E.includes(" ")?`"${E}"`:E}`),h){case"yarn":console.log(" yarn"),console.log(" yarn dev");break;default:console.log(` ${h} install`),console.log(` ${h} run dev`);break}console.log()}function Wt(t){return t?.trim().replace(/\/+$/g,"")}function zt(t){return/^(?:@[a-z\d\-*~][a-z\d\-*._~]*\/)?[a-z\d\-~][a-z\d\-._~]*$/.test(t)}function Zi(t){return t.trim().toLowerCase().replace(/\s+/g,"-").replace(/^[._]/,"").replace(/[^a-z\d\-~]+/g,"-")}function Xi(t){const o=D.readdirSync(t);return o.length===0||o.length===1&&o[0]===".git"}function Qi(t){if(D.existsSync(t))for(const o of D.readdirSync(t))o!==".git"&&D.rmSync(A.resolve(t,o),{recursive:!0,force:!0})}function er(t){if(!t)return;const o=t.split(" ")[0].split("/");return{name:o[0],version:o[1]}}function tr(t,o,f="main"){const{promise:e,resolve:a,reject:l}=ir();return Ut(`${t}#${f}`,o,r=>{if(r){l(r);return}a(!0)}),e}function ir(){let t,o;return{promise:new Promise((f,e)=>{t=f,o=e}),resolve:t,reject:o}}Gi().catch(t=>{console.error(t)});
-m, --mirror URL use a specific github mirror for cloning`);return}let c=$.find(e=>e.name===`init`);if(c)try{await c.action({projectName:a,template:r,targetDir:a?`./${a}`:void 0,mirror:i})}catch(e){A.error(`命令执行失败: ${e.message}`),process.exit(1)}}const Wt=process.argv;Ut(Wt);export{};
#!/usr/bin/env node
import './dist/index.mjs'
import "./dist/index.mjs";
{
"name": "@vyron/cli",
"version": "1.2.4",
"type": "module",
"version": "2.1.0",
"homepage": "https://github.com/vfiee/project-boilerplate",
"license": "MIT",
"author": "vyron",
"repository": {
"type": "git",
"url": "git+https://github.com/vfiee/project-boilerplate.git",
"directory": "packages/cli"
},
"bin": {

@@ -15,30 +20,28 @@ "vi": "index.js",

],
"engines": {
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
"type": "module",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "git+https://github.com/vfiee/project-boilerplate.git",
"directory": "packages/cli"
"scripts": {
"dev": "node -e \"import('fs').then(fs => fs.writeFileSync('index.js', '#!/usr/bin/env node\\nimport \\\"./dist/index.mjs\\\";\\n', { mode: 0o755 }))\" && vp pack --watch",
"build": "vp pack && node -e \"import('fs').then(fs => fs.writeFileSync('index.js', '#!/usr/bin/env node\\nimport \\\"./dist/index.mjs\\\";\\n', { mode: 0o755 }))\"",
"typecheck": "vp check --no-fmt --no-lint",
"test": "vitest run",
"prepublishOnly": "pnpm run build",
"release": "bumpp -y --all"
},
"homepage": "https://github.com/vfiee/project-boilerplate",
"dependencies": {
"ora": "^9.4.0",
"prompts": "^2.4.2"
},
"devDependencies": {
"@types/minimist": "^1.2.5",
"@types/prompts": "^2.4.9",
"cross-spawn": "^7.0.6",
"minimist": "^1.2.8",
"picocolors": "^1.1.1",
"prompts": "^2.4.2",
"unbuild": "^3.3.1"
"@vitest/coverage-v8": "^4.1.8",
"typescript": "^5.7.2",
"vite-plus": "^0.1.24",
"vitest": "^4.1.8"
},
"dependencies": {
"download-git-repo": "^3.0.2"
},
"scripts": {
"dev": "unbuild --stub",
"build": "unbuild",
"typecheck": "tsc --noEmit",
"release": "bumpp -y --all",
"start": "tsx ./src/index.ts"
"engines": {
"node": "^18.0.0 || ^20.0.0 || >=22.0.0"
}
}
}
MIT License
Copyright (c) 2024-present, vyron
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.