@zjex/git-workflow 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,60 +1,93 @@
1
1
  #!/usr/bin/env node --no-warnings
2
- import{cac as Ne}from"cac";import{execSync as M}from"child_process";var o={red:e=>`\x1B[31m${e}\x1B[0m`,green:e=>`\x1B[32m${e}\x1B[0m`,yellow:e=>`\x1B[33m${e}\x1B[0m`,dim:e=>`\x1B[2m${e}\x1B[0m`},T=new Date().toISOString().slice(0,10).replace(/-/g,""),c={helpMode:"always",style:{keysHelpTip:e=>`\x1B[2m${e.map(([n,t])=>`${n} ${t}`).join(" \u2022 ")} \u2022 Ctrl+C quit\x1B[0m`}};function I(e,a=!1){try{return M(e,{encoding:"utf-8",stdio:a?"pipe":"inherit"})}catch(n){if(a)return"";throw n}}function h(e){try{return M(e,{encoding:"utf-8"}).trim()}catch{return""}}function P(){try{M("git rev-parse --is-inside-work-tree",{stdio:"pipe"})}catch{console.log(o.red("\u9519\u8BEF: \u5F53\u524D\u76EE\u5F55\u4E0D\u662F git \u4ED3\u5E93")),process.exit(1)}}function z(){let e=h("git branch -r").split(`
3
- `).map(a=>a.trim());return e.includes("origin/main")?"origin/main":e.includes("origin/master")?"origin/master":"origin/main"}function d(){console.log(o.dim("\u2500".repeat(40)))}import{execSync as R}from"child_process";import{select as E,input as Z}from"@inquirer/prompts";import C from"ora";import{existsSync as K,readFileSync as me}from"fs";import{join as he}from"path";var A={featurePrefix:"feature",hotfixPrefix:"hotfix",requireId:!1,featureIdLabel:"Story ID",hotfixIdLabel:"Issue ID"};function pe(){return h("git rev-parse --show-toplevel")}function $e(){let e=[".gwrc.json",".gwrc","gw.config.json"];for(let a of e)if(K(a))return a;try{let a=pe();if(a)for(let n of e){let t=he(a,n);if(K(t))return t}}catch{}return null}function de(){let e=$e();if(!e)return A;try{let a=me(e,"utf-8"),n=JSON.parse(a);return{...A,...n}}catch{return console.warn(`\u914D\u7F6E\u6587\u4EF6\u89E3\u6790\u5931\u8D25: ${e}`),A}}var H=null;function N(){return H||(H=de()),H}async function W(e){let a=N(),n=e==="feature"?a.featureIdLabel:a.hotfixIdLabel,t=e==="feature"?a.featurePrefix:a.hotfixPrefix,r=a.requireId?`\u8BF7\u8F93\u5165${n}:`:`\u8BF7\u8F93\u5165${n} (\u53EF\u8DF3\u8FC7):`,l=await Z({message:r,theme:c});if(a.requireId&&!l)return console.log(o.red(`${n}\u4E0D\u80FD\u4E3A\u7A7A`)),null;let i=await Z({message:"\u8BF7\u8F93\u5165\u63CF\u8FF0:",theme:c});return i?l?`${t}/${T}-${l}-${i}`:`${t}/${T}-${i}`:(console.log(o.red("\u63CF\u8FF0\u4E0D\u80FD\u4E3A\u7A7A")),null)}async function J(e,a){let n=N(),t=await W(e);if(!t)return;d();let r;a?r=`origin/${a}`:n.baseBranch?r=`origin/${n.baseBranch}`:r=z();let l=C(`\u6B63\u5728\u4ECE ${r} \u521B\u5EFA\u5206\u652F...`).start();try{I(`git fetch origin ${r.replace("origin/","")}`,!0),I(`git checkout -b "${t}" ${r}`),l.succeed(`\u5206\u652F\u521B\u5EFA\u6210\u529F: ${t}`),d();let i;if(n.autoPush!==void 0?(i=n.autoPush,i&&console.log(o.dim("(\u81EA\u52A8\u63A8\u9001\u5DF2\u542F\u7528)"))):i=await E({message:"\u662F\u5426\u63A8\u9001\u5230\u8FDC\u7A0B?",choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:c}),i){let g=C("\u6B63\u5728\u63A8\u9001\u5230\u8FDC\u7A0B...").start();try{R(`git push -u origin "${t}"`,{stdio:"pipe"}),g.succeed(`\u5DF2\u63A8\u9001\u5230\u8FDC\u7A0B: origin/${t}`)}catch{g.warn("\u8FDC\u7A0B\u63A8\u9001\u5931\u8D25\uFF0C\u53EF\u7A0D\u540E\u624B\u52A8\u6267\u884C: git push -u origin "+t)}}}catch{l.fail("\u5206\u652F\u521B\u5EFA\u5931\u8D25")}}async function Q(e){let a=C("\u6B63\u5728\u83B7\u53D6\u5206\u652F\u4FE1\u606F...").start();I("git fetch --all --prune",!0),a.succeed("\u5206\u652F\u4FE1\u606F\u5DF2\u66F4\u65B0"),d();let n=h("git branch --show-current"),t=e;if(!t){let g=h("git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)'").split(`
4
- `).filter(u=>u&&u!==n);if(g.length===0){console.log(o.yellow("\u6CA1\u6709\u53EF\u5220\u9664\u7684\u672C\u5730\u5206\u652F"));return}let s=g.map(u=>({name:h(`git branch -r | grep "origin/${u}$"`)?`${u} (\u672C\u5730+\u8FDC\u7A0B)`:`${u} (\u4EC5\u672C\u5730)`,value:u}));if(s.push({name:"\u53D6\u6D88",value:"__cancel__"}),t=await E({message:"\u9009\u62E9\u8981\u5220\u9664\u7684\u5206\u652F (\u6309\u6700\u8FD1\u4F7F\u7528\u6392\u5E8F):",choices:s,theme:c}),t==="__cancel__"){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}}if(t===n){console.log(o.red("\u4E0D\u80FD\u5220\u9664\u5F53\u524D\u6240\u5728\u5206\u652F"));return}let r=h(`git branch --list "${t}"`),l=h(`git branch -r | grep "origin/${t}$"`);if(!r){if(l){if(console.log(o.yellow(`\u672C\u5730\u5206\u652F\u4E0D\u5B58\u5728\uFF0C\u4F46\u8FDC\u7A0B\u5206\u652F\u5B58\u5728: origin/${t}`)),await E({message:`\u662F\u5426\u5220\u9664\u8FDC\u7A0B\u5206\u652F origin/${t}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:c})){let s=C(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u5206\u652F: origin/${t}`).start();try{R(`git push origin --delete "${t}"`,{stdio:"pipe"}),s.succeed(`\u8FDC\u7A0B\u5206\u652F\u5DF2\u5220\u9664: origin/${t}`)}catch{s.fail("\u8FDC\u7A0B\u5206\u652F\u5220\u9664\u5931\u8D25")}}}else console.log(o.red(`\u5206\u652F\u4E0D\u5B58\u5728: ${t}`));return}let i=C(`\u6B63\u5728\u5220\u9664\u672C\u5730\u5206\u652F: ${t}`).start();try{R(`git branch -D "${t}"`,{stdio:"pipe"}),i.succeed(`\u672C\u5730\u5206\u652F\u5DF2\u5220\u9664: ${t}`)}catch{i.fail("\u672C\u5730\u5206\u652F\u5220\u9664\u5931\u8D25");return}if(l&&(d(),await E({message:`\u662F\u5426\u540C\u65F6\u5220\u9664\u8FDC\u7A0B\u5206\u652F origin/${t}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:c}))){let s=C(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u5206\u652F: origin/${t}`).start();try{R(`git push origin --delete "${t}"`,{stdio:"pipe"}),s.succeed(`\u8FDC\u7A0B\u5206\u652F\u5DF2\u5220\u9664: origin/${t}`)}catch{s.fail("\u8FDC\u7A0B\u5206\u652F\u5220\u9664\u5931\u8D25")}}}import{execSync as X}from"child_process";import{select as U,input as ee}from"@inquirer/prompts";import L from"ora";async function ae(e){let a=L("\u6B63\u5728\u83B7\u53D6 tags...").start();I("git fetch --tags",!0),a.stop();let n=e?`${e}*`:"",t=h(`git tag -l ${n} --sort=-v:refname`).split(`
5
- `).filter(Boolean);if(t.length===0){console.log(o.yellow(e?`\u6CA1\u6709 '${e}' \u5F00\u5934\u7684 tag`:"\u6CA1\u6709 tag"));return}console.log(o.green(e?`\u4EE5 '${e}' \u5F00\u5934\u7684 tags:`:"\u6240\u6709 tags:")),t.slice(0,20).forEach(r=>console.log(` ${r}`)),t.length>20&&console.log(o.yellow(`
6
- \u5171 ${t.length} \u4E2A\uFF0C\u4EC5\u663E\u793A\u524D 20 \u4E2A`))}async function ne(e){let a=N(),n=L("\u6B63\u5728\u83B7\u53D6 tags...").start();I("git fetch --tags",!0),n.stop(),d();let t=e;if(!t&&a.defaultTagPrefix&&(t=a.defaultTagPrefix,console.log(o.dim(`(\u4F7F\u7528\u914D\u7F6E\u7684\u9ED8\u8BA4\u524D\u7F00: ${t})`))),!t){let $=h("git tag -l").split(`
7
- `).filter(Boolean),v=[...new Set($.map(x=>x.replace(/[0-9].*/,"")).filter(Boolean))];if(v.length===0){if(t=await ee({message:"\u5F53\u524D\u4ED3\u5E93\u6CA1\u6709 tag\uFF0C\u8BF7\u8F93\u5165\u65B0\u524D\u7F00 (\u5982 v):",theme:c}),!t){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}}else{let x=v.map(p=>{let f=h(`git tag -l "${p}*" --sort=-v:refname | head -1`),_=f?h(`git log -1 --format=%ct "${f}" 2>/dev/null`):"0";return{prefix:p,latest:f,date:parseInt(_)||0}});x.sort((p,f)=>f.date-p.date);let m=x.map(({prefix:p,latest:f})=>({name:`${p} (\u6700\u65B0: ${f})`,value:p}));if(m.push({name:"\u8F93\u5165\u65B0\u524D\u7F00...",value:"__new__"}),t=await U({message:"\u9009\u62E9 tag \u524D\u7F00:",choices:m,theme:c}),t==="__new__"&&(t=await ee({message:"\u8BF7\u8F93\u5165\u65B0\u524D\u7F00:",theme:c}),!t)){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}}}let r=h(`git tag -l "${t}*" --sort=-v:refname | head -1`);if(!r){let $=`${t}1.0.0`;console.log(o.yellow(`\u672A\u627E\u5230 '${t}' \u5F00\u5934\u7684 tag\uFF0C\u5C06\u521B\u5EFA ${$}`)),await U({message:`\u786E\u8BA4\u521B\u5EFA ${$}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:c})&&te($);return}console.log(o.yellow(`\u5F53\u524D\u6700\u65B0 tag: ${r}`)),d();let l=r.slice(t.length),i=l.match(/^(\d+)\.(\d+)\.(\d+)-([a-zA-Z]+)\.(\d+)$/),g=l.match(/^(\d+)\.(\d+)\.(\d+)$/),s=l.match(/^(\d+)\.(\d+)$/),u=l.match(/^(\d+)$/),w=[];if(i){let[,$,v,x,m,p]=i,f=Number($),_=Number(v),q=Number(x),Y=Number(p),O=`${f}.${_}.${q}`;w=[{name:`pre \u2192 ${t}${O}-${m}.${Y+1}`,value:`${t}${O}-${m}.${Y+1}`},{name:`release\u2192 ${t}${O}`,value:`${t}${O}`},{name:`patch \u2192 ${t}${f}.${_}.${q+1}`,value:`${t}${f}.${_}.${q+1}`},{name:`minor \u2192 ${t}${f}.${_+1}.0`,value:`${t}${f}.${_+1}.0`},{name:`major \u2192 ${t}${f+1}.0.0`,value:`${t}${f+1}.0.0`}]}else if(g){let[,$,v,x]=g,m=Number($),p=Number(v),f=Number(x);w=[{name:`patch \u2192 ${t}${m}.${p}.${f+1}`,value:`${t}${m}.${p}.${f+1}`},{name:`minor \u2192 ${t}${m}.${p+1}.0`,value:`${t}${m}.${p+1}.0`},{name:`major \u2192 ${t}${m+1}.0.0`,value:`${t}${m+1}.0.0`},{name:`alpha \u2192 ${t}${m}.${p}.${f+1}-alpha.1`,value:`${t}${m}.${p}.${f+1}-alpha.1`},{name:`beta \u2192 ${t}${m}.${p}.${f+1}-beta.1`,value:`${t}${m}.${p}.${f+1}-beta.1`},{name:`rc \u2192 ${t}${m}.${p}.${f+1}-rc.1`,value:`${t}${m}.${p}.${f+1}-rc.1`}]}else if(s){let[,$,v]=s,x=Number($),m=Number(v);w=[{name:`minor \u2192 ${t}${x}.${m+1}`,value:`${t}${x}.${m+1}`},{name:`major \u2192 ${t}${x+1}.0`,value:`${t}${x+1}.0`}]}else if(u){let $=Number(u[1]);w=[{name:`next \u2192 ${t}${$+1}`,value:`${t}${$+1}`}]}else{console.log(o.red(`\u65E0\u6CD5\u89E3\u6790\u7248\u672C\u53F7: ${l}`));return}w.push({name:"\u53D6\u6D88",value:"__cancel__"});let k=await U({message:"\u9009\u62E9\u7248\u672C\u7C7B\u578B:",choices:w,theme:c});if(k==="__cancel__"){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}te(k)}function te(e){d();let a=L(`\u6B63\u5728\u521B\u5EFA tag: ${e}`).start();try{X(`git tag -a "${e}" -m "Release ${e}"`,{stdio:"pipe"}),a.succeed(`Tag \u521B\u5EFA\u6210\u529F: ${e}`)}catch{a.fail("tag \u521B\u5EFA\u5931\u8D25");return}let n=L("\u6B63\u5728\u63A8\u9001\u5230\u8FDC\u7A0B...").start();try{X(`git push origin "${e}"`,{stdio:"pipe"}),n.succeed(`Tag \u5DF2\u63A8\u9001: ${e}`)}catch{n.warn(`\u8FDC\u7A0B\u63A8\u9001\u5931\u8D25\uFF0C\u53EF\u7A0D\u540E\u624B\u52A8\u6267\u884C: git push origin ${e}`)}}import{readFileSync as oe,writeFileSync as we}from"fs";import{select as xe}from"@inquirer/prompts";function be(){return JSON.parse(oe("package.json","utf-8")).version||"0.0.0"}function ve(e){let a=JSON.parse(oe("package.json","utf-8"));a.version=e,we("package.json",JSON.stringify(a,null," ")+`
8
- `)}function ye(e){let a=e.match(/^(\d+)\.(\d+)\.(\d+)-([a-zA-Z]+)\.(\d+)$/),n=e.match(/^(\d+)\.(\d+)\.(\d+)$/);if(a){let[,t,r,l,i,g]=a,s=Number(t),u=Number(r),w=Number(l),k=Number(g),$=`${s}.${u}.${w}`;return[{name:`pre \u2192 ${$}-${i}.${k+1}`,value:`${$}-${i}.${k+1}`},{name:`release \u2192 ${$}`,value:$},{name:`patch \u2192 ${s}.${u}.${w+1}`,value:`${s}.${u}.${w+1}`},{name:`minor \u2192 ${s}.${u+1}.0`,value:`${s}.${u+1}.0`},{name:`major \u2192 ${s+1}.0.0`,value:`${s+1}.0.0`}]}if(n){let[,t,r,l]=n,i=Number(t),g=Number(r),s=Number(l);return[{name:`patch \u2192 ${i}.${g}.${s+1}`,value:`${i}.${g}.${s+1}`},{name:`minor \u2192 ${i}.${g+1}.0`,value:`${i}.${g+1}.0`},{name:`major \u2192 ${i+1}.0.0`,value:`${i+1}.0.0`},{name:`alpha \u2192 ${i}.${g}.${s+1}-alpha.1`,value:`${i}.${g}.${s+1}-alpha.1`},{name:`beta \u2192 ${i}.${g}.${s+1}-beta.1`,value:`${i}.${g}.${s+1}-beta.1`},{name:`rc \u2192 ${i}.${g}.${s+1}-rc.1`,value:`${i}.${g}.${s+1}-rc.1`}]}return[{name:"patch \u2192 0.0.1",value:"0.0.1"},{name:"minor \u2192 0.1.0",value:"0.1.0"},{name:"major \u2192 1.0.0",value:"1.0.0"}]}async function se(){let e=be();console.log(o.yellow(`\u5F53\u524D\u7248\u672C: ${e}`)),d();let a=ye(e);a.push({name:"\u53D6\u6D88",value:"__cancel__"});let n=await xe({message:"\u9009\u62E9\u65B0\u7248\u672C:",choices:a,theme:c});if(n==="__cancel__"){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}ve(n),d(),console.log(o.green(`\u2713 \u7248\u672C\u53F7\u5DF2\u66F4\u65B0: ${e} \u2192 ${n}`))}import{existsSync as Se,writeFileSync as _e}from"fs";import{select as Ie,input as B,confirm as re}from"@inquirer/prompts";var G=".gwrc.json";async function ie(){if(Se(G)&&!await re({message:`${G} \u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6?`,default:!1,theme:c})){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}console.log(o.dim(`\u914D\u7F6E git-workflow\uFF0C\u76F4\u63A5\u56DE\u8F66\u4F7F\u7528\u9ED8\u8BA4\u503C
9
- `));let e={},a=await B({message:"\u9ED8\u8BA4\u57FA\u7840\u5206\u652F (\u7559\u7A7A\u81EA\u52A8\u68C0\u6D4B main/master):",theme:c});a&&(e.baseBranch=a),d();let n=await B({message:"Feature \u5206\u652F\u524D\u7F00:",default:"feature",theme:c});n!=="feature"&&(e.featurePrefix=n);let t=await B({message:"Hotfix \u5206\u652F\u524D\u7F00:",default:"hotfix",theme:c});t!=="hotfix"&&(e.hotfixPrefix=t),d(),await re({message:"\u662F\u5426\u8981\u6C42\u5FC5\u586B ID (Story ID / Issue ID)?",default:!1,theme:c})&&(e.requireId=!0);let l=await B({message:"Feature \u5206\u652F ID \u6807\u7B7E:",default:"Story ID",theme:c});l!=="Story ID"&&(e.featureIdLabel=l);let i=await B({message:"Hotfix \u5206\u652F ID \u6807\u7B7E:",default:"Issue ID",theme:c});i!=="Issue ID"&&(e.hotfixIdLabel=i),d();let g=await B({message:"\u9ED8\u8BA4 Tag \u524D\u7F00 (\u7559\u7A7A\u5219\u6BCF\u6B21\u9009\u62E9):",theme:c});g&&(e.defaultTagPrefix=g);let s=await Ie({message:"\u521B\u5EFA\u5206\u652F\u540E\u662F\u5426\u81EA\u52A8\u63A8\u9001?",choices:[{name:"\u6BCF\u6B21\u8BE2\u95EE",value:"ask"},{name:"\u81EA\u52A8\u63A8\u9001",value:"yes"},{name:"\u4E0D\u63A8\u9001",value:"no"}],theme:c});s==="yes"&&(e.autoPush=!0),s==="no"&&(e.autoPush=!1),d();let u=JSON.stringify(e,null,2);_e(G,u+`
10
- `),console.log(o.green(`\u2713 \u914D\u7F6E\u5DF2\u4FDD\u5B58\u5230 ${G}`)),console.log(o.dim(`
11
- `+u))}import{execSync as D}from"child_process";import{select as j,input as ge}from"@inquirer/prompts";import F from"ora";function Pe(){let e=h('git stash list --format="%gd|%s|%ar"');return e?e.split(`
12
- `).filter(Boolean).map(a=>{let[n,t,r]=a.split("|"),l=parseInt(n.match(/stash@\{(\d+)\}/)?.[1]||"0"),g=t.match(/(?:WIP on|On) ([^:]+):/)?.[1]||"unknown",s=t.replace(/(?:WIP on|On) [^:]+:\s*/,"");t.startsWith("WIP")&&(s=s.replace(/^[a-f0-9]+ /,"")),s=s||"(no message)";let u=h(`git stash show stash@{${l}} --name-only 2>/dev/null`),w=u?u.split(`
13
- `).filter(Boolean):[];return{index:l,branch:g,message:s,date:r,files:w}}):[]}function Te(e){let a=e.files.length,n=a>0?o.dim(` (${a} \u6587\u4EF6)`):"";return`${o.yellow(`[${e.index}]`)} ${o.green(e.branch)} ${e.message}${n} ${o.dim(e.date)}`}function Ce(e){console.log(),console.log(o.yellow(`Stash #${e.index}`)),console.log(`\u5206\u652F: ${o.green(e.branch)}`),console.log(`\u6D88\u606F: ${e.message}`),console.log(`\u65F6\u95F4: ${o.dim(e.date)}`),e.files.length>0&&(console.log(`\u6587\u4EF6 (${e.files.length}):`),e.files.slice(0,10).forEach(a=>console.log(` ${o.dim("\u2022")} ${a}`)),e.files.length>10&&console.log(o.dim(` ... \u8FD8\u6709 ${e.files.length-10} \u4E2A\u6587\u4EF6`)))}async function V(){let e=Pe();if(e.length===0){console.log(o.yellow("\u6CA1\u6709 stash \u8BB0\u5F55")),h("git status --porcelain")&&await j({message:"\u68C0\u6D4B\u5230\u672A\u63D0\u4EA4\u7684\u53D8\u66F4\uFF0C\u662F\u5426\u521B\u5EFA stash?",choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:c})&&await ce();return}console.log(o.green(`\u5171 ${e.length} \u4E2A stash:
14
- `));let a=e.map(r=>({name:Te(r),value:r.index.toString()}));a.push({name:o.dim("+ \u521B\u5EFA\u65B0 stash"),value:"__new__"}),a.push({name:o.dim("\u53D6\u6D88"),value:"__cancel__"});let n=await j({message:"\u9009\u62E9 stash:",choices:a,theme:c});if(n==="__cancel__")return;if(n==="__new__"){await ce();return}let t=e.find(r=>r.index.toString()===n);await fe(t)}async function fe(e){switch(Ce(e),d(),await j({message:"\u64CD\u4F5C:",choices:[{name:"\u5E94\u7528 (\u4FDD\u7559 stash)",value:"apply"},{name:"\u5F39\u51FA (\u5E94\u7528\u5E76\u5220\u9664)",value:"pop"},{name:"\u521B\u5EFA\u5206\u652F",value:"branch"},{name:"\u67E5\u770B\u5DEE\u5F02",value:"diff"},{name:"\u5220\u9664",value:"drop"},{name:"\u8FD4\u56DE\u5217\u8868",value:"back"},{name:"\u53D6\u6D88",value:"cancel"}],theme:c})){case"apply":le(e.index,!1);break;case"pop":le(e.index,!0);break;case"branch":await je(e.index);break;case"diff":await Be(e.index),await fe(e);break;case"drop":await ke(e.index);break;case"back":await V();break}}async function ce(){let e=h("git status --porcelain");if(!e){console.log(o.yellow("\u6CA1\u6709\u9700\u8981 stash \u7684\u53D8\u66F4"));return}let a=e.split(`
15
- `).some(l=>l.startsWith("??")),n=!1;a&&(n=await j({message:"\u68C0\u6D4B\u5230\u672A\u8DDF\u8E2A\u7684\u6587\u4EF6\uFF0C\u662F\u5426\u4E00\u5E76 stash?",choices:[{name:"\u662F (\u5305\u542B\u672A\u8DDF\u8E2A\u6587\u4EF6)",value:!0},{name:"\u5426 (\u4EC5\u5DF2\u8DDF\u8E2A\u6587\u4EF6)",value:!1}],theme:c}));let t=await ge({message:"Stash \u6D88\u606F (\u53EF\u9009):",theme:c}),r=F("\u521B\u5EFA stash...").start();try{let l="git stash push";n&&(l+=" -u"),t&&(l+=` -m "${t.replace(/"/g,'\\"')}"`),D(l,{stdio:"pipe"}),r.succeed("Stash \u521B\u5EFA\u6210\u529F"),await V()}catch{r.fail("Stash \u521B\u5EFA\u5931\u8D25")}}function le(e,a){let n=a?"pop":"apply",t=F(`${a?"\u5F39\u51FA":"\u5E94\u7528"} stash...`).start();try{D(`git stash ${n} stash@{${e}}`,{stdio:"pipe"}),t.succeed(`Stash ${a?"\u5DF2\u5F39\u51FA":"\u5DF2\u5E94\u7528"}`)}catch{t.fail("\u64CD\u4F5C\u5931\u8D25\uFF0C\u53EF\u80FD\u5B58\u5728\u51B2\u7A81");let r=h("git status --porcelain");(r.includes("UU")||r.includes("AA"))&&console.log(o.yellow(`
16
- \u5B58\u5728\u51B2\u7A81\uFF0C\u8BF7\u624B\u52A8\u89E3\u51B3\u540E\u63D0\u4EA4`))}}async function Be(e){try{D(`git stash show -p --color=always stash@{${e}}`,{stdio:"inherit"}),console.log(),await ge({message:o.dim("\u6309 Enter \u8FD4\u56DE\u83DC\u5355..."),theme:c})}catch{console.log(o.red("\u65E0\u6CD5\u663E\u793A\u5DEE\u5F02"))}}async function je(e){let a=await j({message:"\u9009\u62E9\u5206\u652F\u7C7B\u578B:",choices:[{name:"feature",value:"feature"},{name:"hotfix",value:"hotfix"},{name:"\u53D6\u6D88",value:"__cancel__"}],theme:c});if(a==="__cancel__"){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}let n=await W(a);if(!n)return;let t=F(`\u521B\u5EFA\u5206\u652F ${n}...`).start();try{D(`git stash branch "${n}" stash@{${e}}`,{stdio:"pipe"}),t.succeed(`\u5206\u652F\u5DF2\u521B\u5EFA: ${n} (stash \u5DF2\u81EA\u52A8\u5F39\u51FA)`)}catch{t.fail("\u521B\u5EFA\u5206\u652F\u5931\u8D25")}}async function ke(e){if(!await j({message:`\u786E\u8BA4\u5220\u9664 stash@{${e}}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:c})){console.log(o.yellow("\u5DF2\u53D6\u6D88"));return}let n=F("\u5220\u9664 stash...").start();try{D(`git stash drop stash@{${e}}`,{stdio:"pipe"}),n.succeed("Stash \u5DF2\u5220\u9664")}catch{n.fail("\u5220\u9664\u5931\u8D25")}}function ue(){return`
2
+ var Vt=Object.create;var ze=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var zt=Object.getPrototypeOf,Yt=Object.prototype.hasOwnProperty;var ge=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,u)=>(typeof require<"u"?require:t)[u]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var Jt=(e,t)=>()=>(e&&(t=e(e=0)),t);var _=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Zt=(e,t,u,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kt(t))!Yt.call(e,o)&&o!==u&&ze(e,o,{get:()=>t[o],enumerable:!(n=Ht(t,o))||n.enumerable});return e};var ue=(e,t,u)=>(u=e!=null?Vt(zt(e)):{},Zt(t||!e||!e.__esModule?ze(u,"default",{value:e,enumerable:!0}):u,e));import Cu from"path";import{fileURLToPath as bu}from"url";var a=Jt(()=>{"use strict"});var Ze=_((Wu,Je)=>{"use strict";a();var en=ge("tty"),tn=en?.WriteStream?.prototype?.hasColors?.()??!1,C=(e,t)=>{if(!tn)return o=>o;let u=`\x1B[${e}m`,n=`\x1B[${t}m`;return o=>{let r=o+"",s=r.indexOf(n);if(s===-1)return u+r+n;let i=u,D=0,m=(t===22?n:"")+u;for(;s!==-1;)i+=r.slice(D,s)+m,D=s+n.length,s=r.indexOf(n,D);return i+=r.slice(D)+n,i}},F={};F.reset=C(0,0);F.bold=C(1,22);F.dim=C(2,22);F.italic=C(3,23);F.underline=C(4,24);F.overline=C(53,55);F.inverse=C(7,27);F.hidden=C(8,28);F.strikethrough=C(9,29);F.black=C(30,39);F.red=C(31,39);F.green=C(32,39);F.yellow=C(33,39);F.blue=C(34,39);F.magenta=C(35,39);F.cyan=C(36,39);F.white=C(37,39);F.gray=C(90,39);F.bgBlack=C(40,49);F.bgRed=C(41,49);F.bgGreen=C(42,49);F.bgYellow=C(43,49);F.bgBlue=C(44,49);F.bgMagenta=C(45,49);F.bgCyan=C(46,49);F.bgWhite=C(47,49);F.bgGray=C(100,49);F.redBright=C(91,39);F.greenBright=C(92,39);F.yellowBright=C(93,39);F.blueBright=C(94,39);F.magentaBright=C(95,39);F.cyanBright=C(96,39);F.whiteBright=C(97,39);F.bgRedBright=C(101,49);F.bgGreenBright=C(102,49);F.bgYellowBright=C(103,49);F.bgBlueBright=C(104,49);F.bgMagentaBright=C(105,49);F.bgCyanBright=C(106,49);F.bgWhiteBright=C(107,49);Je.exports=F});var ot=_((Eo,ut)=>{"use strict";a();ut.exports=fn;function cn(e){let t={defaultWidth:0,output:process.stdout,tty:ge("tty")};return e?(Object.keys(t).forEach(function(u){e[u]||(e[u]=t[u])}),e):t}function fn(e){let t=cn(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let u=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(u)&&u!==0)return u}return t.defaultWidth}});var st=_((wo,rt)=>{"use strict";a();rt.exports=({onlyFirst:e=!1}={})=>{let t=["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)","(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"].join("|");return new RegExp(t,e?void 0:"g")}});var pe=_((xo,it)=>{"use strict";a();var hn=st();it.exports=e=>typeof e=="string"?e.replace(hn(),""):e});var at=_(($o,de)=>{"use strict";a();var Dt=e=>Number.isNaN(e)?!1:e>=4352&&(e<=4447||e===9001||e===9002||11904<=e&&e<=12871&&e!==12351||12880<=e&&e<=19903||19968<=e&&e<=42182||43360<=e&&e<=43388||44032<=e&&e<=55203||63744<=e&&e<=64255||65040<=e&&e<=65049||65072<=e&&e<=65131||65281<=e&&e<=65376||65504<=e&&e<=65510||110592<=e&&e<=110593||127488<=e&&e<=127569||131072<=e&&e<=262141);de.exports=Dt;de.exports.default=Dt});var ct=_((So,lt)=>{"use strict";a();lt.exports=function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g}});var ht=_((ko,Fe)=>{"use strict";a();var gn=pe(),mn=at(),pn=ct(),ft=e=>{if(typeof e!="string"||e.length===0||(e=gn(e),e.length===0))return 0;e=e.replace(pn()," ");let t=0;for(let u=0;u<e.length;u++){let n=e.codePointAt(u);n<=31||n>=127&&n<=159||n>=768&&n<=879||(n>65535&&u++,t+=mn(n)?2:1)}return t};Fe.exports=ft;Fe.exports.default=ft});var mt=_((Lo,gt)=>{"use strict";a();gt.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Ce=_((jo,dt)=>{"use strict";a();var Y=mt(),pt={};for(let e of Object.keys(Y))pt[Y[e]]=e;var c={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};dt.exports=c;for(let e of Object.keys(c)){if(!("channels"in c[e]))throw new Error("missing channels property: "+e);if(!("labels"in c[e]))throw new Error("missing channel labels property: "+e);if(c[e].labels.length!==c[e].channels)throw new Error("channel and label counts mismatch: "+e);let{channels:t,labels:u}=c[e];delete c[e].channels,delete c[e].labels,Object.defineProperty(c[e],"channels",{value:t}),Object.defineProperty(c[e],"labels",{value:u})}c.rgb.hsl=function(e){let t=e[0]/255,u=e[1]/255,n=e[2]/255,o=Math.min(t,u,n),r=Math.max(t,u,n),s=r-o,i,D;r===o?i=0:t===r?i=(u-n)/s:u===r?i=2+(n-t)/s:n===r&&(i=4+(t-u)/s),i=Math.min(i*60,360),i<0&&(i+=360);let f=(o+r)/2;return r===o?D=0:f<=.5?D=s/(r+o):D=s/(2-r-o),[i,D*100,f*100]};c.rgb.hsv=function(e){let t,u,n,o,r,s=e[0]/255,i=e[1]/255,D=e[2]/255,f=Math.max(s,i,D),m=f-Math.min(s,i,D),g=function(b){return(f-b)/6/m+1/2};return m===0?(o=0,r=0):(r=m/f,t=g(s),u=g(i),n=g(D),s===f?o=n-u:i===f?o=1/3+t-n:D===f&&(o=2/3+u-t),o<0?o+=1:o>1&&(o-=1)),[o*360,r*100,f*100]};c.rgb.hwb=function(e){let t=e[0],u=e[1],n=e[2],o=c.rgb.hsl(e)[0],r=1/255*Math.min(t,Math.min(u,n));return n=1-1/255*Math.max(t,Math.max(u,n)),[o,r*100,n*100]};c.rgb.cmyk=function(e){let t=e[0]/255,u=e[1]/255,n=e[2]/255,o=Math.min(1-t,1-u,1-n),r=(1-t-o)/(1-o)||0,s=(1-u-o)/(1-o)||0,i=(1-n-o)/(1-o)||0;return[r*100,s*100,i*100,o*100]};function dn(e,t){return(e[0]-t[0])**2+(e[1]-t[1])**2+(e[2]-t[2])**2}c.rgb.keyword=function(e){let t=pt[e];if(t)return t;let u=1/0,n;for(let o of Object.keys(Y)){let r=Y[o],s=dn(e,r);s<u&&(u=s,n=o)}return n};c.keyword.rgb=function(e){return Y[e]};c.rgb.xyz=function(e){let t=e[0]/255,u=e[1]/255,n=e[2]/255;t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,u=u>.04045?((u+.055)/1.055)**2.4:u/12.92,n=n>.04045?((n+.055)/1.055)**2.4:n/12.92;let o=t*.4124+u*.3576+n*.1805,r=t*.2126+u*.7152+n*.0722,s=t*.0193+u*.1192+n*.9505;return[o*100,r*100,s*100]};c.rgb.lab=function(e){let t=c.rgb.xyz(e),u=t[0],n=t[1],o=t[2];u/=95.047,n/=100,o/=108.883,u=u>.008856?u**(1/3):7.787*u+16/116,n=n>.008856?n**(1/3):7.787*n+16/116,o=o>.008856?o**(1/3):7.787*o+16/116;let r=116*n-16,s=500*(u-n),i=200*(n-o);return[r,s,i]};c.hsl.rgb=function(e){let t=e[0]/360,u=e[1]/100,n=e[2]/100,o,r,s;if(u===0)return s=n*255,[s,s,s];n<.5?o=n*(1+u):o=n+u-n*u;let i=2*n-o,D=[0,0,0];for(let f=0;f<3;f++)r=t+1/3*-(f-1),r<0&&r++,r>1&&r--,6*r<1?s=i+(o-i)*6*r:2*r<1?s=o:3*r<2?s=i+(o-i)*(2/3-r)*6:s=i,D[f]=s*255;return D};c.hsl.hsv=function(e){let t=e[0],u=e[1]/100,n=e[2]/100,o=u,r=Math.max(n,.01);n*=2,u*=n<=1?n:2-n,o*=r<=1?r:2-r;let s=(n+u)/2,i=n===0?2*o/(r+o):2*u/(n+u);return[t,i*100,s*100]};c.hsv.rgb=function(e){let t=e[0]/60,u=e[1]/100,n=e[2]/100,o=Math.floor(t)%6,r=t-Math.floor(t),s=255*n*(1-u),i=255*n*(1-u*r),D=255*n*(1-u*(1-r));switch(n*=255,o){case 0:return[n,D,s];case 1:return[i,n,s];case 2:return[s,n,D];case 3:return[s,i,n];case 4:return[D,s,n];case 5:return[n,s,i]}};c.hsv.hsl=function(e){let t=e[0],u=e[1]/100,n=e[2]/100,o=Math.max(n,.01),r,s;s=(2-u)*n;let i=(2-u)*o;return r=u*o,r/=i<=1?i:2-i,r=r||0,s/=2,[t,r*100,s*100]};c.hwb.rgb=function(e){let t=e[0]/360,u=e[1]/100,n=e[2]/100,o=u+n,r;o>1&&(u/=o,n/=o);let s=Math.floor(6*t),i=1-n;r=6*t-s,(s&1)!==0&&(r=1-r);let D=u+r*(i-u),f,m,g;switch(s){default:case 6:case 0:f=i,m=D,g=u;break;case 1:f=D,m=i,g=u;break;case 2:f=u,m=i,g=D;break;case 3:f=u,m=D,g=i;break;case 4:f=D,m=u,g=i;break;case 5:f=i,m=u,g=D;break}return[f*255,m*255,g*255]};c.cmyk.rgb=function(e){let t=e[0]/100,u=e[1]/100,n=e[2]/100,o=e[3]/100,r=1-Math.min(1,t*(1-o)+o),s=1-Math.min(1,u*(1-o)+o),i=1-Math.min(1,n*(1-o)+o);return[r*255,s*255,i*255]};c.xyz.rgb=function(e){let t=e[0]/100,u=e[1]/100,n=e[2]/100,o,r,s;return o=t*3.2406+u*-1.5372+n*-.4986,r=t*-.9689+u*1.8758+n*.0415,s=t*.0557+u*-.204+n*1.057,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,o=Math.min(Math.max(0,o),1),r=Math.min(Math.max(0,r),1),s=Math.min(Math.max(0,s),1),[o*255,r*255,s*255]};c.xyz.lab=function(e){let t=e[0],u=e[1],n=e[2];t/=95.047,u/=100,n/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,u=u>.008856?u**(1/3):7.787*u+16/116,n=n>.008856?n**(1/3):7.787*n+16/116;let o=116*u-16,r=500*(t-u),s=200*(u-n);return[o,r,s]};c.lab.xyz=function(e){let t=e[0],u=e[1],n=e[2],o,r,s;r=(t+16)/116,o=u/500+r,s=r-n/200;let i=r**3,D=o**3,f=s**3;return r=i>.008856?i:(r-16/116)/7.787,o=D>.008856?D:(o-16/116)/7.787,s=f>.008856?f:(s-16/116)/7.787,o*=95.047,r*=100,s*=108.883,[o,r,s]};c.lab.lch=function(e){let t=e[0],u=e[1],n=e[2],o;o=Math.atan2(n,u)*360/2/Math.PI,o<0&&(o+=360);let s=Math.sqrt(u*u+n*n);return[t,s,o]};c.lch.lab=function(e){let t=e[0],u=e[1],o=e[2]/360*2*Math.PI,r=u*Math.cos(o),s=u*Math.sin(o);return[t,r,s]};c.rgb.ansi16=function(e,t=null){let[u,n,o]=e,r=t===null?c.rgb.hsv(e)[2]:t;if(r=Math.round(r/50),r===0)return 30;let s=30+(Math.round(o/255)<<2|Math.round(n/255)<<1|Math.round(u/255));return r===2&&(s+=60),s};c.hsv.ansi16=function(e){return c.rgb.ansi16(c.hsv.rgb(e),e[2])};c.rgb.ansi256=function(e){let t=e[0],u=e[1],n=e[2];return t===u&&u===n?t<8?16:t>248?231:Math.round((t-8)/247*24)+232:16+36*Math.round(t/255*5)+6*Math.round(u/255*5)+Math.round(n/255*5)};c.ansi16.rgb=function(e){let t=e%10;if(t===0||t===7)return e>50&&(t+=3.5),t=t/10.5*255,[t,t,t];let u=(~~(e>50)+1)*.5,n=(t&1)*u*255,o=(t>>1&1)*u*255,r=(t>>2&1)*u*255;return[n,o,r]};c.ansi256.rgb=function(e){if(e>=232){let r=(e-232)*10+8;return[r,r,r]}e-=16;let t,u=Math.floor(e/36)/5*255,n=Math.floor((t=e%36)/6)/5*255,o=t%6/5*255;return[u,n,o]};c.rgb.hex=function(e){let u=(((Math.round(e[0])&255)<<16)+((Math.round(e[1])&255)<<8)+(Math.round(e[2])&255)).toString(16).toUpperCase();return"000000".substring(u.length)+u};c.hex.rgb=function(e){let t=e.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!t)return[0,0,0];let u=t[0];t[0].length===3&&(u=u.split("").map(i=>i+i).join(""));let n=parseInt(u,16),o=n>>16&255,r=n>>8&255,s=n&255;return[o,r,s]};c.rgb.hcg=function(e){let t=e[0]/255,u=e[1]/255,n=e[2]/255,o=Math.max(Math.max(t,u),n),r=Math.min(Math.min(t,u),n),s=o-r,i,D;return s<1?i=r/(1-s):i=0,s<=0?D=0:o===t?D=(u-n)/s%6:o===u?D=2+(n-t)/s:D=4+(t-u)/s,D/=6,D%=1,[D*360,s*100,i*100]};c.hsl.hcg=function(e){let t=e[1]/100,u=e[2]/100,n=u<.5?2*t*u:2*t*(1-u),o=0;return n<1&&(o=(u-.5*n)/(1-n)),[e[0],n*100,o*100]};c.hsv.hcg=function(e){let t=e[1]/100,u=e[2]/100,n=t*u,o=0;return n<1&&(o=(u-n)/(1-n)),[e[0],n*100,o*100]};c.hcg.rgb=function(e){let t=e[0]/360,u=e[1]/100,n=e[2]/100;if(u===0)return[n*255,n*255,n*255];let o=[0,0,0],r=t%1*6,s=r%1,i=1-s,D=0;switch(Math.floor(r)){case 0:o[0]=1,o[1]=s,o[2]=0;break;case 1:o[0]=i,o[1]=1,o[2]=0;break;case 2:o[0]=0,o[1]=1,o[2]=s;break;case 3:o[0]=0,o[1]=i,o[2]=1;break;case 4:o[0]=s,o[1]=0,o[2]=1;break;default:o[0]=1,o[1]=0,o[2]=i}return D=(1-u)*n,[(u*o[0]+D)*255,(u*o[1]+D)*255,(u*o[2]+D)*255]};c.hcg.hsv=function(e){let t=e[1]/100,u=e[2]/100,n=t+u*(1-t),o=0;return n>0&&(o=t/n),[e[0],o*100,n*100]};c.hcg.hsl=function(e){let t=e[1]/100,n=e[2]/100*(1-t)+.5*t,o=0;return n>0&&n<.5?o=t/(2*n):n>=.5&&n<1&&(o=t/(2*(1-n))),[e[0],o*100,n*100]};c.hcg.hwb=function(e){let t=e[1]/100,u=e[2]/100,n=t+u*(1-t);return[e[0],(n-t)*100,(1-n)*100]};c.hwb.hcg=function(e){let t=e[1]/100,n=1-e[2]/100,o=n-t,r=0;return o<1&&(r=(n-o)/(1-o)),[e[0],o*100,r*100]};c.apple.rgb=function(e){return[e[0]/65535*255,e[1]/65535*255,e[2]/65535*255]};c.rgb.apple=function(e){return[e[0]/255*65535,e[1]/255*65535,e[2]/255*65535]};c.gray.rgb=function(e){return[e[0]/100*255,e[0]/100*255,e[0]/100*255]};c.gray.hsl=function(e){return[0,0,e[0]]};c.gray.hsv=c.gray.hsl;c.gray.hwb=function(e){return[0,100,e[0]]};c.gray.cmyk=function(e){return[0,0,0,e[0]]};c.gray.lab=function(e){return[e[0],0,0]};c.gray.hex=function(e){let t=Math.round(e[0]/100*255)&255,n=((t<<16)+(t<<8)+t).toString(16).toUpperCase();return"000000".substring(n.length)+n};c.rgb.gray=function(e){return[(e[0]+e[1]+e[2])/3/255*100]}});var Ct=_((Po,Ft)=>{"use strict";a();var oe=Ce();function Fn(){let e={},t=Object.keys(oe);for(let u=t.length,n=0;n<u;n++)e[t[n]]={distance:-1,parent:null};return e}function Cn(e){let t=Fn(),u=[e];for(t[e].distance=0;u.length;){let n=u.pop(),o=Object.keys(oe[n]);for(let r=o.length,s=0;s<r;s++){let i=o[s],D=t[i];D.distance===-1&&(D.distance=t[n].distance+1,D.parent=n,u.unshift(i))}}return t}function En(e,t){return function(u){return t(e(u))}}function bn(e,t){let u=[t[e].parent,e],n=oe[t[e].parent][e],o=t[e].parent;for(;t[o].parent;)u.unshift(t[o].parent),n=En(oe[t[o].parent][o],n),o=t[o].parent;return n.conversion=u,n}Ft.exports=function(e){let t=Cn(e),u={},n=Object.keys(t);for(let o=n.length,r=0;r<o;r++){let s=n[r];t[s].parent!==null&&(u[s]=bn(s,t))}return u}});var bt=_((Io,Et)=>{"use strict";a();var Ee=Ce(),wn=Ct(),N={},Bn=Object.keys(Ee);function xn(e){let t=function(...u){let n=u[0];return n==null?n:(n.length>1&&(u=n),e(u))};return"conversion"in e&&(t.conversion=e.conversion),t}function yn(e){let t=function(...u){let n=u[0];if(n==null)return n;n.length>1&&(u=n);let o=e(u);if(typeof o=="object")for(let r=o.length,s=0;s<r;s++)o[s]=Math.round(o[s]);return o};return"conversion"in e&&(t.conversion=e.conversion),t}Bn.forEach(e=>{N[e]={},Object.defineProperty(N[e],"channels",{value:Ee[e].channels}),Object.defineProperty(N[e],"labels",{value:Ee[e].labels});let t=wn(e);Object.keys(t).forEach(n=>{let o=t[n];N[e][n]=yn(o),N[e][n].raw=xn(o)})});Et.exports=N});var vt=_((Oo,$t)=>{"use strict";a();var wt=(e,t)=>(...u)=>`\x1B[${e(...u)+t}m`,Bt=(e,t)=>(...u)=>{let n=e(...u);return`\x1B[${38+t};5;${n}m`},xt=(e,t)=>(...u)=>{let n=e(...u);return`\x1B[${38+t};2;${n[0]};${n[1]};${n[2]}m`},re=e=>e,yt=(e,t,u)=>[e,t,u],q=(e,t,u)=>{Object.defineProperty(e,t,{get:()=>{let n=u();return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0}),n},enumerable:!0,configurable:!0})},be,G=(e,t,u,n)=>{be===void 0&&(be=bt());let o=n?10:0,r={};for(let[s,i]of Object.entries(be)){let D=s==="ansi16"?"ansi":s;s===t?r[D]=e(u,o):typeof i=="object"&&(r[D]=e(i[t],o))}return r};function $n(){let e=new Map,t={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],inverse:[7,27],hidden:[8,28],strikethrough:[9,29]},color:{black:[30,39],red:[31,39],green:[32,39],yellow:[33,39],blue:[34,39],magenta:[35,39],cyan:[36,39],white:[37,39],blackBright:[90,39],redBright:[91,39],greenBright:[92,39],yellowBright:[93,39],blueBright:[94,39],magentaBright:[95,39],cyanBright:[96,39],whiteBright:[97,39]},bgColor:{bgBlack:[40,49],bgRed:[41,49],bgGreen:[42,49],bgYellow:[43,49],bgBlue:[44,49],bgMagenta:[45,49],bgCyan:[46,49],bgWhite:[47,49],bgBlackBright:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};t.color.gray=t.color.blackBright,t.bgColor.bgGray=t.bgColor.bgBlackBright,t.color.grey=t.color.blackBright,t.bgColor.bgGrey=t.bgColor.bgBlackBright;for(let[u,n]of Object.entries(t)){for(let[o,r]of Object.entries(n))t[o]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[o]=t[o],e.set(r[0],r[1]);Object.defineProperty(t,u,{value:n,enumerable:!1})}return Object.defineProperty(t,"codes",{value:e,enumerable:!1}),t.color.close="\x1B[39m",t.bgColor.close="\x1B[49m",q(t.color,"ansi",()=>G(wt,"ansi16",re,!1)),q(t.color,"ansi256",()=>G(Bt,"ansi256",re,!1)),q(t.color,"ansi16m",()=>G(xt,"rgb",yt,!1)),q(t.bgColor,"ansi",()=>G(wt,"ansi16",re,!0)),q(t.bgColor,"ansi256",()=>G(Bt,"ansi256",re,!0)),q(t.bgColor,"ansi16m",()=>G(xt,"rgb",yt,!0)),t}Object.defineProperty($t,"exports",{enumerable:!0,get:$n})});var kt=_((qo,At)=>{"use strict";a();var J=ht(),vn=pe(),Sn=vt(),Be=new Set(["\x1B","\x9B"]),An=39,St=e=>`${Be.values().next().value}[${e}m`,kn=e=>e.split(" ").map(t=>J(t)),we=(e,t,u)=>{let n=[...t],o=!1,r=J(vn(e[e.length-1]));for(let[s,i]of n.entries()){let D=J(i);if(r+D<=u?e[e.length-1]+=i:(e.push(i),r=0),Be.has(i))o=!0;else if(o&&i==="m"){o=!1;continue}o||(r+=D,r===u&&s<n.length-1&&(e.push(""),r=0))}!r&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},_n=e=>{let t=e.split(" "),u=t.length;for(;u>0&&!(J(t[u-1])>0);)u--;return u===t.length?e:t.slice(0,u).join(" ")+t.slice(u).join("")},Ln=(e,t,u={})=>{if(u.trim!==!1&&e.trim()==="")return"";let n="",o="",r,s=kn(e),i=[""];for(let[D,f]of e.split(" ").entries()){u.trim!==!1&&(i[i.length-1]=i[i.length-1].trimLeft());let m=J(i[i.length-1]);if(D!==0&&(m>=t&&(u.wordWrap===!1||u.trim===!1)&&(i.push(""),m=0),(m>0||u.trim===!1)&&(i[i.length-1]+=" ",m++)),u.hard&&s[D]>t){let g=t-m,b=1+Math.floor((s[D]-g-1)/t);Math.floor((s[D]-1)/t)<b&&i.push(""),we(i,f,t);continue}if(m+s[D]>t&&m>0&&s[D]>0){if(u.wordWrap===!1&&m<t){we(i,f,t);continue}i.push("")}if(m+s[D]>t&&u.wordWrap===!1){we(i,f,t);continue}i[i.length-1]+=f}u.trim!==!1&&(i=i.map(_n)),n=i.join(`
3
+ `);for(let[D,f]of[...n].entries()){if(o+=f,Be.has(f)){let g=parseFloat(/\d[^m]*/.exec(n.slice(D,D+4)));r=g===An?null:g}let m=Sn.codes.get(Number(r));r&&m&&(n[D+1]===`
4
+ `?o+=St(m):f===`
5
+ `&&(o+=St(r)))}return o};At.exports=(e,t,u)=>String(e).normalize().replace(/\r\n/g,`
6
+ `).split(`
7
+ `).map(n=>Ln(n,t,u)).join(`
8
+ `)});var Lt=_((Qo,_t)=>{"use strict";a();var Un=ge("stream"),xe=class extends Un{#n=null;constructor(t={}){super(t),this.writable=this.readable=!0,this.muted=!1,this.on("pipe",this._onpipe),this.replace=t.replace,this._prompt=t.prompt||null,this._hadControl=!1}#t(t,u){return this._dest?this._dest[t]:this._src?this._src[t]:u}#e(t,...u){typeof this._dest?.[t]=="function"&&this._dest[t](...u),typeof this._src?.[t]=="function"&&this._src[t](...u)}get isTTY(){return this.#n!==null?this.#n:this.#t("isTTY",!1)}set isTTY(t){this.#n=t}get rows(){return this.#t("rows")}get columns(){return this.#t("columns")}mute(){this.muted=!0}unmute(){this.muted=!1}_onpipe(t){this._src=t}pipe(t,u){return this._dest=t,super.pipe(t,u)}pause(){if(this._src)return this._src.pause()}resume(){if(this._src)return this._src.resume()}write(t){if(this.muted){if(!this.replace)return!0;if(t.match(/^\u001b/))return t.indexOf(this._prompt)===0&&(t=t.slice(this._prompt.length),t=t.replace(/./g,this.replace),t=this._prompt+t),this._hadControl=!0,this.emit("data",t);this._prompt&&this._hadControl&&t.indexOf(this._prompt)===0&&(this._hadControl=!1,this.emit("data",this._prompt),t=t.slice(this._prompt.length)),t=t.toString().replace(/./g,this.replace)}this.emit("data",t)}end(t){this.muted&&(t&&this.replace?t=t.toString().replace(/./g,this.replace):t=null),t&&this.emit("data",t),this.emit("end")}destroy(...t){return this.#e("destroy",...t)}destroySoon(...t){return this.#e("destroySoon",...t)}close(...t){return this.#e("close",...t)}};_t.exports=xe});a();import{cac as gu}from"cac";import{select as mu}from"@inquirer/prompts";a();a();a();var z=class extends Error{name="ExitPromptError"};a();a();import{AsyncResource as Uu}from"async_hooks";a();import{AsyncLocalStorage as Qt,AsyncResource as ku}from"async_hooks";var Lu=new Qt;a();a();a();var R=ue(Ze(),1);a();import j from"process";function nn(){return j.platform!=="win32"?j.env.TERM!=="linux":!!j.env.WT_SESSION||!!j.env.TERMINUS_SUBLIME||j.env.ConEmuTask==="{cmd::Cmder}"||j.env.TERM_PROGRAM==="Terminus-Sublime"||j.env.TERM_PROGRAM==="vscode"||j.env.TERM==="xterm-256color"||j.env.TERM==="alacritty"||j.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"}var Qe={circleQuestionMark:"(?)",questionMarkPrefix:"(?)",square:"\u2588",squareDarkShade:"\u2593",squareMediumShade:"\u2592",squareLightShade:"\u2591",squareTop:"\u2580",squareBottom:"\u2584",squareLeft:"\u258C",squareRight:"\u2590",squareCenter:"\u25A0",bullet:"\u25CF",dot:"\u2024",ellipsis:"\u2026",pointerSmall:"\u203A",triangleUp:"\u25B2",triangleUpSmall:"\u25B4",triangleDown:"\u25BC",triangleDownSmall:"\u25BE",triangleLeftSmall:"\u25C2",triangleRightSmall:"\u25B8",home:"\u2302",heart:"\u2665",musicNote:"\u266A",musicNoteBeamed:"\u266B",arrowUp:"\u2191",arrowDown:"\u2193",arrowLeft:"\u2190",arrowRight:"\u2192",arrowLeftRight:"\u2194",arrowUpDown:"\u2195",almostEqual:"\u2248",notEqual:"\u2260",lessOrEqual:"\u2264",greaterOrEqual:"\u2265",identical:"\u2261",infinity:"\u221E",subscriptZero:"\u2080",subscriptOne:"\u2081",subscriptTwo:"\u2082",subscriptThree:"\u2083",subscriptFour:"\u2084",subscriptFive:"\u2085",subscriptSix:"\u2086",subscriptSeven:"\u2087",subscriptEight:"\u2088",subscriptNine:"\u2089",oneHalf:"\xBD",oneThird:"\u2153",oneQuarter:"\xBC",oneFifth:"\u2155",oneSixth:"\u2159",oneEighth:"\u215B",twoThirds:"\u2154",twoFifths:"\u2156",threeQuarters:"\xBE",threeFifths:"\u2157",threeEighths:"\u215C",fourFifths:"\u2158",fiveSixths:"\u215A",fiveEighths:"\u215D",sevenEighths:"\u215E",line:"\u2500",lineBold:"\u2501",lineDouble:"\u2550",lineDashed0:"\u2504",lineDashed1:"\u2505",lineDashed2:"\u2508",lineDashed3:"\u2509",lineDashed4:"\u254C",lineDashed5:"\u254D",lineDashed6:"\u2574",lineDashed7:"\u2576",lineDashed8:"\u2578",lineDashed9:"\u257A",lineDashed10:"\u257C",lineDashed11:"\u257E",lineDashed12:"\u2212",lineDashed13:"\u2013",lineDashed14:"\u2010",lineDashed15:"\u2043",lineVertical:"\u2502",lineVerticalBold:"\u2503",lineVerticalDouble:"\u2551",lineVerticalDashed0:"\u2506",lineVerticalDashed1:"\u2507",lineVerticalDashed2:"\u250A",lineVerticalDashed3:"\u250B",lineVerticalDashed4:"\u254E",lineVerticalDashed5:"\u254F",lineVerticalDashed6:"\u2575",lineVerticalDashed7:"\u2577",lineVerticalDashed8:"\u2579",lineVerticalDashed9:"\u257B",lineVerticalDashed10:"\u257D",lineVerticalDashed11:"\u257F",lineDownLeft:"\u2510",lineDownLeftArc:"\u256E",lineDownBoldLeftBold:"\u2513",lineDownBoldLeft:"\u2512",lineDownLeftBold:"\u2511",lineDownDoubleLeftDouble:"\u2557",lineDownDoubleLeft:"\u2556",lineDownLeftDouble:"\u2555",lineDownRight:"\u250C",lineDownRightArc:"\u256D",lineDownBoldRightBold:"\u250F",lineDownBoldRight:"\u250E",lineDownRightBold:"\u250D",lineDownDoubleRightDouble:"\u2554",lineDownDoubleRight:"\u2553",lineDownRightDouble:"\u2552",lineUpLeft:"\u2518",lineUpLeftArc:"\u256F",lineUpBoldLeftBold:"\u251B",lineUpBoldLeft:"\u251A",lineUpLeftBold:"\u2519",lineUpDoubleLeftDouble:"\u255D",lineUpDoubleLeft:"\u255C",lineUpLeftDouble:"\u255B",lineUpRight:"\u2514",lineUpRightArc:"\u2570",lineUpBoldRightBold:"\u2517",lineUpBoldRight:"\u2516",lineUpRightBold:"\u2515",lineUpDoubleRightDouble:"\u255A",lineUpDoubleRight:"\u2559",lineUpRightDouble:"\u2558",lineUpDownLeft:"\u2524",lineUpBoldDownBoldLeftBold:"\u252B",lineUpBoldDownBoldLeft:"\u2528",lineUpDownLeftBold:"\u2525",lineUpBoldDownLeftBold:"\u2529",lineUpDownBoldLeftBold:"\u252A",lineUpDownBoldLeft:"\u2527",lineUpBoldDownLeft:"\u2526",lineUpDoubleDownDoubleLeftDouble:"\u2563",lineUpDoubleDownDoubleLeft:"\u2562",lineUpDownLeftDouble:"\u2561",lineUpDownRight:"\u251C",lineUpBoldDownBoldRightBold:"\u2523",lineUpBoldDownBoldRight:"\u2520",lineUpDownRightBold:"\u251D",lineUpBoldDownRightBold:"\u2521",lineUpDownBoldRightBold:"\u2522",lineUpDownBoldRight:"\u251F",lineUpBoldDownRight:"\u251E",lineUpDoubleDownDoubleRightDouble:"\u2560",lineUpDoubleDownDoubleRight:"\u255F",lineUpDownRightDouble:"\u255E",lineDownLeftRight:"\u252C",lineDownBoldLeftBoldRightBold:"\u2533",lineDownLeftBoldRightBold:"\u252F",lineDownBoldLeftRight:"\u2530",lineDownBoldLeftBoldRight:"\u2531",lineDownBoldLeftRightBold:"\u2532",lineDownLeftRightBold:"\u252E",lineDownLeftBoldRight:"\u252D",lineDownDoubleLeftDoubleRightDouble:"\u2566",lineDownDoubleLeftRight:"\u2565",lineDownLeftDoubleRightDouble:"\u2564",lineUpLeftRight:"\u2534",lineUpBoldLeftBoldRightBold:"\u253B",lineUpLeftBoldRightBold:"\u2537",lineUpBoldLeftRight:"\u2538",lineUpBoldLeftBoldRight:"\u2539",lineUpBoldLeftRightBold:"\u253A",lineUpLeftRightBold:"\u2536",lineUpLeftBoldRight:"\u2535",lineUpDoubleLeftDoubleRightDouble:"\u2569",lineUpDoubleLeftRight:"\u2568",lineUpLeftDoubleRightDouble:"\u2567",lineUpDownLeftRight:"\u253C",lineUpBoldDownBoldLeftBoldRightBold:"\u254B",lineUpDownBoldLeftBoldRightBold:"\u2548",lineUpBoldDownLeftBoldRightBold:"\u2547",lineUpBoldDownBoldLeftRightBold:"\u254A",lineUpBoldDownBoldLeftBoldRight:"\u2549",lineUpBoldDownLeftRight:"\u2540",lineUpDownBoldLeftRight:"\u2541",lineUpDownLeftBoldRight:"\u253D",lineUpDownLeftRightBold:"\u253E",lineUpBoldDownBoldLeftRight:"\u2542",lineUpDownLeftBoldRightBold:"\u253F",lineUpBoldDownLeftBoldRight:"\u2543",lineUpBoldDownLeftRightBold:"\u2544",lineUpDownBoldLeftBoldRight:"\u2545",lineUpDownBoldLeftRightBold:"\u2546",lineUpDoubleDownDoubleLeftDoubleRightDouble:"\u256C",lineUpDoubleDownDoubleLeftRight:"\u256B",lineUpDownLeftDoubleRightDouble:"\u256A",lineCross:"\u2573",lineBackslash:"\u2572",lineSlash:"\u2571"},Xe={tick:"\u2714",info:"\u2139",warning:"\u26A0",cross:"\u2718",squareSmall:"\u25FB",squareSmallFilled:"\u25FC",circle:"\u25EF",circleFilled:"\u25C9",circleDotted:"\u25CC",circleDouble:"\u25CE",circleCircle:"\u24DE",circleCross:"\u24E7",circlePipe:"\u24BE",radioOn:"\u25C9",radioOff:"\u25EF",checkboxOn:"\u2612",checkboxOff:"\u2610",checkboxCircleOn:"\u24E7",checkboxCircleOff:"\u24BE",pointer:"\u276F",triangleUpOutline:"\u25B3",triangleLeft:"\u25C0",triangleRight:"\u25B6",lozenge:"\u25C6",lozengeOutline:"\u25C7",hamburger:"\u2630",smiley:"\u32E1",mustache:"\u0DF4",star:"\u2605",play:"\u25B6",nodejs:"\u2B22",oneSeventh:"\u2150",oneNinth:"\u2151",oneTenth:"\u2152"},un={tick:"\u221A",info:"i",warning:"\u203C",cross:"\xD7",squareSmall:"\u25A1",squareSmallFilled:"\u25A0",circle:"( )",circleFilled:"(*)",circleDotted:"( )",circleDouble:"( )",circleCircle:"(\u25CB)",circleCross:"(\xD7)",circlePipe:"(\u2502)",radioOn:"(*)",radioOff:"( )",checkboxOn:"[\xD7]",checkboxOff:"[ ]",checkboxCircleOn:"(\xD7)",checkboxCircleOff:"( )",pointer:">",triangleUpOutline:"\u2206",triangleLeft:"\u25C4",triangleRight:"\u25BA",lozenge:"\u2666",lozengeOutline:"\u25CA",hamburger:"\u2261",smiley:"\u263A",mustache:"\u250C\u2500\u2510",star:"\u2736",play:"\u25BA",nodejs:"\u2666",oneSeventh:"1/7",oneNinth:"1/9",oneTenth:"1/10"},on={...Qe,...Xe},rn={...Qe,...un},sn=nn(),Dn=sn?on:rn,me=Dn,Ku=Object.entries(Xe);var an={prefix:{idle:R.default.blue("?"),done:R.default.green(me.tick)},spinner:{interval:80,frames:["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"].map(e=>R.default.yellow(e))},style:{answer:R.default.cyan,message:R.default.bold,error:e=>R.default.red(`> ${e}`),defaultAnswer:e=>R.default.dim(`(${e})`),help:R.default.dim,highlight:R.default.cyan,key:e=>R.default.cyan(R.default.bold(`<${e}>`))}};a();a();a();a();a();var Rn=ue(ot(),1),jn=ue(kt(),1);a();var qn=ue(Lt(),1);import*as Nn from"readline";import{AsyncResource as Sr}from"async_hooks";a();a();var I=[];I.push("SIGHUP","SIGINT","SIGTERM");process.platform!=="win32"&&I.push("SIGALRM","SIGABRT","SIGVTALRM","SIGXCPU","SIGXFSZ","SIGUSR2","SIGTRAP","SIGSYS","SIGQUIT","SIGIOT");process.platform==="linux"&&I.push("SIGIO","SIGPOLL","SIGPWR","SIGSTKFLT");var se=e=>!!e&&typeof e=="object"&&typeof e.removeListener=="function"&&typeof e.emit=="function"&&typeof e.reallyExit=="function"&&typeof e.listeners=="function"&&typeof e.kill=="function"&&typeof e.pid=="number"&&typeof e.on=="function",ye=Symbol.for("signal-exit emitter"),$e=globalThis,In=Object.defineProperty.bind(Object),ve=class{emitted={afterExit:!1,exit:!1};listeners={afterExit:[],exit:[]};count=0;id=Math.random();constructor(){if($e[ye])return $e[ye];In($e,ye,{value:this,writable:!1,enumerable:!1,configurable:!1})}on(t,u){this.listeners[t].push(u)}removeListener(t,u){let n=this.listeners[t],o=n.indexOf(u);o!==-1&&(o===0&&n.length===1?n.length=0:n.splice(o,1))}emit(t,u,n){if(this.emitted[t])return!1;this.emitted[t]=!0;let o=!1;for(let r of this.listeners[t])o=r(u,n)===!0||o;return t==="exit"&&(o=this.emit("afterExit",u,n)||o),o}},ie=class{},Mn=e=>({onExit(t,u){return e.onExit(t,u)},load(){return e.load()},unload(){return e.unload()}}),Se=class extends ie{onExit(){return()=>{}}load(){}unload(){}},Ae=class extends ie{#n=ke.platform==="win32"?"SIGINT":"SIGHUP";#t=new ve;#e;#r;#s;#o={};#u=!1;constructor(t){super(),this.#e=t,this.#o={};for(let u of I)this.#o[u]=()=>{let n=this.#e.listeners(u),{count:o}=this.#t,r=t;if(typeof r.__signal_exit_emitter__=="object"&&typeof r.__signal_exit_emitter__.count=="number"&&(o+=r.__signal_exit_emitter__.count),n.length===o){this.unload();let s=this.#t.emit("exit",null,u),i=u==="SIGHUP"?this.#n:u;s||t.kill(t.pid,i)}};this.#s=t.reallyExit,this.#r=t.emit}onExit(t,u){if(!se(this.#e))return()=>{};this.#u===!1&&this.load();let n=u?.alwaysLast?"afterExit":"exit";return this.#t.on(n,t),()=>{this.#t.removeListener(n,t),this.#t.listeners.exit.length===0&&this.#t.listeners.afterExit.length===0&&this.unload()}}load(){if(!this.#u){this.#u=!0,this.#t.count+=1;for(let t of I)try{let u=this.#o[t];u&&this.#e.on(t,u)}catch{}this.#e.emit=(t,...u)=>this.#D(t,...u),this.#e.reallyExit=t=>this.#i(t)}}unload(){this.#u&&(this.#u=!1,I.forEach(t=>{let u=this.#o[t];if(!u)throw new Error("Listener not defined for signal: "+t);try{this.#e.removeListener(t,u)}catch{}}),this.#e.emit=this.#r,this.#e.reallyExit=this.#s,this.#t.count-=1)}#i(t){return se(this.#e)?(this.#e.exitCode=t||0,this.#t.emit("exit",this.#e.exitCode,null),this.#s.call(this.#e,this.#e.exitCode)):0}#D(t,...u){let n=this.#r;if(t==="exit"&&se(this.#e)){typeof u[0]=="number"&&(this.#e.exitCode=u[0]);let o=n.call(this.#e,t,...u);return this.#t.emit("exit",this.#e.exitCode,null),o}else return n.call(this.#e,t,...u)}},ke=globalThis.process,{onExit:On,load:ur,unload:or}=Mn(se(ke)?new Ae(ke):new Se);a();import{stripVTControlCharacters as mr}from"util";a();a();a();a();import{execSync as _e}from"child_process";var l={red:e=>`\x1B[31m${e}\x1B[0m`,green:e=>`\x1B[32m${e}\x1B[0m`,yellow:e=>`\x1B[33m${e}\x1B[0m`,dim:e=>`\x1B[2m${e}\x1B[0m`},W=new Date().toISOString().slice(0,10).replace(/-/g,""),h={helpMode:"always",style:{keysHelpTip:e=>`\x1B[2m${e.map(([u,n])=>`${u} ${n}`).join(" \u2022 ")} \u2022 Ctrl+C quit\x1B[0m`}};function P(e,t=!1){try{return _e(e,{encoding:"utf-8",stdio:t?"pipe":"inherit"})}catch(u){if(t)return"";throw u}}function x(e){try{return _e(e,{encoding:"utf-8"}).trim()}catch{return""}}function k(){try{_e("git rev-parse --is-inside-work-tree",{stdio:"pipe"})}catch{console.log(l.red("\u9519\u8BEF: \u5F53\u524D\u76EE\u5F55\u4E0D\u662F git \u4ED3\u5E93")),process.exit(1)}}function Rt(){let e=x("git branch -r").split(`
9
+ `).map(t=>t.trim());return e.includes("origin/main")?"origin/main":e.includes("origin/master")?"origin/master":"origin/main"}function w(){console.log(l.dim("\u2500".repeat(40)))}a();import{execSync as Z}from"child_process";import{select as V,input as Tt}from"@inquirer/prompts";import U from"ora";a();import{existsSync as jt,readFileSync as Gn}from"fs";import{join as Wn}from"path";var Le={featurePrefix:"feature",hotfixPrefix:"hotfix",requireId:!1,featureIdLabel:"Story ID",hotfixIdLabel:"Issue ID",autoStage:!0,useEmoji:!0};function Vn(){return x("git rev-parse --show-toplevel")}function Hn(){let e=[".gwrc.json",".gwrc","gw.config.json"];for(let t of e)if(jt(t))return t;try{let t=Vn();if(t)for(let u of e){let n=Wn(t,u);if(jt(n))return n}}catch{}return null}function Kn(){let e=Hn();if(!e)return Le;try{let t=Gn(e,"utf-8"),u=JSON.parse(t);return{...Le,...u}}catch{return console.warn(`\u914D\u7F6E\u6587\u4EF6\u89E3\u6790\u5931\u8D25: ${e}`),Le}}var Re=null;function M(){return Re||(Re=Kn()),Re}async function je(e){let t=M(),u=e==="feature"?t.featureIdLabel:t.hotfixIdLabel,n=e==="feature"?t.featurePrefix:t.hotfixPrefix,o=t.requireId?`\u8BF7\u8F93\u5165${u}:`:`\u8BF7\u8F93\u5165${u} (\u53EF\u8DF3\u8FC7):`,r=await Tt({message:o,theme:h});if(t.requireId&&!r)return console.log(l.red(`${u}\u4E0D\u80FD\u4E3A\u7A7A`)),null;let s=await Tt({message:"\u8BF7\u8F93\u5165\u63CF\u8FF0:",theme:h});return s?r?`${n}/${W}-${r}-${s}`:`${n}/${W}-${s}`:(console.log(l.red("\u63CF\u8FF0\u4E0D\u80FD\u4E3A\u7A7A")),null)}async function Q(e,t){let u=M(),n=x("git status --porcelain");if(n){if(console.log(l.yellow("\u68C0\u6D4B\u5230\u672A\u63D0\u4EA4\u7684\u66F4\u6539:")),console.log(l.dim(n)),w(),!await V({message:"\u662F\u5426\u6682\u5B58 (stash) \u8FD9\u4E9B\u66F4\u6539\u540E\u7EE7\u7EED?",choices:[{name:"\u662F",value:!0},{name:"\u5426\uFF0C\u53D6\u6D88\u64CD\u4F5C",value:!1}],theme:h})){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let D=U("\u6B63\u5728\u6682\u5B58\u66F4\u6539...").start();try{P('git stash push -m "auto stash before branch switch"',!0),D.succeed("\u66F4\u6539\u5DF2\u6682\u5B58\uFF0C\u5207\u6362\u5206\u652F\u540E\u53EF\u7528 gw s \u6062\u590D")}catch{D.fail("\u6682\u5B58\u5931\u8D25");return}w()}let o=await je(e);if(!o)return;w();let r;t?r=`origin/${t}`:u.baseBranch?r=`origin/${u.baseBranch}`:r=Rt();let s=U(`\u6B63\u5728\u4ECE ${r} \u521B\u5EFA\u5206\u652F...`).start();try{P(`git fetch origin ${r.replace("origin/","")}`,!0),P(`git checkout -b "${o}" ${r}`),s.succeed(`\u5206\u652F\u521B\u5EFA\u6210\u529F: ${o}`),w();let i;if(u.autoPush!==void 0?(i=u.autoPush,i&&console.log(l.dim("(\u81EA\u52A8\u63A8\u9001\u5DF2\u542F\u7528)"))):i=await V({message:"\u662F\u5426\u63A8\u9001\u5230\u8FDC\u7A0B?",choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h}),i){let D=U("\u6B63\u5728\u63A8\u9001\u5230\u8FDC\u7A0B...").start();try{Z(`git push -u origin "${o}"`,{stdio:"pipe"}),D.succeed(`\u5DF2\u63A8\u9001\u5230\u8FDC\u7A0B: origin/${o}`)}catch{D.warn("\u8FDC\u7A0B\u63A8\u9001\u5931\u8D25\uFF0C\u53EF\u7A0D\u540E\u624B\u52A8\u6267\u884C: git push -u origin "+o)}}}catch{s.fail("\u5206\u652F\u521B\u5EFA\u5931\u8D25")}}async function Te(e){let t=U("\u6B63\u5728\u83B7\u53D6\u5206\u652F\u4FE1\u606F...").start();P("git fetch --all --prune",!0),t.succeed("\u5206\u652F\u4FE1\u606F\u5DF2\u66F4\u65B0"),w();let u=x("git branch --show-current"),n=e;if(n?.startsWith("origin/")&&(n=n.replace("origin/","")),!n){let D=x("git for-each-ref --sort=-committerdate refs/heads/ --format='%(refname:short)'").split(`
10
+ `).filter(g=>g&&g!==u),f=x("git for-each-ref --sort=-committerdate refs/remotes/origin/ --format='%(refname:short)'").split(`
11
+ `).map(g=>g.replace("origin/","")).filter(g=>g&&g!=="HEAD"&&g!==u&&!D.includes(g));if(D.length===0&&f.length===0){console.log(l.yellow("\u6CA1\u6709\u53EF\u5220\u9664\u7684\u5206\u652F"));return}let m=[];if(D.forEach(g=>{let b=x(`git branch -r --list "origin/${g}"`);m.push({name:b?`${g} (\u672C\u5730+\u8FDC\u7A0B)`:`${g} (\u4EC5\u672C\u5730)`,value:g})}),f.forEach(g=>{m.push({name:`${g} (\u4EC5\u8FDC\u7A0B)`,value:`__remote__${g}`})}),m.push({name:"\u53D6\u6D88",value:"__cancel__"}),n=await V({message:"\u9009\u62E9\u8981\u5220\u9664\u7684\u5206\u652F (\u6309\u6700\u8FD1\u4F7F\u7528\u6392\u5E8F):",choices:m,theme:h}),n==="__cancel__"){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}if(n.startsWith("__remote__")){let g=n.replace("__remote__","");if(!await V({message:`\u786E\u8BA4\u5220\u9664\u8FDC\u7A0B\u5206\u652F origin/${g}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h})){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let S=U(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u5206\u652F: origin/${g}`).start();try{Z(`git push origin --delete "${g}"`,{stdio:"pipe"}),S.succeed(`\u8FDC\u7A0B\u5206\u652F\u5DF2\u5220\u9664: origin/${g}`)}catch{S.fail("\u8FDC\u7A0B\u5206\u652F\u5220\u9664\u5931\u8D25")}return}}if(n===u){console.log(l.red("\u4E0D\u80FD\u5220\u9664\u5F53\u524D\u6240\u5728\u5206\u652F"));return}let o=x(`git branch --list "${n}"`),r=x(`git branch -r --list "origin/${n}"`);if(!o){if(r){if(console.log(l.yellow(`\u672C\u5730\u5206\u652F\u4E0D\u5B58\u5728\uFF0C\u4F46\u8FDC\u7A0B\u5206\u652F\u5B58\u5728: origin/${n}`)),await V({message:`\u786E\u8BA4\u5220\u9664\u8FDC\u7A0B\u5206\u652F origin/${n}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h})){let f=U(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u5206\u652F: origin/${n}`).start();try{Z(`git push origin --delete "${n}"`,{stdio:"pipe"}),f.succeed(`\u8FDC\u7A0B\u5206\u652F\u5DF2\u5220\u9664: origin/${n}`)}catch{f.fail("\u8FDC\u7A0B\u5206\u652F\u5220\u9664\u5931\u8D25")}}}else console.log(l.red(`\u5206\u652F\u4E0D\u5B58\u5728: ${n}`));return}if(!await V({message:`\u786E\u8BA4\u5220\u9664\u5206\u652F ${n}?${r?" (\u672C\u5730+\u8FDC\u7A0B)":" (\u4EC5\u672C\u5730)"}`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h})){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let i=U(`\u6B63\u5728\u5220\u9664\u672C\u5730\u5206\u652F: ${n}`).start();try{Z(`git branch -D "${n}"`,{stdio:"pipe"}),i.succeed(`\u672C\u5730\u5206\u652F\u5DF2\u5220\u9664: ${n}`)}catch{i.fail("\u672C\u5730\u5206\u652F\u5220\u9664\u5931\u8D25");return}if(r){let D=U(`\u6B63\u5728\u5220\u9664\u8FDC\u7A0B\u5206\u652F: origin/${n}`).start();try{Z(`git push origin --delete "${n}"`,{stdio:"pipe"}),D.succeed(`\u8FDC\u7A0B\u5206\u652F\u5DF2\u5220\u9664: origin/${n}`)}catch{D.fail("\u8FDC\u7A0B\u5206\u652F\u5220\u9664\u5931\u8D25")}}}a();import{execSync as Pt}from"child_process";import{select as X,input as De}from"@inquirer/prompts";import ae from"ora";async function Ue(e){let t=ae("\u6B63\u5728\u83B7\u53D6 tags...").start();P("git fetch --tags",!0),t.stop();let u=e?`${e}*`:"",n=x(`git tag -l ${u} --sort=-v:refname`).split(`
12
+ `).filter(Boolean);if(n.length===0){console.log(l.yellow(e?`\u6CA1\u6709 '${e}' \u5F00\u5934\u7684 tag`:"\u6CA1\u6709 tag"));return}console.log(l.green(e?`\u4EE5 '${e}' \u5F00\u5934\u7684 tags:`:"\u6240\u6709 tags:")),n.slice(0,20).forEach(o=>console.log(` ${o}`)),n.length>20&&console.log(l.yellow(`
13
+ \u5171 ${n.length} \u4E2A\uFF0C\u4EC5\u663E\u793A\u524D 20 \u4E2A`))}function Ut(e){return x(`git tag -l "${e}*" --sort=-v:refname`).split(`
14
+ `).filter(Boolean)[0]||""}async function Ie(e){let t=M(),u=ae("\u6B63\u5728\u83B7\u53D6 tags...").start();P("git fetch --tags",!0),u.stop(),w();let n=e;if(!n&&t.defaultTagPrefix&&(n=t.defaultTagPrefix,console.log(l.dim(`(\u4F7F\u7528\u914D\u7F6E\u7684\u9ED8\u8BA4\u524D\u7F00: ${n})`))),!n){let b=x("git tag -l").split(`
15
+ `).filter(Boolean);if(b.length===0){if(n=await De({message:"\u5F53\u524D\u4ED3\u5E93\u6CA1\u6709 tag\uFF0C\u8BF7\u8F93\u5165\u524D\u7F00 (\u5982 v):",default:"v",theme:h}),!n){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let v=await X({message:"\u9009\u62E9\u521D\u59CB\u7248\u672C\u53F7:",choices:[{name:`${n}0.0.1`,value:"0.0.1"},{name:`${n}0.1.0`,value:"0.1.0"},{name:`${n}1.0.0`,value:"1.0.0"},{name:"\u81EA\u5B9A\u4E49...",value:"__custom__"}],theme:h}),B=v;if(v==="__custom__"&&(B=await De({message:"\u8BF7\u8F93\u5165\u7248\u672C\u53F7 (\u5982 0.0.1):",theme:h}),!B)){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let y=`${n}${B}`;await X({message:`\u786E\u8BA4\u521B\u5EFA ${y}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h})&&Pe(y);return}let S=[...new Set(b.map(v=>v.replace(/[0-9].*/,"")).filter(Boolean))];if(S.length===0){if(n=await De({message:"\u8BF7\u8F93\u5165 tag \u524D\u7F00 (\u5982 v):",default:"v",theme:h}),!n){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}}else{let v=S.map(y=>{let E=Ut(y),T=E?x(`git log -1 --format=%ct "${E}" 2>/dev/null`):"0";return{prefix:y,latest:E,date:parseInt(T)||0}});v.sort((y,E)=>E.date-y.date);let B=v.map(({prefix:y,latest:E})=>({name:`${y} (\u6700\u65B0: ${E})`,value:y}));if(B.push({name:"\u8F93\u5165\u65B0\u524D\u7F00...",value:"__new__"}),n=await X({message:"\u9009\u62E9 tag \u524D\u7F00:",choices:B,theme:h}),n==="__new__"&&(n=await De({message:"\u8BF7\u8F93\u5165\u65B0\u524D\u7F00:",theme:h}),!n)){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}}}let o=Ut(n);if(!o){let b=`${n}1.0.0`;console.log(l.yellow(`\u672A\u627E\u5230 '${n}' \u5F00\u5934\u7684 tag\uFF0C\u5C06\u521B\u5EFA ${b}`)),await X({message:`\u786E\u8BA4\u521B\u5EFA ${b}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h})&&Pe(b);return}console.log(l.yellow(`\u5F53\u524D\u6700\u65B0 tag: ${o}`)),w();let r=o.slice(n.length),s=r.match(/^(\d+)\.(\d+)\.(\d+)-([a-zA-Z]+)\.(\d+)$/),i=r.match(/^(\d+)\.(\d+)\.(\d+)$/),D=r.match(/^(\d+)\.(\d+)$/),f=r.match(/^(\d+)$/),m=[];if(s){let[,b,S,v,B,y]=s,E=Number(b),T=Number(S),O=Number(v),$=Number(y),A=`${E}.${T}.${O}`;m=[{name:`pre \u2192 ${n}${A}-${B}.${$+1}`,value:`${n}${A}-${B}.${$+1}`},{name:`release\u2192 ${n}${A}`,value:`${n}${A}`},{name:`patch \u2192 ${n}${E}.${T}.${O+1}`,value:`${n}${E}.${T}.${O+1}`},{name:`minor \u2192 ${n}${E}.${T+1}.0`,value:`${n}${E}.${T+1}.0`},{name:`major \u2192 ${n}${E+1}.0.0`,value:`${n}${E+1}.0.0`}]}else if(i){let[,b,S,v]=i,B=Number(b),y=Number(S),E=Number(v);m=[{name:`patch \u2192 ${n}${B}.${y}.${E+1}`,value:`${n}${B}.${y}.${E+1}`},{name:`minor \u2192 ${n}${B}.${y+1}.0`,value:`${n}${B}.${y+1}.0`},{name:`major \u2192 ${n}${B+1}.0.0`,value:`${n}${B+1}.0.0`},{name:`alpha \u2192 ${n}${B}.${y}.${E+1}-alpha.1`,value:`${n}${B}.${y}.${E+1}-alpha.1`},{name:`beta \u2192 ${n}${B}.${y}.${E+1}-beta.1`,value:`${n}${B}.${y}.${E+1}-beta.1`},{name:`rc \u2192 ${n}${B}.${y}.${E+1}-rc.1`,value:`${n}${B}.${y}.${E+1}-rc.1`}]}else if(D){let[,b,S]=D,v=Number(b),B=Number(S);m=[{name:`minor \u2192 ${n}${v}.${B+1}`,value:`${n}${v}.${B+1}`},{name:`major \u2192 ${n}${v+1}.0`,value:`${n}${v+1}.0`}]}else if(f){let b=Number(f[1]);m=[{name:`next \u2192 ${n}${b+1}`,value:`${n}${b+1}`}]}else{console.log(l.red(`\u65E0\u6CD5\u89E3\u6790\u7248\u672C\u53F7: ${r}`));return}m.push({name:"\u53D6\u6D88",value:"__cancel__"});let g=await X({message:"\u9009\u62E9\u7248\u672C\u7C7B\u578B:",choices:m,theme:h});if(g==="__cancel__"){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}Pe(g)}function Pe(e){w();let t=ae(`\u6B63\u5728\u521B\u5EFA tag: ${e}`).start();try{Pt(`git tag -a "${e}" -m "Release ${e}"`,{stdio:"pipe"}),t.succeed(`Tag \u521B\u5EFA\u6210\u529F: ${e}`)}catch{t.fail("tag \u521B\u5EFA\u5931\u8D25");return}let u=ae("\u6B63\u5728\u63A8\u9001\u5230\u8FDC\u7A0B...").start();try{Pt(`git push origin "${e}"`,{stdio:"pipe"}),u.succeed(`Tag \u5DF2\u63A8\u9001: ${e}`)}catch{u.warn(`\u8FDC\u7A0B\u63A8\u9001\u5931\u8D25\uFF0C\u53EF\u7A0D\u540E\u624B\u52A8\u6267\u884C: git push origin ${e}`)}}a();import{readFileSync as It,writeFileSync as zn}from"fs";import{select as Yn}from"@inquirer/prompts";function Jn(){return JSON.parse(It("package.json","utf-8")).version||"0.0.0"}function Zn(e){let t=JSON.parse(It("package.json","utf-8"));t.version=e,zn("package.json",JSON.stringify(t,null," ")+`
16
+ `)}function Qn(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)-([a-zA-Z]+)\.(\d+)$/),u=e.match(/^(\d+)\.(\d+)\.(\d+)$/);if(t){let[,n,o,r,s,i]=t,D=Number(n),f=Number(o),m=Number(r),g=Number(i),b=`${D}.${f}.${m}`;return[{name:`pre \u2192 ${b}-${s}.${g+1}`,value:`${b}-${s}.${g+1}`},{name:`release \u2192 ${b}`,value:b},{name:`patch \u2192 ${D}.${f}.${m+1}`,value:`${D}.${f}.${m+1}`},{name:`minor \u2192 ${D}.${f+1}.0`,value:`${D}.${f+1}.0`},{name:`major \u2192 ${D+1}.0.0`,value:`${D+1}.0.0`}]}if(u){let[,n,o,r]=u,s=Number(n),i=Number(o),D=Number(r);return[{name:`patch \u2192 ${s}.${i}.${D+1}`,value:`${s}.${i}.${D+1}`},{name:`minor \u2192 ${s}.${i+1}.0`,value:`${s}.${i+1}.0`},{name:`major \u2192 ${s+1}.0.0`,value:`${s+1}.0.0`},{name:`alpha \u2192 ${s}.${i}.${D+1}-alpha.1`,value:`${s}.${i}.${D+1}-alpha.1`},{name:`beta \u2192 ${s}.${i}.${D+1}-beta.1`,value:`${s}.${i}.${D+1}-beta.1`},{name:`rc \u2192 ${s}.${i}.${D+1}-rc.1`,value:`${s}.${i}.${D+1}-rc.1`}]}return[{name:"patch \u2192 0.0.1",value:"0.0.1"},{name:"minor \u2192 0.1.0",value:"0.1.0"},{name:"major \u2192 1.0.0",value:"1.0.0"}]}async function Me(){let e=Jn();console.log(l.yellow(`\u5F53\u524D\u7248\u672C: ${e}`)),w();let t=Qn(e);t.push({name:"\u53D6\u6D88",value:"__cancel__"});let u=await Yn({message:"\u9009\u62E9\u65B0\u7248\u672C:",choices:t,theme:h});if(u==="__cancel__"){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}Zn(u),w(),console.log(l.green(`\u2713 \u7248\u672C\u53F7\u5DF2\u66F4\u65B0: ${e} \u2192 ${u}`))}a();import{existsSync as Xn,writeFileSync as eu}from"fs";import{select as tu,input as H,confirm as le}from"@inquirer/prompts";var ce=".gwrc.json",nu={feat:"\u2728",fix:"\u{1F41B}",docs:"\u{1F4DD}",style:"\u{1F484}",refactor:"\u267B\uFE0F",perf:"\u26A1\uFE0F",test:"\u2705",build:"\u{1F4E6}",ci:"\u{1F477}",chore:"\u{1F527}",revert:"\u23EA"};async function Oe(){if(Xn(ce)&&!await le({message:`${ce} \u5DF2\u5B58\u5728\uFF0C\u662F\u5426\u8986\u76D6?`,default:!1,theme:h})){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}console.log(l.dim(`\u914D\u7F6E git-workflow\uFF0C\u76F4\u63A5\u56DE\u8F66\u4F7F\u7528\u9ED8\u8BA4\u503C
17
+ `));let e={},t=await H({message:"\u9ED8\u8BA4\u57FA\u7840\u5206\u652F (\u7559\u7A7A\u81EA\u52A8\u68C0\u6D4B main/master):",theme:h});t&&(e.baseBranch=t),w();let u=await H({message:"Feature \u5206\u652F\u524D\u7F00:",default:"feature",theme:h});u!=="feature"&&(e.featurePrefix=u);let n=await H({message:"Hotfix \u5206\u652F\u524D\u7F00:",default:"hotfix",theme:h});n!=="hotfix"&&(e.hotfixPrefix=n),w(),await le({message:"\u662F\u5426\u8981\u6C42\u5FC5\u586B ID (Story ID / Issue ID)?",default:!1,theme:h})&&(e.requireId=!0);let r=await H({message:"Feature \u5206\u652F ID \u6807\u7B7E:",default:"Story ID",theme:h});r!=="Story ID"&&(e.featureIdLabel=r);let s=await H({message:"Hotfix \u5206\u652F ID \u6807\u7B7E:",default:"Issue ID",theme:h});s!=="Issue ID"&&(e.hotfixIdLabel=s),w();let i=await H({message:"\u9ED8\u8BA4 Tag \u524D\u7F00 (\u7559\u7A7A\u5219\u6BCF\u6B21\u9009\u62E9):",theme:h});i&&(e.defaultTagPrefix=i);let D=await tu({message:"\u521B\u5EFA\u5206\u652F\u540E\u662F\u5426\u81EA\u52A8\u63A8\u9001?",choices:[{name:"\u6BCF\u6B21\u8BE2\u95EE",value:"ask"},{name:"\u81EA\u52A8\u63A8\u9001",value:"yes"},{name:"\u4E0D\u63A8\u9001",value:"no"}],theme:h});D==="yes"&&(e.autoPush=!0),D==="no"&&(e.autoPush=!1),w(),await le({message:"Commit \u65F6\u662F\u5426\u81EA\u52A8\u6682\u5B58\u6240\u6709\u66F4\u6539?",default:!0,theme:h})||(e.autoStage=!1),await le({message:"Commit \u65F6\u662F\u5426\u4F7F\u7528 emoji?",default:!0,theme:h})||(e.useEmoji=!1),e.commitEmojis=nu,w();let g=JSON.stringify(e,null,2);eu(ce,g+`
18
+ `),console.log(l.green(`\u2713 \u914D\u7F6E\u5DF2\u4FDD\u5B58\u5230 ${ce}`)),console.log(l.dim(`
19
+ \u63D0\u793A: \u53EF\u4EE5\u5728\u914D\u7F6E\u6587\u4EF6\u4E2D\u4FEE\u6539 commitEmojis \u6765\u81EA\u5B9A\u4E49\u5404\u7C7B\u578B\u7684 emoji`)),console.log(l.dim(`
20
+ `+g))}a();import{execSync as ee}from"child_process";import{select as K,input as Nt}from"@inquirer/prompts";import fe from"ora";function uu(){let e=x('git stash list --format="%gd|%s|%ar"');return e?e.split(`
21
+ `).filter(Boolean).map(t=>{let[u,n,o]=t.split("|"),r=parseInt(u.match(/stash@\{(\d+)\}/)?.[1]||"0"),i=n.match(/(?:WIP on|On) ([^:]+):/)?.[1]||"unknown",D=n.replace(/(?:WIP on|On) [^:]+:\s*/,"");n.startsWith("WIP")&&(D=D.replace(/^[a-f0-9]+ /,"")),D=D||"(no message)";let f=x(`git stash show stash@{${r}} --name-only 2>/dev/null`),m=f?f.split(`
22
+ `).filter(Boolean):[];return{index:r,branch:i,message:D,date:o,files:m}}):[]}function ou(e){let t=e.files.length,u=t>0?l.dim(` (${t} \u6587\u4EF6)`):"";return`${l.yellow(`[${e.index}]`)} ${l.green(e.branch)} ${e.message}${u} ${l.dim(e.date)}`}function ru(e){console.log(),console.log(l.yellow(`Stash #${e.index}`)),console.log(`\u5206\u652F: ${l.green(e.branch)}`),console.log(`\u6D88\u606F: ${e.message}`),console.log(`\u65F6\u95F4: ${l.dim(e.date)}`),e.files.length>0&&(console.log(`\u6587\u4EF6 (${e.files.length}):`),e.files.slice(0,10).forEach(t=>console.log(` ${l.dim("\u2022")} ${t}`)),e.files.length>10&&console.log(l.dim(` ... \u8FD8\u6709 ${e.files.length-10} \u4E2A\u6587\u4EF6`)))}async function te(){let e=uu();if(e.length===0){console.log(l.yellow("\u6CA1\u6709 stash \u8BB0\u5F55")),x("git status --porcelain")&&await K({message:"\u68C0\u6D4B\u5230\u672A\u63D0\u4EA4\u7684\u53D8\u66F4\uFF0C\u662F\u5426\u521B\u5EFA stash?",choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h})&&await Mt();return}console.log(l.green(`\u5171 ${e.length} \u4E2A stash:
23
+ `));let t=e.map(o=>({name:ou(o),value:o.index.toString()}));t.push({name:l.dim("+ \u521B\u5EFA\u65B0 stash"),value:"__new__"}),t.push({name:l.dim("\u53D6\u6D88"),value:"__cancel__"});let u=await K({message:"\u9009\u62E9 stash:",choices:t,theme:h});if(u==="__cancel__")return;if(u==="__new__"){await Mt();return}let n=e.find(o=>o.index.toString()===u);await qt(n)}async function qt(e){switch(ru(e),w(),await K({message:"\u64CD\u4F5C:",choices:[{name:"\u5E94\u7528 (\u4FDD\u7559 stash)",value:"apply"},{name:"\u5F39\u51FA (\u5E94\u7528\u5E76\u5220\u9664)",value:"pop"},{name:"\u521B\u5EFA\u5206\u652F",value:"branch"},{name:"\u67E5\u770B\u5DEE\u5F02",value:"diff"},{name:"\u5220\u9664",value:"drop"},{name:"\u8FD4\u56DE\u5217\u8868",value:"back"},{name:"\u53D6\u6D88",value:"cancel"}],theme:h})){case"apply":Ot(e.index,!1);break;case"pop":Ot(e.index,!0);break;case"branch":await iu(e.index);break;case"diff":await su(e.index),await qt(e);break;case"drop":await Du(e.index);break;case"back":await te();break}}async function Mt(){let e=x("git status --porcelain");if(!e){console.log(l.yellow("\u6CA1\u6709\u9700\u8981 stash \u7684\u53D8\u66F4"));return}let t=e.split(`
24
+ `).some(r=>r.startsWith("??")),u=!1;t&&(u=await K({message:"\u68C0\u6D4B\u5230\u672A\u8DDF\u8E2A\u7684\u6587\u4EF6\uFF0C\u662F\u5426\u4E00\u5E76 stash?",choices:[{name:"\u662F (\u5305\u542B\u672A\u8DDF\u8E2A\u6587\u4EF6)",value:!0},{name:"\u5426 (\u4EC5\u5DF2\u8DDF\u8E2A\u6587\u4EF6)",value:!1}],theme:h}));let n=await Nt({message:"Stash \u6D88\u606F (\u53EF\u9009):",theme:h}),o=fe("\u521B\u5EFA stash...").start();try{let r="git stash push";u&&(r+=" -u"),n&&(r+=` -m "${n.replace(/"/g,'\\"')}"`),ee(r,{stdio:"pipe"}),o.succeed("Stash \u521B\u5EFA\u6210\u529F"),await te()}catch{o.fail("Stash \u521B\u5EFA\u5931\u8D25")}}function Ot(e,t){let u=t?"pop":"apply",n=fe(`${t?"\u5F39\u51FA":"\u5E94\u7528"} stash...`).start();try{ee(`git stash ${u} stash@{${e}}`,{stdio:"pipe"}),n.succeed(`Stash ${t?"\u5DF2\u5F39\u51FA":"\u5DF2\u5E94\u7528"}`)}catch{n.fail("\u64CD\u4F5C\u5931\u8D25\uFF0C\u53EF\u80FD\u5B58\u5728\u51B2\u7A81");let o=x("git status --porcelain");(o.includes("UU")||o.includes("AA"))&&console.log(l.yellow(`
25
+ \u5B58\u5728\u51B2\u7A81\uFF0C\u8BF7\u624B\u52A8\u89E3\u51B3\u540E\u63D0\u4EA4`))}}async function su(e){try{ee(`git stash show -p --color=always stash@{${e}}`,{stdio:"inherit"}),console.log(),await Nt({message:l.dim("\u6309 Enter \u8FD4\u56DE\u83DC\u5355..."),theme:h})}catch{console.log(l.red("\u65E0\u6CD5\u663E\u793A\u5DEE\u5F02"))}}async function iu(e){let t=await K({message:"\u9009\u62E9\u5206\u652F\u7C7B\u578B:",choices:[{name:"feature",value:"feature"},{name:"hotfix",value:"hotfix"},{name:"\u53D6\u6D88",value:"__cancel__"}],theme:h});if(t==="__cancel__"){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let u=await je(t);if(!u)return;let n=fe(`\u521B\u5EFA\u5206\u652F ${u}...`).start();try{ee(`git stash branch "${u}" stash@{${e}}`,{stdio:"pipe"}),n.succeed(`\u5206\u652F\u5DF2\u521B\u5EFA: ${u} (stash \u5DF2\u81EA\u52A8\u5F39\u51FA)`)}catch{n.fail("\u521B\u5EFA\u5206\u652F\u5931\u8D25")}}async function Du(e){if(!await K({message:`\u786E\u8BA4\u5220\u9664 stash@{${e}}?`,choices:[{name:"\u662F",value:!0},{name:"\u5426",value:!1}],theme:h})){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let u=fe("\u5220\u9664 stash...").start();try{ee(`git stash drop stash@{${e}}`,{stdio:"pipe"}),u.succeed("Stash \u5DF2\u5220\u9664")}catch{u.fail("\u5220\u9664\u5931\u8D25")}}a();import{execSync as Ne}from"child_process";import{select as au,input as ne,confirm as Gt,checkbox as lu}from"@inquirer/prompts";import cu from"ora";var fu=[{type:"feat",emoji:"\u2728",description:"\u65B0\u529F\u80FD"},{type:"fix",emoji:"\u{1F41B}",description:"\u4FEE\u590D Bug"},{type:"docs",emoji:"\u{1F4DD}",description:"\u6587\u6863\u66F4\u65B0"},{type:"style",emoji:"\u{1F484}",description:"\u4EE3\u7801\u683C\u5F0F (\u4E0D\u5F71\u54CD\u529F\u80FD)"},{type:"refactor",emoji:"\u267B\uFE0F",description:"\u91CD\u6784 (\u975E\u65B0\u529F\u80FD/\u4FEE\u590D)"},{type:"perf",emoji:"\u26A1\uFE0F",description:"\u6027\u80FD\u4F18\u5316"},{type:"test",emoji:"\u2705",description:"\u6D4B\u8BD5\u76F8\u5173"},{type:"build",emoji:"\u{1F4E6}",description:"\u6784\u5EFA/\u4F9D\u8D56\u76F8\u5173"},{type:"ci",emoji:"\u{1F477}",description:"CI/CD \u76F8\u5173"},{type:"chore",emoji:"\u{1F527}",description:"\u5176\u4ED6\u6742\u9879"},{type:"revert",emoji:"\u23EA",description:"\u56DE\u9000\u63D0\u4EA4"}];function hu(e){let t=e.commitEmojis||{};return fu.map(u=>({...u,emoji:t[u.type]||u.emoji}))}function qe(){let e=x("git status --porcelain");if(!e)return{staged:[],unstaged:[]};let t=[],u=[];for(let n of e.split(`
26
+ `)){if(!n)continue;let o=n[0],r=n[1],s=n.slice(3);if(o!==" "&&o!=="?"&&t.push({status:o,file:s}),r!==" "||o==="?"){let i=o==="?"?"?":r;u.push({status:i,file:s})}}return{staged:t,unstaged:u}}function Ge(e){return{M:l.yellow("M"),A:l.green("A"),D:l.red("D"),R:l.yellow("R"),C:l.yellow("C"),"?":l.green("?")}[e]||e}async function We(){let e=M(),{staged:t,unstaged:u}=qe();if(t.length===0){if(u.length===0){console.log(l.yellow("\u5DE5\u4F5C\u533A\u5E72\u51C0\uFF0C\u6CA1\u6709\u9700\u8981\u63D0\u4EA4\u7684\u66F4\u6539"));return}console.log(l.yellow("\u6CA1\u6709\u6682\u5B58\u7684\u66F4\u6539")),w(),console.log("\u672A\u6682\u5B58\u7684\u6587\u4EF6:");for(let{status:A,file:He}of u)console.log(` ${Ge(A)} ${He}`);if(w(),e.autoStage??!0)Ne("git add -A",{stdio:"pipe"}),console.log(l.green("\u2714 \u5DF2\u81EA\u52A8\u6682\u5B58\u6240\u6709\u66F4\u6539")),w(),t=qe().staged;else{let A=await lu({message:"\u9009\u62E9\u8981\u6682\u5B58\u7684\u6587\u4EF6:",choices:u.map(({status:he,file:Ke})=>({name:`${Ge(he)} ${Ke}`,value:Ke,checked:!0})),theme:h});if(A.length===0){console.log(l.yellow("\u6CA1\u6709\u9009\u62E9\u4EFB\u4F55\u6587\u4EF6\uFF0C\u5DF2\u53D6\u6D88"));return}for(let he of A)Ne(`git add "${he}"`,{stdio:"pipe"});console.log(l.green(`\u2714 \u5DF2\u6682\u5B58 ${A.length} \u4E2A\u6587\u4EF6`)),w(),t=qe().staged}}else{console.log("\u5DF2\u6682\u5B58\u7684\u6587\u4EF6:");for(let{status:$,file:A}of t)console.log(` ${Ge($)} ${A}`);w()}let n=hu(e),o=await au({message:"\u9009\u62E9\u63D0\u4EA4\u7C7B\u578B:",choices:n.map($=>({name:`${$.emoji} ${$.type.padEnd(10)} ${l.dim($.description)}`,value:$})),theme:h}),r=await ne({message:"\u8F93\u5165\u5F71\u54CD\u8303\u56F4 scope (\u53EF\u8DF3\u8FC7):",theme:h}),s=await ne({message:"\u8F93\u5165\u7B80\u77ED\u63CF\u8FF0:",validate:$=>$.trim()?$.length>72?"\u63CF\u8FF0\u4E0D\u80FD\u8D85\u8FC7 72 \u4E2A\u5B57\u7B26":!0:"\u63CF\u8FF0\u4E0D\u80FD\u4E3A\u7A7A",theme:h}),i=await ne({message:"\u8F93\u5165\u8BE6\u7EC6\u63CF\u8FF0 (\u53EF\u8DF3\u8FC7):",theme:h}),D=await Gt({message:"\u662F\u5426\u5305\u542B\u7834\u574F\u6027\u53D8\u66F4 (BREAKING CHANGE)?",default:!1,theme:h}),f="";D&&(f=await ne({message:"\u63CF\u8FF0\u7834\u574F\u6027\u53D8\u66F4:",validate:$=>$.trim()?!0:"\u8BF7\u63CF\u8FF0\u7834\u574F\u6027\u53D8\u66F4",theme:h}));let m=await ne({message:"\u5173\u8054 Issue (\u5982 #123, \u53EF\u8DF3\u8FC7):",theme:h}),{type:g,emoji:b}=o,S=r?`(${r})`:"",v=D?"!":"",E=`${e.useEmoji??!0?`${b} `:""}${g}${S}${v}: ${s}`;if((i||D||m)&&(E+=`
27
+ `,i&&(E+=`
28
+ ${i}`),D&&(E+=`
29
+
30
+ BREAKING CHANGE: ${f}`),m&&(E+=`
31
+
32
+ ${m}`)),w(),console.log("\u63D0\u4EA4\u4FE1\u606F\u9884\u89C8:"),console.log(l.green(E)),w(),!await Gt({message:"\u786E\u8BA4\u63D0\u4EA4?",default:!0,theme:h})){console.log(l.yellow("\u5DF2\u53D6\u6D88"));return}let O=cu("\u6B63\u5728\u63D0\u4EA4...").start();try{let $=E.replace(/"/g,'\\"');Ne(`git commit -m "${$}"`,{stdio:"pipe"}),O.succeed("\u63D0\u4EA4\u6210\u529F");let A=x("git rev-parse --short HEAD");console.log(l.dim(`commit: ${A}`))}catch($){O.fail("\u63D0\u4EA4\u5931\u8D25"),$ instanceof Error&&console.log(l.red($.message))}}a();function Ve(){return`
17
33
  \u5206\u652F\u547D\u4EE4:
18
34
  gw feature [--base <branch>] \u521B\u5EFA feature \u5206\u652F
19
- gw feat [--base <branch>] \u540C\u4E0A (\u7B80\u5199)
20
- gw f [--base <branch>] \u540C\u4E0A (\u7B80\u5199)
35
+ gw feat [--base <branch>] \u540C\u4E0A (\u522B\u540D)
36
+ gw f [--base <branch>] \u540C\u4E0A (\u522B\u540D)
21
37
 
22
38
  gw hotfix [--base <branch>] \u521B\u5EFA hotfix \u5206\u652F
23
- gw fix [--base <branch>] \u540C\u4E0A (\u7B80\u5199)
24
- gw h [--base <branch>] \u540C\u4E0A (\u7B80\u5199)
39
+ gw fix [--base <branch>] \u540C\u4E0A (\u522B\u540D)
40
+ gw h [--base <branch>] \u540C\u4E0A (\u522B\u540D)
25
41
 
26
42
  gw delete [branch] \u5220\u9664\u672C\u5730/\u8FDC\u7A0B\u5206\u652F
27
- gw del [branch] \u540C\u4E0A (\u7B80\u5199)
28
- gw d [branch] \u540C\u4E0A (\u7B80\u5199)
43
+ gw del [branch] \u540C\u4E0A (\u522B\u540D)
44
+ gw d [branch] \u540C\u4E0A (\u522B\u540D)
29
45
 
30
46
  Tag \u547D\u4EE4:
31
47
  gw tags [prefix] \u5217\u51FA\u6240\u6709 tag\uFF0C\u53EF\u6309\u524D\u7F00\u8FC7\u6EE4
32
- gw ts [prefix] \u540C\u4E0A (\u7B80\u5199)
48
+ gw ts [prefix] \u540C\u4E0A (\u522B\u540D)
33
49
 
34
50
  gw tag [prefix] \u4EA4\u4E92\u5F0F\u9009\u62E9\u7248\u672C\u7C7B\u578B\u5E76\u521B\u5EFA tag
35
- gw t [prefix] \u540C\u4E0A (\u7B80\u5199)
51
+ gw t [prefix] \u540C\u4E0A (\u522B\u540D)
36
52
 
37
53
  \u53D1\u5E03\u547D\u4EE4:
38
54
  gw release \u4EA4\u4E92\u5F0F\u9009\u62E9\u7248\u672C\u53F7\u5E76\u66F4\u65B0 package.json
39
- gw r \u540C\u4E0A (\u7B80\u5199)
55
+ gw r \u540C\u4E0A (\u522B\u540D)
40
56
 
41
57
  \u914D\u7F6E\u547D\u4EE4:
42
58
  gw init \u521D\u59CB\u5316\u914D\u7F6E\u6587\u4EF6 .gwrc.json
43
59
 
44
60
  Stash \u547D\u4EE4:
45
61
  gw stash \u4EA4\u4E92\u5F0F\u7BA1\u7406 stash
46
- gw s \u540C\u4E0A (\u7B80\u5199)
62
+ gw s \u540C\u4E0A (\u522B\u540D)
63
+ gw st \u540C\u4E0A (\u522B\u540D)
64
+
65
+ Commit \u547D\u4EE4:
66
+ gw commit \u4EA4\u4E92\u5F0F\u63D0\u4EA4 (Conventional Commits + Gitmoji)
67
+ gw c \u540C\u4E0A (\u522B\u540D)
68
+ gw cm \u540C\u4E0A (\u522B\u540D)
47
69
 
48
70
  \u793A\u4F8B:
49
- gw feat \u57FA\u4E8E main/master \u521B\u5EFA feature \u5206\u652F
50
- gw feat --base develop \u57FA\u4E8E develop \u5206\u652F\u521B\u5EFA feature \u5206\u652F
51
- gw fix --base release \u57FA\u4E8E release \u5206\u652F\u521B\u5EFA hotfix \u5206\u652F
52
- gw del \u4EA4\u4E92\u5F0F\u9009\u62E9\u5E76\u5220\u9664\u5206\u652F
53
- gw del feature/xxx \u76F4\u63A5\u5220\u9664\u6307\u5B9A\u5206\u652F
54
- gw tags v \u5217\u51FA\u6240\u6709 v \u5F00\u5934\u7684 tag
55
- gw tag \u4EA4\u4E92\u5F0F\u521B\u5EFA tag
71
+ gw f \u57FA\u4E8E main/master \u521B\u5EFA feature \u5206\u652F
72
+ gw f --base develop \u57FA\u4E8E develop \u5206\u652F\u521B\u5EFA feature \u5206\u652F
73
+ gw h --base release \u57FA\u4E8E release \u5206\u652F\u521B\u5EFA hotfix \u5206\u652F
74
+ gw d \u4EA4\u4E92\u5F0F\u9009\u62E9\u5E76\u5220\u9664\u5206\u652F
75
+ gw d feature/xxx \u76F4\u63A5\u5220\u9664\u6307\u5B9A\u5206\u652F
76
+ gw ts v \u5217\u51FA\u6240\u6709 v \u5F00\u5934\u7684 tag
77
+ gw t \u4EA4\u4E92\u5F0F\u521B\u5EFA tag
78
+ gw r \u4EA4\u4E92\u5F0F\u53D1\u5E03\u7248\u672C
79
+ gw s \u4EA4\u4E92\u5F0F\u7BA1\u7406 stash
80
+ gw c \u4EA4\u4E92\u5F0F\u63D0\u4EA4\u4EE3\u7801
56
81
 
57
82
  \u5206\u652F\u547D\u540D\u683C\u5F0F:
58
- feature/${T}-<Story ID>-<\u63CF\u8FF0>
59
- hotfix/${T}-<Issue ID>-<\u63CF\u8FF0>
60
- `}var b=Ne("gw");b.command("feature","\u521B\u5EFA feature \u5206\u652F").alias("feat").alias("f").option("--base <branch>","\u6307\u5B9A\u57FA\u7840\u5206\u652F").action(e=>(P(),J("feature",e.base)));b.command("hotfix","\u521B\u5EFA hotfix \u5206\u652F").alias("fix").alias("h").option("--base <branch>","\u6307\u5B9A\u57FA\u7840\u5206\u652F").action(e=>(P(),J("hotfix",e.base)));b.command("delete [branch]","\u5220\u9664\u672C\u5730/\u8FDC\u7A0B\u5206\u652F").alias("del").alias("d").action(e=>(P(),Q(e)));b.command("tags [prefix]","\u5217\u51FA\u6240\u6709 tag\uFF0C\u53EF\u6309\u524D\u7F00\u8FC7\u6EE4").alias("ts").action(e=>(P(),ae(e)));b.command("tag [prefix]","\u4EA4\u4E92\u5F0F\u9009\u62E9\u7248\u672C\u7C7B\u578B\u5E76\u521B\u5EFA tag").alias("t").action(e=>(P(),ne(e)));b.command("release","\u4EA4\u4E92\u5F0F\u9009\u62E9\u7248\u672C\u53F7\u5E76\u66F4\u65B0 package.json").alias("r").action(()=>se());b.command("init","\u521D\u59CB\u5316\u914D\u7F6E\u6587\u4EF6 .gwrc.json").action(()=>ie());b.command("stash","\u4EA4\u4E92\u5F0F\u7BA1\u7406 stash").alias("s").alias("st").action(()=>(P(),V()));b.help(e=>{e.push({body:ue()})});b.version("0.0.1");b.parse();
83
+ feature/${W}-<Story ID>-<\u63CF\u8FF0>
84
+ hotfix/${W}-<Issue ID>-<\u63CF\u8FF0>
85
+ `}process.on("uncaughtException",e=>{e instanceof z&&process.exit(0),console.error(e),process.exit(1)});var Wt="0.0.2";async function pu(){switch(console.log(l.green(`
86
+ \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2557 \u2588\u2588\u2557
87
+ \u255A\u2550\u2550\u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255D\u255A\u2588\u2588\u2557\u2588\u2588\u2554\u255D
88
+ \u2588\u2588\u2588\u2554\u255D \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2557 \u255A\u2588\u2588\u2588\u2554\u255D
89
+ \u2588\u2588\u2588\u2554\u255D \u2588\u2588 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u255D \u2588\u2588\u2554\u2588\u2588\u2557
90
+ \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u255A\u2588\u2588\u2588\u2588\u2588\u2554\u255D\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2554\u255D \u2588\u2588\u2557
91
+ \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u255D \u255A\u2550\u2550\u2550\u2550\u2550\u2550\u255D\u255A\u2550\u255D \u255A\u2550\u255D
92
+ `)),console.log(l.dim(` git-workflow v${Wt}
93
+ `)),await mu({message:"\u9009\u62E9\u64CD\u4F5C:",choices:[{name:`[1] \u2728 \u521B\u5EFA feature \u5206\u652F ${l.dim("gw f")}`,value:"feature"},{name:`[2] \u{1F41B} \u521B\u5EFA hotfix \u5206\u652F ${l.dim("gw h")}`,value:"hotfix"},{name:`[3] \u{1F5D1}\uFE0F \u5220\u9664\u5206\u652F ${l.dim("gw d")}`,value:"delete"},{name:`[4] \u{1F4DD} \u63D0\u4EA4\u4EE3\u7801 ${l.dim("gw c")}`,value:"commit"},{name:`[5] \u{1F3F7}\uFE0F \u521B\u5EFA tag ${l.dim("gw t")}`,value:"tag"},{name:`[6] \u{1F4CB} \u5217\u51FA tags ${l.dim("gw ts")}`,value:"tags"},{name:`[7] \u{1F4E6} \u53D1\u5E03\u7248\u672C ${l.dim("gw r")}`,value:"release"},{name:`[8] \u{1F4BE} \u7BA1\u7406 stash ${l.dim("gw s")}`,value:"stash"},{name:`[9] \u2699\uFE0F \u521D\u59CB\u5316\u914D\u7F6E ${l.dim("gw init")}`,value:"init"},{name:"[0] \u2753 \u5E2E\u52A9",value:"help"},{name:"[q] \u9000\u51FA",value:"exit"}],loop:!1,theme:h})){case"feature":k(),await Q("feature");break;case"hotfix":k(),await Q("hotfix");break;case"delete":k(),await Te();break;case"tag":k(),await Ie();break;case"tags":k(),await Ue();break;case"commit":k(),await We();break;case"release":await Me();break;case"stash":k(),await te();break;case"init":await Oe();break;case"help":console.log(Ve());break;case"exit":break}}var L=gu("gw");L.command("","\u663E\u793A\u4EA4\u4E92\u5F0F\u83DC\u5355").action(()=>pu());L.command("feature","\u521B\u5EFA feature \u5206\u652F").alias("feat").alias("f").option("--base <branch>","\u6307\u5B9A\u57FA\u7840\u5206\u652F").action(e=>(k(),Q("feature",e.base)));L.command("hotfix","\u521B\u5EFA hotfix \u5206\u652F").alias("fix").alias("h").option("--base <branch>","\u6307\u5B9A\u57FA\u7840\u5206\u652F").action(e=>(k(),Q("hotfix",e.base)));L.command("delete [branch]","\u5220\u9664\u672C\u5730/\u8FDC\u7A0B\u5206\u652F").alias("del").alias("d").action(e=>(k(),Te(e)));L.command("tags [prefix]","\u5217\u51FA\u6240\u6709 tag\uFF0C\u53EF\u6309\u524D\u7F00\u8FC7\u6EE4").alias("ts").action(e=>(k(),Ue(e)));L.command("tag [prefix]","\u4EA4\u4E92\u5F0F\u9009\u62E9\u7248\u672C\u7C7B\u578B\u5E76\u521B\u5EFA tag").alias("t").action(e=>(k(),Ie(e)));L.command("release","\u4EA4\u4E92\u5F0F\u9009\u62E9\u7248\u672C\u53F7\u5E76\u66F4\u65B0 package.json").alias("r").action(()=>Me());L.command("init","\u521D\u59CB\u5316\u914D\u7F6E\u6587\u4EF6 .gwrc.json").action(()=>Oe());L.command("stash","\u4EA4\u4E92\u5F0F\u7BA1\u7406 stash").alias("s").alias("st").action(()=>(k(),te()));L.command("commit","\u4EA4\u4E92\u5F0F\u63D0\u4EA4 (Conventional Commits + Gitmoji)").alias("c").alias("cm").action(()=>(k(),We()));L.help(e=>{e.push({body:Ve()})});L.version(Wt);L.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zjex/git-workflow",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "个人常用的 Git 工作流工具,快速创建规范的开发分支和管理 Tag",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,6 +14,8 @@
14
14
  "build": "tsup",
15
15
  "dev": "tsx src/index.ts",
16
16
  "changelog": "changelogen -o CHANGELOG.md",
17
+ "release": "./scripts/release.sh",
18
+ "release:dry": "./scripts/release.sh --dry-run",
17
19
  "publish:npm": "npm run build && npm run changelog && npm publish",
18
20
  "prepublishOnly": "npm run build",
19
21
  "prepare": "husky"
@@ -0,0 +1,57 @@
1
+ # 发布脚本
2
+
3
+ ## 使用方法
4
+
5
+ ```bash
6
+ # 预览发布流程(推荐先执行)
7
+ npm run release:dry
8
+
9
+ # 实际发布
10
+ npm run release
11
+ ```
12
+
13
+ ## 优化特性
14
+
15
+ ### ✅ 已实现的优化
16
+
17
+ 1. **Dry-run 模式** - 预览发布流程,不实际执行
18
+ 2. **自动回滚** - 出错时自动恢复 package.json、删除 tag、回退 commit
19
+ 3. **多重确认** - 版本选择、CHANGELOG 预览、最终发布三次确认
20
+ 4. **完整验证**
21
+ - npm 登录状态检查
22
+ - 版本号重复检查
23
+ - 构建产物验证
24
+ - 测试运行(如果有)
25
+ 5. **CHANGELOG 预览** - 生成后显示最新内容并确认
26
+ 6. **错误处理** - 完善的错误捕获和提示
27
+ 7. **友好输出** - 带颜色的步骤提示和进度显示
28
+
29
+ ## 前置条件
30
+
31
+ - 确保已登录 npm:`npm login`
32
+ - 确保有 GitHub 推送权限
33
+ - 确保在 main/master 分支(或确认在其他分支发布)
34
+ - 确保没有未提交的更改
35
+
36
+ ## 发布流程
37
+
38
+ 1. 检查必要命令(git, node, npm)
39
+ 2. 检查 npm 登录状态
40
+ 3. 检查 git 仓库状态
41
+ 4. 拉取最新代码
42
+ 5. 选择版本号
43
+ 6. 检查版本是否已存在
44
+ 7. 运行测试(如果有)
45
+ 8. 构建项目
46
+ 9. 验证构建产物
47
+ 10. 生成 CHANGELOG
48
+ 11. 预览并确认
49
+ 12. 最终确认
50
+ 13. 提交更改
51
+ 14. 创建 tag
52
+ 15. 推送到 GitHub
53
+ 16. 发布到 npm
54
+
55
+ ## 使用示例
56
+
57
+ 详见主 README 的发布部分。