@truenine/memory-sync-cli 0.0.1

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/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # TrueNine Life CLI
2
+
3
+ 跨 AI 编程工具的提示词同步工具。一套规则,多端适配。
4
+
5
+
6
+ ## 支持的 AI 工具
7
+
8
+ **IDE**
9
+ - Cursor IDE
10
+ - Kiro IDE
11
+ - Windsurf IDE
12
+ - Qoder IDE
13
+ - CodeBuddy IDE
14
+ - Antigravity IDE
15
+
16
+ **CLI 工具**
17
+ - Claude Code CLI
18
+ - Codex CLI
19
+ - Gemini CLI
20
+ - FactoryDroid CLI
21
+
22
+ **配置文件**
23
+ - JetBrains IDE
24
+ - VSCode IDE
25
+
26
+ ## 插件体系
27
+
28
+ 采用 input → transform → output 管道架构:
29
+
30
+ - **Input 插件**: 读取源文件(Aindex、Ref、WorkspaceGroup)
31
+ - **Transform 插件**: 处理内容
32
+ - **Output 插件**: 写入目标格式(各 IDE/CLI 适配器)
33
+
34
+ ## 配置
35
+
36
+ 配置文件优先级:`cwd()/.memorysync.json` > `~/.aindex/configs.json`
37
+
38
+ 首次运行会自动创建 `~/.aindex/config.json`。
39
+
40
+ ## License
41
+
42
+ Private
@@ -0,0 +1 @@
1
+ import{createRequire as e}from"node:module";var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),c=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},l=(e,r,i)=>(i=e==null?{}:t(a(e)),c(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),u=e=>t=>l(t.default,e),d=e(import.meta.url);export{l as i,d as n,u as r,s as t};
@@ -0,0 +1,99 @@
1
+ import{i as e,t}from"./chunk-YV1pC1vC.mjs";import{t as n}from"./picocolors-cXP5_ufZ.mjs";import r,{stdin as i,stdout as a}from"node:process";import{stripVTControlCharacters as o}from"node:util";import*as s from"node:readline";import c from"node:readline";import{Writable as l}from"node:stream";var u=t(((e,t)=>{let n={to(e,t){return t?`[${t+1};${e+1}H`:`[${e+1}G`},move(e,t){let n=``;return e<0?n+=`[${-e}D`:e>0&&(n+=`[${e}C`),t<0?n+=`[${-t}A`:t>0&&(n+=`[${t}B`),n},up:(e=1)=>`[${e}A`,down:(e=1)=>`[${e}B`,forward:(e=1)=>`[${e}C`,backward:(e=1)=>`[${e}D`,nextLine:(e=1)=>`\x1B[E`.repeat(e),prevLine:(e=1)=>`\x1B[F`.repeat(e),left:`\x1B[G`,hide:`\x1B[?25l`,show:`\x1B[?25h`,save:`\x1B7`,restore:`\x1B8`};t.exports={cursor:n,scroll:{up:(e=1)=>`\x1B[S`.repeat(e),down:(e=1)=>`\x1B[T`.repeat(e)},erase:{screen:`\x1B[2J`,up:(e=1)=>`\x1B[1J`.repeat(e),down:(e=1)=>`\x1B[J`.repeat(e),line:`\x1B[2K`,lineEnd:`\x1B[K`,lineStart:`\x1B[1K`,lines(e){let t=``;for(let r=0;r<e;r++)t+=this.line+(r<e-1?n.up():``);return e&&(t+=n.left),t}},beep:`\x07`}})),d=u(),f=e(n(),1);function ee({onlyFirst:e=!1}={}){let t=[`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`,`(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))`].join(`|`);return new RegExp(t,e?void 0:`g`)}const p=ee();function m(e){if(typeof e!=`string`)throw TypeError(`Expected a \`string\`, got \`${typeof e}\``);return e.replace(p,``)}function h(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,`default`)?e.default:e}var g={exports:{}};(function(e){var t={};e.exports=t,t.eastAsianWidth=function(e){var t=e.charCodeAt(0),n=e.length==2?e.charCodeAt(1):0,r=t;return 55296<=t&&t<=56319&&56320<=n&&n<=57343&&(t&=1023,n&=1023,r=t<<10|n,r+=65536),r==12288||65281<=r&&r<=65376||65504<=r&&r<=65510?`F`:r==8361||65377<=r&&r<=65470||65474<=r&&r<=65479||65482<=r&&r<=65487||65490<=r&&r<=65495||65498<=r&&r<=65500||65512<=r&&r<=65518?`H`:4352<=r&&r<=4447||4515<=r&&r<=4519||4602<=r&&r<=4607||9001<=r&&r<=9002||11904<=r&&r<=11929||11931<=r&&r<=12019||12032<=r&&r<=12245||12272<=r&&r<=12283||12289<=r&&r<=12350||12353<=r&&r<=12438||12441<=r&&r<=12543||12549<=r&&r<=12589||12593<=r&&r<=12686||12688<=r&&r<=12730||12736<=r&&r<=12771||12784<=r&&r<=12830||12832<=r&&r<=12871||12880<=r&&r<=13054||13056<=r&&r<=19903||19968<=r&&r<=42124||42128<=r&&r<=42182||43360<=r&&r<=43388||44032<=r&&r<=55203||55216<=r&&r<=55238||55243<=r&&r<=55291||63744<=r&&r<=64255||65040<=r&&r<=65049||65072<=r&&r<=65106||65108<=r&&r<=65126||65128<=r&&r<=65131||110592<=r&&r<=110593||127488<=r&&r<=127490||127504<=r&&r<=127546||127552<=r&&r<=127560||127568<=r&&r<=127569||131072<=r&&r<=194367||177984<=r&&r<=196605||196608<=r&&r<=262141?`W`:32<=r&&r<=126||162<=r&&r<=163||165<=r&&r<=166||r==172||r==175||10214<=r&&r<=10221||10629<=r&&r<=10630?`Na`:r==161||r==164||167<=r&&r<=168||r==170||173<=r&&r<=174||176<=r&&r<=180||182<=r&&r<=186||188<=r&&r<=191||r==198||r==208||215<=r&&r<=216||222<=r&&r<=225||r==230||232<=r&&r<=234||236<=r&&r<=237||r==240||242<=r&&r<=243||247<=r&&r<=250||r==252||r==254||r==257||r==273||r==275||r==283||294<=r&&r<=295||r==299||305<=r&&r<=307||r==312||319<=r&&r<=322||r==324||328<=r&&r<=331||r==333||338<=r&&r<=339||358<=r&&r<=359||r==363||r==462||r==464||r==466||r==468||r==470||r==472||r==474||r==476||r==593||r==609||r==708||r==711||713<=r&&r<=715||r==717||r==720||728<=r&&r<=731||r==733||r==735||768<=r&&r<=879||913<=r&&r<=929||931<=r&&r<=937||945<=r&&r<=961||963<=r&&r<=969||r==1025||1040<=r&&r<=1103||r==1105||r==8208||8211<=r&&r<=8214||8216<=r&&r<=8217||8220<=r&&r<=8221||8224<=r&&r<=8226||8228<=r&&r<=8231||r==8240||8242<=r&&r<=8243||r==8245||r==8251||r==8254||r==8308||r==8319||8321<=r&&r<=8324||r==8364||r==8451||r==8453||r==8457||r==8467||r==8470||8481<=r&&r<=8482||r==8486||r==8491||8531<=r&&r<=8532||8539<=r&&r<=8542||8544<=r&&r<=8555||8560<=r&&r<=8569||r==8585||8592<=r&&r<=8601||8632<=r&&r<=8633||r==8658||r==8660||r==8679||r==8704||8706<=r&&r<=8707||8711<=r&&r<=8712||r==8715||r==8719||r==8721||r==8725||r==8730||8733<=r&&r<=8736||r==8739||r==8741||8743<=r&&r<=8748||r==8750||8756<=r&&r<=8759||8764<=r&&r<=8765||r==8776||r==8780||r==8786||8800<=r&&r<=8801||8804<=r&&r<=8807||8810<=r&&r<=8811||8814<=r&&r<=8815||8834<=r&&r<=8835||8838<=r&&r<=8839||r==8853||r==8857||r==8869||r==8895||r==8978||9312<=r&&r<=9449||9451<=r&&r<=9547||9552<=r&&r<=9587||9600<=r&&r<=9615||9618<=r&&r<=9621||9632<=r&&r<=9633||9635<=r&&r<=9641||9650<=r&&r<=9651||9654<=r&&r<=9655||9660<=r&&r<=9661||9664<=r&&r<=9665||9670<=r&&r<=9672||r==9675||9678<=r&&r<=9681||9698<=r&&r<=9701||r==9711||9733<=r&&r<=9734||r==9737||9742<=r&&r<=9743||9748<=r&&r<=9749||r==9756||r==9758||r==9792||r==9794||9824<=r&&r<=9825||9827<=r&&r<=9829||9831<=r&&r<=9834||9836<=r&&r<=9837||r==9839||9886<=r&&r<=9887||9918<=r&&r<=9919||9924<=r&&r<=9933||9935<=r&&r<=9953||r==9955||9960<=r&&r<=9983||r==10045||r==10071||10102<=r&&r<=10111||11093<=r&&r<=11097||12872<=r&&r<=12879||57344<=r&&r<=63743||65024<=r&&r<=65039||r==65533||127232<=r&&r<=127242||127248<=r&&r<=127277||127280<=r&&r<=127337||127344<=r&&r<=127386||917760<=r&&r<=917999||983040<=r&&r<=1048573||1048576<=r&&r<=1114109?`A`:`N`},t.characterLength=function(e){var t=this.eastAsianWidth(e);return t==`F`||t==`W`||t==`A`?2:1};function n(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g)||[]}t.length=function(e){for(var t=n(e),r=0,i=0;i<t.length;i++)r+=this.characterLength(t[i]);return r},t.slice=function(e,r,i){textLen=t.length(e),r||=0,i||=1,r<0&&(r=textLen+r),i<0&&(i=textLen+i);for(var a=``,o=0,s=n(e),c=0;c<s.length;c++){var l=s[c],u=t.length(l);if(o>=r-(u==2?1:0))if(o+u<=i)a+=l;else break;o+=u}return a}})(g);var _=g.exports;const v=h(_),te=h(function(){return/\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\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])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\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\uDF7C\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\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\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\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\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-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*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\u26A7\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-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\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[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g});function y(e,t={}){if(typeof e!=`string`||e.length===0||(t={ambiguousIsNarrow:!0,...t},e=m(e),e.length===0))return 0;e=e.replace(te(),` `);let n=t.ambiguousIsNarrow?1:2,r=0;for(let t of e){let e=t.codePointAt(0);if(!(e<=31||e>=127&&e<=159||e>=768&&e<=879))switch(v.eastAsianWidth(t)){case`F`:case`W`:r+=2;break;case`A`:r+=n;break;default:r+=1}}return r}const ne=(e=0)=>t=>`\x1B[${t+e}m`,re=(e=0)=>t=>`\x1B[${38+e};5;${t}m`,ie=(e=0)=>(t,n,r)=>`\x1B[${38+e};2;${t};${n};${r}m`,b={modifier:{reset:[0,0],bold:[1,22],dim:[2,22],italic:[3,23],underline:[4,24],overline:[53,55],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],gray:[90,39],grey:[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],bgGray:[100,49],bgGrey:[100,49],bgRedBright:[101,49],bgGreenBright:[102,49],bgYellowBright:[103,49],bgBlueBright:[104,49],bgMagentaBright:[105,49],bgCyanBright:[106,49],bgWhiteBright:[107,49]}};Object.keys(b.modifier);const ae=Object.keys(b.color),oe=Object.keys(b.bgColor);[...ae,...oe];function se(){let e=new Map;for(let[t,n]of Object.entries(b)){for(let[t,r]of Object.entries(n))b[t]={open:`\x1B[${r[0]}m`,close:`\x1B[${r[1]}m`},n[t]=b[t],e.set(r[0],r[1]);Object.defineProperty(b,t,{value:n,enumerable:!1})}return Object.defineProperty(b,`codes`,{value:e,enumerable:!1}),b.color.close=`\x1B[39m`,b.bgColor.close=`\x1B[49m`,b.color.ansi=ne(),b.color.ansi256=re(),b.color.ansi16m=ie(),b.bgColor.ansi=ne(10),b.bgColor.ansi256=re(10),b.bgColor.ansi16m=ie(10),Object.defineProperties(b,{rgbToAnsi256:{value:(e,t,n)=>e===t&&t===n?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),enumerable:!1},hexToRgb:{value:e=>{let t=/[a-f\d]{6}|[a-f\d]{3}/i.exec(e.toString(16));if(!t)return[0,0,0];let[n]=t;n.length===3&&(n=[...n].map(e=>e+e).join(``));let r=Number.parseInt(n,16);return[r>>16&255,r>>8&255,r&255]},enumerable:!1},hexToAnsi256:{value:e=>b.rgbToAnsi256(...b.hexToRgb(e)),enumerable:!1},ansi256ToAnsi:{value:e=>{if(e<8)return 30+e;if(e<16)return 90+(e-8);let t,n,r;if(e>=232)t=((e-232)*10+8)/255,n=t,r=t;else{e-=16;let i=e%36;t=Math.floor(e/36)/5,n=Math.floor(i/6)/5,r=i%6/5}let i=Math.max(t,n,r)*2;if(i===0)return 30;let a=30+(Math.round(r)<<2|Math.round(n)<<1|Math.round(t));return i===2&&(a+=60),a},enumerable:!1},rgbToAnsi:{value:(e,t,n)=>b.ansi256ToAnsi(b.rgbToAnsi256(e,t,n)),enumerable:!1},hexToAnsi:{value:e=>b.ansi256ToAnsi(b.hexToAnsi256(e)),enumerable:!1}}),b}const ce=se(),x=new Set([`\x1B`,`›`]),S=`]8;;`,C=e=>`${x.values().next().value}[${e}m`,le=e=>`${x.values().next().value}${S}${e}`,ue=e=>e.split(` `).map(e=>y(e)),w=(e,t,n)=>{let r=[...t],i=!1,a=!1,o=y(m(e[e.length-1]));for(let[t,s]of r.entries()){let c=y(s);if(o+c<=n?e[e.length-1]+=s:(e.push(s),o=0),x.has(s)&&(i=!0,a=r.slice(t+1).join(``).startsWith(S)),i){a?s===`\x07`&&(i=!1,a=!1):s===`m`&&(i=!1);continue}o+=c,o===n&&t<r.length-1&&(e.push(``),o=0)}!o&&e[e.length-1].length>0&&e.length>1&&(e[e.length-2]+=e.pop())},de=e=>{let t=e.split(` `),n=t.length;for(;n>0&&!(y(t[n-1])>0);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},fe=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=ue(e),s=[``];for(let[r,i]of e.split(` `).entries()){n.trim!==!1&&(s[s.length-1]=s[s.length-1].trimStart());let e=y(s[s.length-1]);if(r!==0&&(e>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),e=0),(e>0||n.trim===!1)&&(s[s.length-1]+=` `,e++)),n.hard&&o[r]>t){let n=t-e,a=1+Math.floor((o[r]-n-1)/t);Math.floor((o[r]-1)/t)<a&&s.push(``),w(s,i,t);continue}if(e+o[r]>t&&e>0&&o[r]>0){if(n.wordWrap===!1&&e<t){w(s,i,t);continue}s.push(``)}if(e+o[r]>t&&n.wordWrap===!1){w(s,i,t);continue}s[s.length-1]+=i}n.trim!==!1&&(s=s.map(e=>de(e)));let c=[...s.join(`
2
+ `)];for(let[e,t]of c.entries()){if(r+=t,x.has(t)){let{groups:t}=RegExp(`(?:\\[(?<code>\\d+)m|\\${S}(?<uri>.*))`).exec(c.slice(e).join(``))||{groups:{}};if(t.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}let n=ce.codes.get(Number(i));c[e+1]===`
3
+ `?(a&&(r+=le(``)),i&&n&&(r+=C(n))):t===`
4
+ `&&(i&&n&&(r+=C(i)),a&&(r+=le(a)))}return r};function pe(e,t,n){return String(e).normalize().replace(/\r\n/g,`
5
+ `).split(`
6
+ `).map(e=>fe(e,t,n)).join(`
7
+ `)}const T={actions:new Set([`up`,`down`,`left`,`right`,`space`,`enter`,`cancel`]),aliases:new Map([[`k`,`up`],[`j`,`down`],[`h`,`left`],[`l`,`right`],[``,`cancel`],[`escape`,`cancel`]])};function me(e){for(let t in e){let n=t;if(!Object.hasOwn(e,n))continue;let r=e[n];switch(n){case`aliases`:for(let e in r)Object.hasOwn(r,e)&&(T.aliases.has(e)||T.aliases.set(e,r[e]));break}}}function E(e,t){if(typeof e==`string`)return T.aliases.get(e)===t;for(let n of e)if(n!==void 0&&E(n,t))return!0;return!1}function he(e,t){if(e===t)return;let n=e.split(`
8
+ `),r=t.split(`
9
+ `),i=[];for(let e=0;e<Math.max(n.length,r.length);e++)n[e]!==r[e]&&i.push(e);return i}const ge=globalThis.process.platform.startsWith(`win`),D=Symbol(`clack:cancel`);function _e(e){return e===D}function O(e,t){let n=e;n.isTTY&&n.setRawMode(t)}function ve({input:e=i,output:t=a,overwrite:n=!0,hideCursor:r=!0}={}){let o=s.createInterface({input:e,output:t,prompt:``,tabSize:1});s.emitKeypressEvents(e,o),e.isTTY&&e.setRawMode(!0);let c=(i,{name:a,sequence:o})=>{if(E([String(i),a,o],`cancel`)){r&&t.write(d.cursor.show),process.exit(0);return}if(!n)return;let l=a===`return`?0:-1,u=a===`return`?-1:0;s.moveCursor(t,l,u,()=>{s.clearLine(t,1,()=>{e.once(`keypress`,c)})})};return r&&t.write(d.cursor.hide),e.once(`keypress`,c),()=>{e.off(`keypress`,c),r&&t.write(d.cursor.show),e.isTTY&&!ge&&e.setRawMode(!1),o.terminal=!1,o.close()}}var ye=Object.defineProperty,be=(e,t,n)=>t in e?ye(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,k=(e,t,n)=>(be(e,typeof t==`symbol`?t:t+``,n),n),A=class{constructor(e,t=!0){k(this,`input`),k(this,`output`),k(this,`_abortSignal`),k(this,`rl`),k(this,`opts`),k(this,`_render`),k(this,`_track`,!1),k(this,`_prevFrame`,``),k(this,`_subscribers`,new Map),k(this,`_cursor`,0),k(this,`state`,`initial`),k(this,`error`,``),k(this,`value`);let{input:n=i,output:r=a,render:o,signal:s,...c}=e;this.opts=c,this.onKeypress=this.onKeypress.bind(this),this.close=this.close.bind(this),this.render=this.render.bind(this),this._render=o.bind(this),this._track=t,this._abortSignal=s,this.input=n,this.output=r}unsubscribe(){this._subscribers.clear()}setSubscriber(e,t){let n=this._subscribers.get(e)??[];n.push(t),this._subscribers.set(e,n)}on(e,t){this.setSubscriber(e,{cb:t})}once(e,t){this.setSubscriber(e,{cb:t,once:!0})}emit(e,...t){let n=this._subscribers.get(e)??[],r=[];for(let e of n)e.cb(...t),e.once&&r.push(()=>n.splice(n.indexOf(e),1));for(let e of r)e()}prompt(){return new Promise((e,t)=>{if(this._abortSignal){if(this._abortSignal.aborted)return this.state=`cancel`,this.close(),e(D);this._abortSignal.addEventListener(`abort`,()=>{this.state=`cancel`,this.close()},{once:!0})}let n=new l;n._write=(e,t,n)=>{this._track&&(this.value=this.rl?.line.replace(/\t/g,``),this._cursor=this.rl?.cursor??0,this.emit(`value`,this.value)),n()},this.input.pipe(n),this.rl=c.createInterface({input:this.input,output:n,tabSize:2,prompt:``,escapeCodeTimeout:50,terminal:!0}),c.emitKeypressEvents(this.input,this.rl),this.rl.prompt(),this.opts.initialValue!==void 0&&this._track&&this.rl.write(this.opts.initialValue),this.input.on(`keypress`,this.onKeypress),O(this.input,!0),this.output.on(`resize`,this.render),this.render(),this.once(`submit`,()=>{this.output.write(d.cursor.show),this.output.off(`resize`,this.render),O(this.input,!1),e(this.value)}),this.once(`cancel`,()=>{this.output.write(d.cursor.show),this.output.off(`resize`,this.render),O(this.input,!1),e(D)})})}onKeypress(e,t){if(this.state===`error`&&(this.state=`active`),t?.name&&(!this._track&&T.aliases.has(t.name)&&this.emit(`cursor`,T.aliases.get(t.name)),T.actions.has(t.name)&&this.emit(`cursor`,t.name)),e&&(e.toLowerCase()===`y`||e.toLowerCase()===`n`)&&this.emit(`confirm`,e.toLowerCase()===`y`),e===` `&&this.opts.placeholder&&(this.value||(this.rl?.write(this.opts.placeholder),this.emit(`value`,this.opts.placeholder))),e&&this.emit(`key`,e.toLowerCase()),t?.name===`return`){if(this.opts.validate){let e=this.opts.validate(this.value);e&&(this.error=e instanceof Error?e.message:e,this.state=`error`,this.rl?.write(this.value))}this.state!==`error`&&(this.state=`submit`)}E([e,t?.name,t?.sequence],`cancel`)&&(this.state=`cancel`),(this.state===`submit`||this.state===`cancel`)&&this.emit(`finalize`),this.render(),(this.state===`submit`||this.state===`cancel`)&&this.close()}close(){this.input.unpipe(),this.input.removeListener(`keypress`,this.onKeypress),this.output.write(`
10
+ `),O(this.input,!1),this.rl?.close(),this.rl=void 0,this.emit(`${this.state}`,this.value),this.unsubscribe()}restoreCursor(){let e=pe(this._prevFrame,process.stdout.columns,{hard:!0}).split(`
11
+ `).length-1;this.output.write(d.cursor.move(-999,e*-1))}render(){let e=pe(this._render(this)??``,process.stdout.columns,{hard:!0});if(e!==this._prevFrame){if(this.state===`initial`)this.output.write(d.cursor.hide);else{let t=he(this._prevFrame,e);if(this.restoreCursor(),t&&t?.length===1){let n=t[0];this.output.write(d.cursor.move(0,n)),this.output.write(d.erase.lines(1));let r=e.split(`
12
+ `);this.output.write(r[n]),this._prevFrame=e,this.output.write(d.cursor.move(0,r.length-n-1));return}if(t&&t?.length>1){let n=t[0];this.output.write(d.cursor.move(0,n)),this.output.write(d.erase.down());let r=e.split(`
13
+ `).slice(n);this.output.write(r.join(`
14
+ `)),this._prevFrame=e;return}this.output.write(d.erase.down())}this.output.write(e),this.state===`initial`&&(this.state=`active`),this._prevFrame=e}}},xe=class extends A{get cursor(){return this.value?0:1}get _value(){return this.cursor===0}constructor(e){super(e,!1),this.value=!!e.initialValue,this.on(`value`,()=>{this.value=this._value}),this.on(`confirm`,e=>{this.output.write(d.cursor.move(0,-1)),this.value=e,this.state=`submit`,this.close()}),this.on(`cursor`,()=>{this.value=!this.value})}},Se=Object.defineProperty,Ce=(e,t,n)=>t in e?Se(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t,n)=>(Ce(e,typeof t==`symbol`?t:t+``,n),n),M=(e,t,n)=>{if(!t.has(e))throw TypeError(`Cannot `+n)},N=(e,t,n)=>(M(e,t,`read from private field`),n?n.call(e):t.get(e)),we=(e,t,n)=>{if(t.has(e))throw TypeError(`Cannot add the same private member more than once`);t instanceof WeakSet?t.add(e):t.set(e,n)},Te=(e,t,n,r)=>(M(e,t,`write to private field`),r?r.call(e,n):t.set(e,n),n),P;let Ee=class extends A{constructor(e){super(e,!1),j(this,`options`),j(this,`cursor`,0),we(this,P,void 0);let{options:t}=e;Te(this,P,e.selectableGroups!==!1),this.options=Object.entries(t).flatMap(([e,t])=>[{value:e,group:!0,label:e},...t.map(t=>({...t,group:e}))]),this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),N(this,P)?0:1),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:{this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;let e=this.options[this.cursor]?.group===!0;!N(this,P)&&e&&(this.cursor=this.cursor===0?this.options.length-1:this.cursor-1);break}case`down`:case`right`:{this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;let e=this.options[this.cursor]?.group===!0;!N(this,P)&&e&&(this.cursor=this.cursor===this.options.length-1?0:this.cursor+1);break}case`space`:this.toggleValue();break}})}getGroupItems(e){return this.options.filter(t=>t.group===e)}isGroupSelected(e){return this.getGroupItems(e).every(e=>this.value.includes(e.value))}toggleValue(){let e=this.options[this.cursor];if(e.group===!0){let t=e.value,n=this.getGroupItems(t);this.isGroupSelected(t)?this.value=this.value.filter(e=>n.findIndex(t=>t.value===e)===-1):this.value=[...this.value,...n.map(e=>e.value)],this.value=Array.from(new Set(this.value))}else this.value=this.value.includes(e.value)?this.value.filter(t=>t!==e.value):[...this.value,e.value]}};P=new WeakMap;var De=Object.defineProperty,Oe=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t,n)=>(Oe(e,typeof t==`symbol`?t:t+``,n),n);let ke=class extends A{constructor(e){super(e,!1),F(this,`options`),F(this,`cursor`,0),this.options=e.options,this.value=[...e.initialValues??[]],this.cursor=Math.max(this.options.findIndex(({value:t})=>t===e.cursorAt),0),this.on(`key`,e=>{e===`a`&&this.toggleAll()}),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case`down`:case`right`:this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break;case`space`:this.toggleValue();break}})}get _value(){return this.options[this.cursor].value}toggleAll(){this.value=this.value.length===this.options.length?[]:this.options.map(e=>e.value)}toggleValue(){this.value=this.value.includes(this._value)?this.value.filter(e=>e!==this._value):[...this.value,this._value]}};var Ae=Object.defineProperty,je=(e,t,n)=>t in e?Ae(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t,n)=>(je(e,typeof t==`symbol`?t:t+``,n),n),Me=class extends A{constructor({mask:e,...t}){super(t),I(this,`valueWithCursor`,``),I(this,`_mask`,`•`),this._mask=e??`•`,this.on(`finalize`,()=>{this.valueWithCursor=this.masked}),this.on(`value`,()=>{if(this.cursor>=this.value.length)this.valueWithCursor=`${this.masked}${f.default.inverse(f.default.hidden(`_`))}`;else{let e=this.masked.slice(0,this.cursor),t=this.masked.slice(this.cursor);this.valueWithCursor=`${e}${f.default.inverse(t[0])}${t.slice(1)}`}})}get cursor(){return this._cursor}get masked(){return this.value.replaceAll(/./g,this._mask)}},Ne=Object.defineProperty,Pe=(e,t,n)=>t in e?Ne(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,L=(e,t,n)=>(Pe(e,typeof t==`symbol`?t:t+``,n),n),Fe=class extends A{constructor(e){super(e,!1),L(this,`options`),L(this,`cursor`,0),this.options=e.options,this.cursor=this.options.findIndex(({value:t})=>t===e.initialValue),this.cursor===-1&&(this.cursor=0),this.changeValue(),this.on(`cursor`,e=>{switch(e){case`left`:case`up`:this.cursor=this.cursor===0?this.options.length-1:this.cursor-1;break;case`down`:case`right`:this.cursor=this.cursor===this.options.length-1?0:this.cursor+1;break}this.changeValue()})}get _value(){return this.options[this.cursor]}changeValue(){this.value=this._value.value}},Ie=Object.defineProperty,Le=(e,t,n)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t,n)=>(Le(e,typeof t==`symbol`?t:t+``,n),n),Re=class extends A{constructor(e){super(e,!1),R(this,`options`),R(this,`cursor`,0),this.options=e.options;let t=this.options.map(({value:[e]})=>e?.toLowerCase());this.cursor=Math.max(t.indexOf(e.initialValue),0),this.on(`key`,e=>{if(!t.includes(e))return;let n=this.options.find(({value:[t]})=>t?.toLowerCase()===e);n&&(this.value=n.value,this.state=`submit`,this.emit(`submit`))})}},ze=class extends A{get valueWithCursor(){if(this.state===`submit`)return this.value;if(this.cursor>=this.value.length)return`${this.value}\u2588`;let e=this.value.slice(0,this.cursor),[t,...n]=this.value.slice(this.cursor);return`${e}${f.default.inverse(t)}${n.join(``)}`}get cursor(){return this._cursor}constructor(e){super(e),this.on(`finalize`,()=>{this.value||=e.defaultValue})}},z=e(n(),1),B=u();function Be(){return r.platform===`win32`?!!r.env.CI||!!r.env.WT_SESSION||!!r.env.TERMINUS_SUBLIME||r.env.ConEmuTask===`{cmd::Cmder}`||r.env.TERM_PROGRAM===`Terminus-Sublime`||r.env.TERM_PROGRAM===`vscode`||r.env.TERM===`xterm-256color`||r.env.TERM===`alacritty`||r.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:r.env.TERM!==`linux`}const V=Be(),H=(e,t)=>V?e:t,Ve=H(`◆`,`*`),He=H(`■`,`x`),Ue=H(`▲`,`x`),U=H(`◇`,`o`),We=H(`┌`,`T`),W=H(`│`,`|`),G=H(`└`,`—`),K=H(`●`,`>`),q=H(`○`,` `),J=H(`◻`,`[•]`),Y=H(`◼`,`[+]`),Ge=H(`◻`,`[ ]`),Ke=H(`▪`,`•`),qe=H(`─`,`-`),Je=H(`╮`,`+`),Ye=H(`├`,`+`),Xe=H(`╯`,`+`),Ze=H(`●`,`•`),Qe=H(`◆`,`*`),$e=H(`▲`,`!`),et=H(`■`,`x`),X=e=>{switch(e){case`initial`:case`active`:return z.default.cyan(Ve);case`cancel`:return z.default.red(He);case`error`:return z.default.yellow(Ue);case`submit`:return z.default.green(U)}},Z=e=>{let{cursor:t,options:n,style:r}=e,i=e.maxItems??1/0,a=Math.max(process.stdout.rows-4,0),o=Math.min(a,Math.max(i,5)),s=0;t>=s+o-3?s=Math.max(Math.min(t-o+3,n.length-o),0):t<s+2&&(s=Math.max(t-2,0));let c=o<n.length&&s>0,l=o<n.length&&s+o<n.length;return n.slice(s,s+o).map((e,n,i)=>{let a=n===0&&c,o=n===i.length-1&&l;return a||o?z.default.dim(`...`):r(e,n+s===t)})},tt=e=>new ze({validate:e.validate,placeholder:e.placeholder,defaultValue:e.defaultValue,initialValue:e.initialValue,render(){let t=`${z.default.gray(W)}
15
+ ${X(this.state)} ${e.message}
16
+ `,n=e.placeholder?z.default.inverse(e.placeholder[0])+z.default.dim(e.placeholder.slice(1)):z.default.inverse(z.default.hidden(`_`)),r=this.value?this.valueWithCursor:n;switch(this.state){case`error`:return`${t.trim()}
17
+ ${z.default.yellow(W)} ${r}
18
+ ${z.default.yellow(G)} ${z.default.yellow(this.error)}
19
+ `;case`submit`:return`${t}${z.default.gray(W)} ${z.default.dim(this.value||e.placeholder)}`;case`cancel`:return`${t}${z.default.gray(W)} ${z.default.strikethrough(z.default.dim(this.value??``))}${this.value?.trim()?`
20
+ ${z.default.gray(W)}`:``}`;default:return`${t}${z.default.cyan(W)} ${r}
21
+ ${z.default.cyan(G)}
22
+ `}}}).prompt(),nt=e=>new Me({validate:e.validate,mask:e.mask??Ke,render(){let t=`${z.default.gray(W)}
23
+ ${X(this.state)} ${e.message}
24
+ `,n=this.valueWithCursor,r=this.masked;switch(this.state){case`error`:return`${t.trim()}
25
+ ${z.default.yellow(W)} ${r}
26
+ ${z.default.yellow(G)} ${z.default.yellow(this.error)}
27
+ `;case`submit`:return`${t}${z.default.gray(W)} ${z.default.dim(r)}`;case`cancel`:return`${t}${z.default.gray(W)} ${z.default.strikethrough(z.default.dim(r??``))}${r?`
28
+ ${z.default.gray(W)}`:``}`;default:return`${t}${z.default.cyan(W)} ${n}
29
+ ${z.default.cyan(G)}
30
+ `}}}).prompt(),rt=e=>{let t=e.active??`Yes`,n=e.inactive??`No`;return new xe({active:t,inactive:n,initialValue:e.initialValue??!0,render(){let r=`${z.default.gray(W)}
31
+ ${X(this.state)} ${e.message}
32
+ `,i=this.value?t:n;switch(this.state){case`submit`:return`${r}${z.default.gray(W)} ${z.default.dim(i)}`;case`cancel`:return`${r}${z.default.gray(W)} ${z.default.strikethrough(z.default.dim(i))}
33
+ ${z.default.gray(W)}`;default:return`${r}${z.default.cyan(W)} ${this.value?`${z.default.green(K)} ${t}`:`${z.default.dim(q)} ${z.default.dim(t)}`} ${z.default.dim(`/`)} ${this.value?`${z.default.dim(q)} ${z.default.dim(n)}`:`${z.default.green(K)} ${n}`}
34
+ ${z.default.cyan(G)}
35
+ `}}}).prompt()},it=e=>{let t=(e,t)=>{let n=e.label??String(e.value);switch(t){case`selected`:return`${z.default.dim(n)}`;case`active`:return`${z.default.green(K)} ${n} ${e.hint?z.default.dim(`(${e.hint})`):``}`;case`cancelled`:return`${z.default.strikethrough(z.default.dim(n))}`;default:return`${z.default.dim(q)} ${z.default.dim(n)}`}};return new Fe({options:e.options,initialValue:e.initialValue,render(){let n=`${z.default.gray(W)}
36
+ ${X(this.state)} ${e.message}
37
+ `;switch(this.state){case`submit`:return`${n}${z.default.gray(W)} ${t(this.options[this.cursor],`selected`)}`;case`cancel`:return`${n}${z.default.gray(W)} ${t(this.options[this.cursor],`cancelled`)}
38
+ ${z.default.gray(W)}`;default:return`${n}${z.default.cyan(W)} ${Z({cursor:this.cursor,options:this.options,maxItems:e.maxItems,style:(e,n)=>t(e,n?`active`:`inactive`)}).join(`
39
+ ${z.default.cyan(W)} `)}
40
+ ${z.default.cyan(G)}
41
+ `}}}).prompt()},at=e=>{let t=(e,t=`inactive`)=>{let n=e.label??String(e.value);return t===`selected`?`${z.default.dim(n)}`:t===`cancelled`?`${z.default.strikethrough(z.default.dim(n))}`:t===`active`?`${z.default.bgCyan(z.default.gray(` ${e.value} `))} ${n} ${e.hint?z.default.dim(`(${e.hint})`):``}`:`${z.default.gray(z.default.bgWhite(z.default.inverse(` ${e.value} `)))} ${n} ${e.hint?z.default.dim(`(${e.hint})`):``}`};return new Re({options:e.options,initialValue:e.initialValue,render(){let n=`${z.default.gray(W)}
42
+ ${X(this.state)} ${e.message}
43
+ `;switch(this.state){case`submit`:return`${n}${z.default.gray(W)} ${t(this.options.find(e=>e.value===this.value)??e.options[0],`selected`)}`;case`cancel`:return`${n}${z.default.gray(W)} ${t(this.options[0],`cancelled`)}
44
+ ${z.default.gray(W)}`;default:return`${n}${z.default.cyan(W)} ${this.options.map((e,n)=>t(e,n===this.cursor?`active`:`inactive`)).join(`
45
+ ${z.default.cyan(W)} `)}
46
+ ${z.default.cyan(G)}
47
+ `}}}).prompt()},ot=e=>{let t=(e,t)=>{let n=e.label??String(e.value);return t===`active`?`${z.default.cyan(J)} ${n} ${e.hint?z.default.dim(`(${e.hint})`):``}`:t===`selected`?`${z.default.green(Y)} ${z.default.dim(n)} ${e.hint?z.default.dim(`(${e.hint})`):``}`:t===`cancelled`?`${z.default.strikethrough(z.default.dim(n))}`:t===`active-selected`?`${z.default.green(Y)} ${n} ${e.hint?z.default.dim(`(${e.hint})`):``}`:t===`submitted`?`${z.default.dim(n)}`:`${z.default.dim(Ge)} ${z.default.dim(n)}`};return new ke({options:e.options,initialValues:e.initialValues,required:e.required??!0,cursorAt:e.cursorAt,validate(e){if(this.required&&e.length===0)return`Please select at least one option.
48
+ ${z.default.reset(z.default.dim(`Press ${z.default.gray(z.default.bgWhite(z.default.inverse(` space `)))} to select, ${z.default.gray(z.default.bgWhite(z.default.inverse(` enter `)))} to submit`))}`},render(){let n=`${z.default.gray(W)}
49
+ ${X(this.state)} ${e.message}
50
+ `,r=(e,n)=>{let r=this.value.includes(e.value);return n&&r?t(e,`active-selected`):r?t(e,`selected`):t(e,n?`active`:`inactive`)};switch(this.state){case`submit`:return`${n}${z.default.gray(W)} ${this.options.filter(({value:e})=>this.value.includes(e)).map(e=>t(e,`submitted`)).join(z.default.dim(`, `))||z.default.dim(`none`)}`;case`cancel`:{let e=this.options.filter(({value:e})=>this.value.includes(e)).map(e=>t(e,`cancelled`)).join(z.default.dim(`, `));return`${n}${z.default.gray(W)} ${e.trim()?`${e}
51
+ ${z.default.gray(W)}`:``}`}case`error`:{let t=this.error.split(`
52
+ `).map((e,t)=>t===0?`${z.default.yellow(G)} ${z.default.yellow(e)}`:` ${e}`).join(`
53
+ `);return`${n+z.default.yellow(W)} ${Z({options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:r}).join(`
54
+ ${z.default.yellow(W)} `)}
55
+ ${t}
56
+ `}default:return`${n}${z.default.cyan(W)} ${Z({options:this.options,cursor:this.cursor,maxItems:e.maxItems,style:r}).join(`
57
+ ${z.default.cyan(W)} `)}
58
+ ${z.default.cyan(G)}
59
+ `}}}).prompt()},st=e=>{let{selectableGroups:t=!0}=e,n=(e,n,r=[])=>{let i=e.label??String(e.value),a=typeof e.group==`string`,o=a&&(r[r.indexOf(e)+1]??{group:!0}),s=a&&o.group===!0,c=a?t?`${s?G:W} `:` `:``;if(n===`active`)return`${z.default.dim(c)}${z.default.cyan(J)} ${i} ${e.hint?z.default.dim(`(${e.hint})`):``}`;if(n===`group-active`)return`${c}${z.default.cyan(J)} ${z.default.dim(i)}`;if(n===`group-active-selected`)return`${c}${z.default.green(Y)} ${z.default.dim(i)}`;if(n===`selected`){let n=a||t?z.default.green(Y):``;return`${z.default.dim(c)}${n} ${z.default.dim(i)} ${e.hint?z.default.dim(`(${e.hint})`):``}`}if(n===`cancelled`)return`${z.default.strikethrough(z.default.dim(i))}`;if(n===`active-selected`)return`${z.default.dim(c)}${z.default.green(Y)} ${i} ${e.hint?z.default.dim(`(${e.hint})`):``}`;if(n===`submitted`)return`${z.default.dim(i)}`;let l=a||t?z.default.dim(Ge):``;return`${z.default.dim(c)}${l} ${z.default.dim(i)}`};return new Ee({options:e.options,initialValues:e.initialValues,required:e.required??!0,cursorAt:e.cursorAt,selectableGroups:t,validate(e){if(this.required&&e.length===0)return`Please select at least one option.
60
+ ${z.default.reset(z.default.dim(`Press ${z.default.gray(z.default.bgWhite(z.default.inverse(` space `)))} to select, ${z.default.gray(z.default.bgWhite(z.default.inverse(` enter `)))} to submit`))}`},render(){let t=`${z.default.gray(W)}
61
+ ${X(this.state)} ${e.message}
62
+ `;switch(this.state){case`submit`:return`${t}${z.default.gray(W)} ${this.options.filter(({value:e})=>this.value.includes(e)).map(e=>n(e,`submitted`)).join(z.default.dim(`, `))}`;case`cancel`:{let e=this.options.filter(({value:e})=>this.value.includes(e)).map(e=>n(e,`cancelled`)).join(z.default.dim(`, `));return`${t}${z.default.gray(W)} ${e.trim()?`${e}
63
+ ${z.default.gray(W)}`:``}`}case`error`:{let e=this.error.split(`
64
+ `).map((e,t)=>t===0?`${z.default.yellow(G)} ${z.default.yellow(e)}`:` ${e}`).join(`
65
+ `);return`${t}${z.default.yellow(W)} ${this.options.map((e,t,r)=>{let i=this.value.includes(e.value)||e.group===!0&&this.isGroupSelected(`${e.value}`),a=t===this.cursor;return!a&&typeof e.group==`string`&&this.options[this.cursor].value===e.group?n(e,i?`group-active-selected`:`group-active`,r):a&&i?n(e,`active-selected`,r):i?n(e,`selected`,r):n(e,a?`active`:`inactive`,r)}).join(`
66
+ ${z.default.yellow(W)} `)}
67
+ ${e}
68
+ `}default:return`${t}${z.default.cyan(W)} ${this.options.map((e,t,r)=>{let i=this.value.includes(e.value)||e.group===!0&&this.isGroupSelected(`${e.value}`),a=t===this.cursor;return!a&&typeof e.group==`string`&&this.options[this.cursor].value===e.group?n(e,i?`group-active-selected`:`group-active`,r):a&&i?n(e,`active-selected`,r):i?n(e,`selected`,r):n(e,a?`active`:`inactive`,r)}).join(`
69
+ ${z.default.cyan(W)} `)}
70
+ ${z.default.cyan(G)}
71
+ `}}}).prompt()},ct=(e=``,t=``)=>{let n=`
72
+ ${e}
73
+ `.split(`
74
+ `),r=o(t).length,i=Math.max(n.reduce((e,t)=>{let n=o(t);return n.length>e?n.length:e},0),r)+2,a=n.map(e=>`${z.default.gray(W)} ${z.default.dim(e)}${` `.repeat(i-o(e).length)}${z.default.gray(W)}`).join(`
75
+ `);process.stdout.write(`${z.default.gray(W)}
76
+ ${z.default.green(U)} ${z.default.reset(t)} ${z.default.gray(qe.repeat(Math.max(i-r-1,1))+Je)}
77
+ ${a}
78
+ ${z.default.gray(Ye+qe.repeat(i+2)+Xe)}
79
+ `)},lt=(e=``)=>{process.stdout.write(`${z.default.gray(G)} ${z.default.red(e)}
80
+
81
+ `)},ut=(e=``)=>{process.stdout.write(`${z.default.gray(We)} ${e}
82
+ `)},dt=(e=``)=>{process.stdout.write(`${z.default.gray(W)}
83
+ ${z.default.gray(G)} ${e}
84
+
85
+ `)},Q={message:(e=``,{symbol:t=z.default.gray(W)}={})=>{let n=[`${z.default.gray(W)}`];if(e){let[r,...i]=e.split(`
86
+ `);n.push(`${t} ${r}`,...i.map(e=>`${z.default.gray(W)} ${e}`))}process.stdout.write(`${n.join(`
87
+ `)}
88
+ `)},info:e=>{Q.message(e,{symbol:z.default.blue(Ze)})},success:e=>{Q.message(e,{symbol:z.default.green(Qe)})},step:e=>{Q.message(e,{symbol:z.default.green(U)})},warn:e=>{Q.message(e,{symbol:z.default.yellow($e)})},warning:e=>{Q.warn(e)},error:e=>{Q.message(e,{symbol:z.default.red(et)})}},ft=`${z.default.gray(W)} `,$={message:async(e,{symbol:t=z.default.gray(W)}={})=>{process.stdout.write(`${z.default.gray(W)}
89
+ ${t} `);let n=3;for await(let t of e){t=t.replace(/\n/g,`
90
+ ${ft}`),t.includes(`
91
+ `)&&(n=3+o(t.slice(t.lastIndexOf(`
92
+ `))).length);let e=o(t).length;n+e<process.stdout.columns?(n+=e,process.stdout.write(t)):(process.stdout.write(`
93
+ ${ft}${t.trimStart()}`),n=3+o(t.trimStart()).length)}process.stdout.write(`
94
+ `)},info:e=>$.message(e,{symbol:z.default.blue(Ze)}),success:e=>$.message(e,{symbol:z.default.green(Qe)}),step:e=>$.message(e,{symbol:z.default.green(U)}),warn:e=>$.message(e,{symbol:z.default.yellow($e)}),warning:e=>$.warn(e),error:e=>$.message(e,{symbol:z.default.red(et)})},pt=({indicator:e=`dots`}={})=>{let t=V?[`◒`,`◐`,`◓`,`◑`]:[`•`,`o`,`O`,`0`],n=V?80:120,r=process.env.CI===`true`,i,a,o=!1,s=``,c,l=performance.now(),u=e=>{o&&v(e>1?`Something went wrong`:`Canceled`,e)},d=()=>u(2),f=()=>u(1),ee=()=>{process.on(`uncaughtExceptionMonitor`,d),process.on(`unhandledRejection`,d),process.on(`SIGINT`,f),process.on(`SIGTERM`,f),process.on(`exit`,u)},p=()=>{process.removeListener(`uncaughtExceptionMonitor`,d),process.removeListener(`unhandledRejection`,d),process.removeListener(`SIGINT`,f),process.removeListener(`SIGTERM`,f),process.removeListener(`exit`,u)},m=()=>{if(c===void 0)return;r&&process.stdout.write(`
95
+ `);let e=c.split(`
96
+ `);process.stdout.write(B.cursor.move(-999,e.length-1)),process.stdout.write(B.erase.down(e.length))},h=e=>e.replace(/\.+$/,``),g=e=>{let t=(performance.now()-e)/1e3,n=Math.floor(t/60),r=Math.floor(t%60);return n>0?`[${n}m ${r}s]`:`[${r}s]`},_=(u=``)=>{o=!0,i=ve(),s=h(u),l=performance.now(),process.stdout.write(`${z.default.gray(W)}
97
+ `);let d=0,f=0;ee(),a=setInterval(()=>{if(r&&s===c)return;m(),c=s;let n=z.default.magenta(t[d]);if(r)process.stdout.write(`${n} ${s}...`);else if(e===`timer`)process.stdout.write(`${n} ${s} ${g(l)}`);else{let e=`.`.repeat(Math.floor(f)).slice(0,3);process.stdout.write(`${n} ${s}${e}`)}d=d+1<t.length?d+1:0,f=f<t.length?f+.125:0},n)},v=(t=``,n=0)=>{o=!1,clearInterval(a),m();let r=n===0?z.default.green(U):n===1?z.default.red(He):z.default.red(Ue);s=h(t??s),e===`timer`?process.stdout.write(`${r} ${s} ${g(l)}
98
+ `):process.stdout.write(`${r} ${s}
99
+ `),p(),i()};return{start:_,stop:v,message:(e=``)=>{s=h(e??s)}}},mt=async(e,t)=>{let n={},r=Object.keys(e);for(let i of r){let r=e[i],a=await r({results:n})?.catch(e=>{throw e});if(typeof t?.onCancel==`function`&&_e(a)){n[i]=`canceled`,t.onCancel({results:n});continue}n[i]=a}return n},ht=async e=>{for(let t of e){if(t.enabled===!1)continue;let e=pt();e.start(t.title);let n=await t.task(e.message);e.stop(n||t.title)}};export{lt as cancel,rt as confirm,mt as group,st as groupMultiselect,ut as intro,_e as isCancel,Q as log,ot as multiselect,ct as note,dt as outro,nt as password,it as select,at as selectKey,pt as spinner,$ as stream,ht as tasks,tt as text,me as updateSettings};
@@ -0,0 +1,6 @@
1
+ import e from"node:process";import t from"node:os";import n from"node:path";import r from"remark-frontmatter";import i from"remark-gfm";import a from"remark-parse";import o from"remark-stringify";import{unified as s}from"unified";import{parse as c,stringify as l}from"yaml";const u=e.platform===`win32`?t.homedir().replace(/\\/g,`/`):t.homedir(),d=n.join(u,`project`);var f=class e{config;constructor(e){this.config=e}root(){return this.config.root}dist(){return n.join(this.config.root,`dist`)}ref(){return n.join(this.config.root,`ref`)}claude(){return new p(this.config.root)}factory(){return new m(this.config.root)}kiro(){return new h(this.config.root)}qoder(){return new g(this.config.root)}codebuddy(){return new _(this.config.root)}agent(){return new v(this.config.root)}resolve(...e){return n.join(this.config.root,...e)}static forProject(t){return new e({root:n.join(d,t)})}static fromPath(t){return new e({root:t})}},p=class{baseDir;constructor(e){this.baseDir=n.join(e,`.claude`)}root(){return this.baseDir}skills(){return n.join(this.baseDir,`skills`)}commands(){return n.join(this.baseDir,`commands`)}agents(){return n.join(this.baseDir,`agents`)}},m=class{baseDir;constructor(e){this.baseDir=n.join(e,`.factory`)}root(){return this.baseDir}skills(){return n.join(this.baseDir,`skills`)}commands(){return n.join(this.baseDir,`commands`)}},h=class{baseDir;constructor(e){this.baseDir=n.join(e,`.kiro`)}root(){return this.baseDir}steering(){return n.join(this.baseDir,`steering`)}static globalSteering(){return n.join(u,`.kiro`,`steering`)}},g=class{baseDir;constructor(e){this.baseDir=n.join(e,`.qoder`)}root(){return this.baseDir}rules(){return n.join(this.baseDir,`rules`)}},_=class{baseDir;constructor(e){this.baseDir=n.join(e,`.codebuddy`)}root(){return this.baseDir}rules(){return n.join(this.baseDir,`.rules`)}},v=class{baseDir;constructor(e){this.baseDir=n.join(e,`.agent`)}root(){return this.baseDir}rules(){return n.join(this.baseDir,`rules`)}};function y(e){return e.type===`yaml`}function b(e){try{return c(e)}catch{return null}}function x(e){let t=s().use(a).use(r,[`yaml`]).use(i).parse(e).children,n=null,o=null,c=[];for(let e of t)y(e)?(o=e.value,n=b(e.value)):c.push(e);return{frontmatter:n,rawFrontmatter:o,ast:{type:`root`,children:c},content:c}}function S(e){let t=s().use(o).use(r,[`yaml`]).use(i);return String(t.stringify(e))}function C(e,t=[]){let n=[];if(e!=null){let t=l(e).trim();n.push(`---\n${t}\n---\n`)}if(typeof t==`string`)n.push(t);else if(t.length>0){let e={type:`root`,children:t};n.push(S(e))}return n.join(`
2
+ `)}function w(e){return`---
3
+ ${l(e).trim()}
4
+ ---
5
+
6
+ `}function T(e){let t=/^---\r?\n([\s\S]*?)\r?\n---/.exec(e);return t?.[1]==null?null:b(t[1])}function E(e){return e.replace(/^---\r?\n[\s\S]*?\r?\n---\r?\n*/,``)}let D=function(e){return e.MEMORY_PROMPT=`memoryPrompt`,e.GLOBAL_PROMPT=`globalPrompt`,e.SUB_AGENT=`subAgentAgenticConfig`,e.FAST_COMMAND=`fastCommandAgenticConfig`,e.SKILL=`skillAgenticConfig`,e.CONFIG_FILE=`configFile`,e}({}),O=function(e){return e.KIRO_ALWAYS=`kiro-always`,e.KIRO_FILE_MATCH=`kiro-file-match`,e.QODER_ALWAYS=`qoder-always`,e.QODER_GLOB=`qoder-glob`,e.ANTIGRAVITY_ALWAYS=`antigravity-always`,e.ANTIGRAVITY_GLOB=`antigravity-glob`,e.WORKFLOW_AUTO=`workflow-auto`,e}({});var k=class extends Error{pluginName;hookName;cause;constructor(e,t,n,r){super(e),this.name=`PluginError`,this.pluginName=t,this.hookName=n,this.cause=r}},A=class extends Error{field;constructor(e,t){super(e),this.name=`ValidationError`,this.field=t}};function j(e){return e.charCodeAt(0)===65279?e.slice(1):e}function M(e){let t=j(e),n=T(t),r=E(t);return{frontMatter:n??{},body:r}}function N(e,t){return Object.keys(e).length===0?t:C(e,t)}function P(e,t){return{...t,...e}}function F(e,t){let n={},r=t?.filePattern;switch(e){case O.KIRO_ALWAYS:n.inclusion=`always`;break;case O.KIRO_FILE_MATCH:if(typeof r!=`string`||r===``)throw Error(`Pattern is required for KIRO_FILE_MATCH type`);n.inclusion=`fileMatch`,n.fileMatchPattern=r;break;case O.QODER_ALWAYS:n.trigger=`always_on`,n.alwaysApply=!0;break;case O.QODER_GLOB:if(typeof r!=`string`||r===``)throw Error(`Pattern is required for QODER_GLOB type`);n.trigger=`glob`,n.glob=r;break;case O.ANTIGRAVITY_ALWAYS:n.trigger=`always_on`;break;case O.ANTIGRAVITY_GLOB:if(typeof r!=`string`||r===``)throw Error(`Pattern is required for ANTIGRAVITY_GLOB type`);n.trigger=`glob`,n.globs=r;break;case O.WORKFLOW_AUTO:n.auto_execution_mode=`automatic`;break;default:throw Error(`Unknown front matter type: ${String(e)}`)}return t?.additionalProps?{...n,...t.additionalProps}:n}function I(e,t){return t+j(e)}function L(e,t,n,r){let i={type:t};return n!=null&&(i.filePattern=n),r!=null&&(i.additionalProps=r),I(e,w(F(t,i)))}function R(){return{parse:M,serialize:N,merge:P,generateByType:F}}function z(){return{parse:e=>{let t=j(e),n=x(t);return{frontmatter:n.frontmatter,rawFrontmatter:n.rawFrontmatter,ast:n.ast,content:n.content,raw:t}},stringify:e=>S(e),build:(e,t)=>C(e,t),transformFrontmatter:(e,t,n)=>P(e,F(t,n)),stripFrontmatter:e=>E(j(e)),extractFrontmatter:e=>T(j(e))}}export{M as a,D as c,f as d,d as f,F as i,k as l,R as n,N as o,z as r,O as s,L as t,A as u};
package/dist/index.mjs ADDED
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env node
2
+ import{n as e,r as t,t as n}from"./chunk-YV1pC1vC.mjs";import{a as r,c as i,d as a,l as o,n as s,o as c,r as l,u}from"./frontMatter-Xmvgjkyh.mjs";import{t as d}from"./logger-CST5WaQ3.mjs";import f from"node:process";import p from"node:os";import m from"node:path";import h from"picomatch";import g from"fs-extra";const _={parallel:!1,onError:`continue`,logLevel:`info`,excludePatterns:[],dryRun:!1,cleanOnly:!1};function v(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function y(e,t){let n={...e};for(let r of Object.keys(t)){let i=t[r],a=e[r];i!=null&&(v(i)&&v(a)?n[r]=y(a,i):n[r]=i)}return n}function b(e={},t={}){let n={..._};return Object.keys(t).length>0&&(n=y(n,t)),e.options&&Object.keys(e.options).length>0&&(n=y(n,e.options)),e.dryRun!==null&&e.dryRun!==void 0&&(n.dryRun=e.dryRun),e.cleanOnly!==null&&e.cleanOnly!==void 0&&(n.cleanOnly=e.cleanOnly),e.workspaceGroups!==null&&e.workspaceGroups!==void 0&&(n.workspaceGroups=e.workspaceGroups),e.root!==null&&e.root!==void 0&&(n.root=e.root),n}function x(e={},t){return b(e,t?.options??{})}const S=f.platform===`win32`?p.homedir().replace(/\\/g,`/`):p.homedir(),C={USER_HOME:S,HOME:S};function w(e){let t=e;for(let[e,n]of Object.entries(C))t=t.replace(RegExp(`\\$\\{${e}\\}`,`g`),n),t=t.replace(RegExp(`\\$${e}`,`g`),n);return t.replace(/\\/g,`/`)}var T=class{fs;targets;log;constructor(e,t,n){this.fs=e,this.targets=t,this.log=n}collectTargets(e){let t=[];for(let n of e){let e=n.outputs;if(!(e==null||e.length===0))for(let r of e){if(r.enabled===!1)continue;let e=r.path.endsWith(`/`)||!r.path.includes(`.`);t.push({pluginName:n.name,path:r.path,type:e?`directory`:`file`,targetType:r.targetType})}}return this.log.debug(`Collected ${t.length} cleanup targets from ${e.length} plugins`),t}resolvePath(e){let t=w(e.path);switch(e.targetType){case`workspaceGroup`:return this.targets.workspaceGroup(t);case`workspace`:return this.targets.workspaceGroup(t);case`globalConfig`:{let e=t.match(/^~?\.?([^/]+)/)?.[1]??t;return this.targets.globalConfig(e)}default:return t}}async clean(e,t){let n=Date.now(),r=[],i=0,a=0,o={};for(let n of e){let e=this.resolvePath(n);o[n.pluginName]??(o[n.pluginName]=[]),o[n.pluginName]?.push(e);try{if(!await this.fs.exists(e)){this.log.debug(`Skipping non-existent path: ${e}`);continue}if(t){this.log.info(`[dry-run] Would remove: ${e}`),n.type===`directory`?a++:i++;continue}await this.fs.remove(e),n.type===`directory`?(a++,this.log.info(`Removed directory: ${e}`)):(i++,this.log.info(`Removed file: ${e}`))}catch(t){let i=t instanceof Error?t.message:String(t);r.push(`[${n.pluginName}] Failed to remove ${e}: ${i}`),this.log.error(`Failed to remove ${e}: ${i}`)}}let s=Date.now()-n;for(let[e,t]of Object.entries(o))this.log.info(`Plugin "${e}": ${t.length} targets processed`);return{success:r.length===0,filesRemoved:i,directoriesRemoved:a,targetsByPlugin:o,errors:r,duration:s}}},E=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.splitWhen=e.flatten=void 0;function t(e){return e.reduce((e,t)=>[].concat(e,t),[])}e.flatten=t;function n(e,t){let n=[[]],r=0;for(let i of e)t(i)?(r++,n[r]=[]):n[r].push(i);return n}e.splitWhen=n})),D=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isEnoentCodeError=void 0;function t(e){return e.code===`ENOENT`}e.isEnoentCodeError=t})),O=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDirentFromStats=void 0;var t=class{constructor(e,t){this.name=e,this.isBlockDevice=t.isBlockDevice.bind(t),this.isCharacterDevice=t.isCharacterDevice.bind(t),this.isDirectory=t.isDirectory.bind(t),this.isFIFO=t.isFIFO.bind(t),this.isFile=t.isFile.bind(t),this.isSocket=t.isSocket.bind(t),this.isSymbolicLink=t.isSymbolicLink.bind(t)}};function n(e,n){return new t(e,n)}e.createDirentFromStats=n})),k=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.convertPosixPathToPattern=t.convertWindowsPathToPattern=t.convertPathToPattern=t.escapePosixPath=t.escapeWindowsPath=t.escape=t.removeLeadingDotSegment=t.makeAbsolute=t.unixify=void 0;let n=e(`os`),r=e(`path`),i=n.platform()===`win32`,a=/(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g,o=/(\\?)([()[\]{}]|^!|[!+@](?=\())/g,s=/^\\\\([.?])/,c=/\\(?![!()+@[\]{}])/g;function l(e){return e.replace(/\\/g,`/`)}t.unixify=l;function u(e,t){return r.resolve(e,t)}t.makeAbsolute=u;function d(e){if(e.charAt(0)===`.`){let t=e.charAt(1);if(t===`/`||t===`\\`)return e.slice(2)}return e}t.removeLeadingDotSegment=d,t.escape=i?f:p;function f(e){return e.replace(o,`\\$2`)}t.escapeWindowsPath=f;function p(e){return e.replace(a,`\\$2`)}t.escapePosixPath=p,t.convertPathToPattern=i?m:h;function m(e){return f(e).replace(s,`//$1`).replace(c,`/`)}t.convertWindowsPathToPattern=m;function h(e){return p(e)}t.convertPosixPathToPattern=h})),A=n(((e,t)=>{
3
+ /*!
4
+ * is-extglob <https://github.com/jonschlinkert/is-extglob>
5
+ *
6
+ * Copyright (c) 2014-2016, Jon Schlinkert.
7
+ * Licensed under the MIT License.
8
+ */
9
+ t.exports=function(e){if(typeof e!=`string`||e===``)return!1;for(var t;t=/(\\).|([@?!+*]\(.*\))/g.exec(e);){if(t[2])return!0;e=e.slice(t.index+t[0].length)}return!1}})),j=n(((e,t)=>{
10
+ /*!
11
+ * is-glob <https://github.com/jonschlinkert/is-glob>
12
+ *
13
+ * Copyright (c) 2014-2017, Jon Schlinkert.
14
+ * Released under the MIT License.
15
+ */
16
+ var n=A(),r={"{":`}`,"(":`)`,"[":`]`},i=function(e){if(e[0]===`!`)return!0;for(var t=0,n=-2,i=-2,a=-2,o=-2,s=-2;t<e.length;){if(e[t]===`*`||e[t+1]===`?`&&/[\].+)]/.test(e[t])||i!==-1&&e[t]===`[`&&e[t+1]!==`]`&&(i<t&&(i=e.indexOf(`]`,t)),i>t&&(s===-1||s>i||(s=e.indexOf(`\\`,t),s===-1||s>i)))||a!==-1&&e[t]===`{`&&e[t+1]!==`}`&&(a=e.indexOf(`}`,t),a>t&&(s=e.indexOf(`\\`,t),s===-1||s>a))||o!==-1&&e[t]===`(`&&e[t+1]===`?`&&/[:!=]/.test(e[t+2])&&e[t+3]!==`)`&&(o=e.indexOf(`)`,t),o>t&&(s=e.indexOf(`\\`,t),s===-1||s>o))||n!==-1&&e[t]===`(`&&e[t+1]!==`|`&&(n<t&&(n=e.indexOf(`|`,t)),n!==-1&&e[n+1]!==`)`&&(o=e.indexOf(`)`,n),o>n&&(s=e.indexOf(`\\`,n),s===-1||s>o))))return!0;if(e[t]===`\\`){var c=e[t+1];t+=2;var l=r[c];if(l){var u=e.indexOf(l,t);u!==-1&&(t=u+1)}if(e[t]===`!`)return!0}else t++}return!1},a=function(e){if(e[0]===`!`)return!0;for(var t=0;t<e.length;){if(/[*?{}()[\]]/.test(e[t]))return!0;if(e[t]===`\\`){var n=e[t+1];t+=2;var i=r[n];if(i){var a=e.indexOf(i,t);a!==-1&&(t=a+1)}if(e[t]===`!`)return!0}else t++}return!1};t.exports=function(e,t){if(typeof e!=`string`||e===``)return!1;if(n(e))return!0;var r=i;return t&&t.strict===!1&&(r=a),r(e)}})),ee=n(((t,n)=>{var r=j(),i=e(`path`).posix.dirname,a=e(`os`).platform()===`win32`,o=`/`,s=/\\/g,c=/[\{\[].*[\}\]]$/,l=/(^|[^\\])([\{\[]|\([^\)]+$)/,u=/\\([\!\*\?\|\[\]\(\)\{\}])/g;n.exports=function(e,t){Object.assign({flipBackslashes:!0},t).flipBackslashes&&a&&e.indexOf(o)<0&&(e=e.replace(s,o)),c.test(e)&&(e+=o),e+=`a`;do e=i(e);while(r(e)||l.test(e));return e.replace(u,`$1`)}})),M=n((e=>{e.isInteger=e=>typeof e==`number`?Number.isInteger(e):typeof e==`string`&&e.trim()!==``?Number.isInteger(Number(e)):!1,e.find=(e,t)=>e.nodes.find(e=>e.type===t),e.exceedsLimit=(t,n,r=1,i)=>i===!1||!e.isInteger(t)||!e.isInteger(n)?!1:(Number(n)-Number(t))/Number(r)>=i,e.escapeNode=(e,t=0,n)=>{let r=e.nodes[t];r&&(n&&r.type===n||r.type===`open`||r.type===`close`)&&r.escaped!==!0&&(r.value=`\\`+r.value,r.escaped=!0)},e.encloseBrace=e=>e.type===`brace`?e.commas>>0+e.ranges>>0?!1:(e.invalid=!0,!0):!1,e.isInvalidBrace=e=>e.type===`brace`?e.invalid===!0||e.dollar?!0:!(e.commas>>0+e.ranges>>0)||e.open!==!0||e.close!==!0?(e.invalid=!0,!0):!1:!1,e.isOpenOrClose=e=>e.type===`open`||e.type===`close`?!0:e.open===!0||e.close===!0,e.reduce=e=>e.reduce((e,t)=>(t.type===`text`&&e.push(t.value),t.type===`range`&&(t.type=`text`),e),[]),e.flatten=(...e)=>{let t=[],n=e=>{for(let r=0;r<e.length;r++){let i=e[r];if(Array.isArray(i)){n(i);continue}i!==void 0&&t.push(i)}return t};return n(e),t}})),N=n(((e,t)=>{let n=M();t.exports=(e,t={})=>{let r=(e,i={})=>{let a=t.escapeInvalid&&n.isInvalidBrace(i),o=e.invalid===!0&&t.escapeInvalid===!0,s=``;if(e.value)return(a||o)&&n.isOpenOrClose(e)?`\\`+e.value:e.value;if(e.value)return e.value;if(e.nodes)for(let t of e.nodes)s+=r(t);return s};return r(e)}})),P=n(((e,t)=>{t.exports=function(e){return typeof e==`number`?e-e===0:typeof e==`string`&&e.trim()!==``?Number.isFinite?Number.isFinite(+e):isFinite(+e):!1}})),F=n(((e,t)=>{let n=P(),r=(e,t,a)=>{if(n(e)===!1)throw TypeError(`toRegexRange: expected the first argument to be a number`);if(t===void 0||e===t)return String(e);if(n(t)===!1)throw TypeError(`toRegexRange: expected the second argument to be a number.`);let o={relaxZeros:!0,...a};typeof o.strictZeros==`boolean`&&(o.relaxZeros=o.strictZeros===!1);let c=String(o.relaxZeros),l=String(o.shorthand),u=String(o.capture),d=String(o.wrap),f=e+`:`+t+`=`+c+l+u+d;if(r.cache.hasOwnProperty(f))return r.cache[f].result;let p=Math.min(e,t),m=Math.max(e,t);if(Math.abs(p-m)===1){let n=e+`|`+t;return o.capture?`(${n})`:o.wrap===!1?n:`(?:${n})`}let h=g(e)||g(t),_={min:e,max:t,a:p,b:m},v=[],y=[];return h&&(_.isPadded=h,_.maxLen=String(_.max).length),p<0&&(y=s(m<0?Math.abs(m):1,Math.abs(p),_,o),p=_.a=0),m>=0&&(v=s(p,m,_,o)),_.negatives=y,_.positives=v,_.result=i(y,v,o),o.capture===!0?_.result=`(${_.result})`:o.wrap!==!1&&v.length+y.length>1&&(_.result=`(?:${_.result})`),r.cache[f]=_,_.result};function i(e,t,n){let r=c(e,t,`-`,!1,n)||[],i=c(t,e,``,!1,n)||[],a=c(e,t,`-?`,!0,n)||[];return r.concat(a).concat(i).join(`|`)}function a(e,t){let n=1,r=1,i=f(e,n),a=new Set([t]);for(;e<=i&&i<=t;)a.add(i),n+=1,i=f(e,n);for(i=p(t+1,r)-1;e<i&&i<=t;)a.add(i),r+=1,i=p(t+1,r)-1;return a=[...a],a.sort(u),a}function o(e,t,n){if(e===t)return{pattern:e,count:[],digits:0};let r=l(e,t),i=r.length,a=``,o=0;for(let e=0;e<i;e++){let[t,i]=r[e];t===i?a+=t:t!==`0`||i!==`9`?a+=h(t,i,n):o++}return o&&(a+=n.shorthand===!0?`\\d`:`[0-9]`),{pattern:a,count:[o],digits:i}}function s(e,t,n,r){let i=a(e,t),s=[],c=e,l;for(let e=0;e<i.length;e++){let t=i[e],a=o(String(c),String(t),r),u=``;if(!n.isPadded&&l&&l.pattern===a.pattern){l.count.length>1&&l.count.pop(),l.count.push(a.count[0]),l.string=l.pattern+m(l.count),c=t+1;continue}n.isPadded&&(u=_(t,n,r)),a.string=u+a.pattern+m(a.count),s.push(a),c=t+1,l=a}return s}function c(e,t,n,r,i){let a=[];for(let i of e){let{string:e}=i;!r&&!d(t,`string`,e)&&a.push(n+e),r&&d(t,`string`,e)&&a.push(n+e)}return a}function l(e,t){let n=[];for(let r=0;r<e.length;r++)n.push([e[r],t[r]]);return n}function u(e,t){return e>t?1:t>e?-1:0}function d(e,t,n){return e.some(e=>e[t]===n)}function f(e,t){return Number(String(e).slice(0,-t)+`9`.repeat(t))}function p(e,t){return e-e%10**t}function m(e){let[t=0,n=``]=e;return n||t>1?`{${t+(n?`,`+n:``)}}`:``}function h(e,t,n){return`[${e}${t-e===1?``:`-`}${t}]`}function g(e){return/^-?(0+)\d/.test(e)}function _(e,t,n){if(!t.isPadded)return e;let r=Math.abs(t.maxLen-String(e).length),i=n.relaxZeros!==!1;switch(r){case 0:return``;case 1:return i?`0?`:`0`;case 2:return i?`0{0,2}`:`00`;default:return i?`0{0,${r}}`:`0{${r}}`}}r.cache={},r.clearCache=()=>r.cache={},t.exports=r})),I=n(((t,n)=>{let r=e(`util`),i=F(),a=e=>typeof e==`object`&&!!e&&!Array.isArray(e),o=e=>t=>e===!0?Number(t):String(t),s=e=>typeof e==`number`||typeof e==`string`&&e!==``,c=e=>Number.isInteger(+e),l=e=>{let t=`${e}`,n=-1;if(t[0]===`-`&&(t=t.slice(1)),t===`0`)return!1;for(;t[++n]===`0`;);return n>0},u=(e,t,n)=>typeof e==`string`||typeof t==`string`?!0:n.stringify===!0,d=(e,t,n)=>{if(t>0){let n=e[0]===`-`?`-`:``;n&&(e=e.slice(1)),e=n+e.padStart(n?t-1:t,`0`)}return n===!1?String(e):e},f=(e,t)=>{let n=e[0]===`-`?`-`:``;for(n&&(e=e.slice(1),t--);e.length<t;)e=`0`+e;return n?`-`+e:e},p=(e,t,n)=>{e.negatives.sort((e,t)=>e<t?-1:e>t?1:0),e.positives.sort((e,t)=>e<t?-1:e>t?1:0);let r=t.capture?``:`?:`,i=``,a=``,o;return e.positives.length&&(i=e.positives.map(e=>f(String(e),n)).join(`|`)),e.negatives.length&&(a=`-(${r}${e.negatives.map(e=>f(String(e),n)).join(`|`)})`),o=i&&a?`${i}|${a}`:i||a,t.wrap?`(${r}${o})`:o},m=(e,t,n,r)=>{if(n)return i(e,t,{wrap:!1,...r});let a=String.fromCharCode(e);return e===t?a:`[${a}-${String.fromCharCode(t)}]`},h=(e,t,n)=>{if(Array.isArray(e)){let t=n.wrap===!0,r=n.capture?``:`?:`;return t?`(${r}${e.join(`|`)})`:e.join(`|`)}return i(e,t,n)},g=(...e)=>RangeError(`Invalid range arguments: `+r.inspect(...e)),_=(e,t,n)=>{if(n.strictRanges===!0)throw g([e,t]);return[]},v=(e,t)=>{if(t.strictRanges===!0)throw TypeError(`Expected step "${e}" to be a number`);return[]},y=(e,t,n=1,r={})=>{let i=Number(e),a=Number(t);if(!Number.isInteger(i)||!Number.isInteger(a)){if(r.strictRanges===!0)throw g([e,t]);return[]}i===0&&(i=0),a===0&&(a=0);let s=i>a,c=String(e),_=String(t),v=String(n);n=Math.max(Math.abs(n),1);let y=l(c)||l(_)||l(v),b=y?Math.max(c.length,_.length,v.length):0,x=y===!1&&u(e,t,r)===!1,S=r.transform||o(x);if(r.toRegex&&n===1)return m(f(e,b),f(t,b),!0,r);let C={negatives:[],positives:[]},w=e=>C[e<0?`negatives`:`positives`].push(Math.abs(e)),T=[],E=0;for(;s?i>=a:i<=a;)r.toRegex===!0&&n>1?w(i):T.push(d(S(i,E),b,x)),i=s?i-n:i+n,E++;return r.toRegex===!0?n>1?p(C,r,b):h(T,null,{wrap:!1,...r}):T},b=(e,t,n=1,r={})=>{if(!c(e)&&e.length>1||!c(t)&&t.length>1)return _(e,t,r);let i=r.transform||(e=>String.fromCharCode(e)),a=`${e}`.charCodeAt(0),o=`${t}`.charCodeAt(0),s=a>o,l=Math.min(a,o),u=Math.max(a,o);if(r.toRegex&&n===1)return m(l,u,!1,r);let d=[],f=0;for(;s?a>=o:a<=o;)d.push(i(a,f)),a=s?a-n:a+n,f++;return r.toRegex===!0?h(d,null,{wrap:!1,options:r}):d},x=(e,t,n,r={})=>{if(t==null&&s(e))return[e];if(!s(e)||!s(t))return _(e,t,r);if(typeof n==`function`)return x(e,t,1,{transform:n});if(a(n))return x(e,t,0,n);let i={...r};return i.capture===!0&&(i.wrap=!0),n=n||i.step||1,c(n)?c(e)&&c(t)?y(e,t,n,i):b(e,t,Math.max(Math.abs(n),1),i):n!=null&&!a(n)?v(n,i):x(e,t,1,n)};n.exports=x})),te=n(((e,t)=>{let n=I(),r=M();t.exports=(e,t={})=>{let i=(e,a={})=>{let o=r.isInvalidBrace(a),s=e.invalid===!0&&t.escapeInvalid===!0,c=o===!0||s===!0,l=t.escapeInvalid===!0?`\\`:``,u=``;if(e.isOpen===!0)return l+e.value;if(e.isClose===!0)return console.log(`node.isClose`,l,e.value),l+e.value;if(e.type===`open`)return c?l+e.value:`(`;if(e.type===`close`)return c?l+e.value:`)`;if(e.type===`comma`)return e.prev.type===`comma`?``:c?e.value:`|`;if(e.value)return e.value;if(e.nodes&&e.ranges>0){let i=r.reduce(e.nodes),a=n(...i,{...t,wrap:!1,toRegex:!0,strictZeros:!0});if(a.length!==0)return i.length>1&&a.length>1?`(${a})`:a}if(e.nodes)for(let t of e.nodes)u+=i(t,e);return u};return i(e)}})),ne=n(((e,t)=>{let n=I(),r=N(),i=M(),a=(e=``,t=``,n=!1)=>{let r=[];if(e=[].concat(e),t=[].concat(t),!t.length)return e;if(!e.length)return n?i.flatten(t).map(e=>`{${e}}`):t;for(let i of e)if(Array.isArray(i))for(let e of i)r.push(a(e,t,n));else for(let e of t)n===!0&&typeof e==`string`&&(e=`{${e}}`),r.push(Array.isArray(e)?a(i,e,n):i+e);return i.flatten(r)};t.exports=(e,t={})=>{let o=t.rangeLimit===void 0?1e3:t.rangeLimit,s=(e,c={})=>{e.queue=[];let l=c,u=c.queue;for(;l.type!==`brace`&&l.type!==`root`&&l.parent;)l=l.parent,u=l.queue;if(e.invalid||e.dollar){u.push(a(u.pop(),r(e,t)));return}if(e.type===`brace`&&e.invalid!==!0&&e.nodes.length===2){u.push(a(u.pop(),[`{}`]));return}if(e.nodes&&e.ranges>0){let s=i.reduce(e.nodes);if(i.exceedsLimit(...s,t.step,o))throw RangeError(`expanded array length exceeds range limit. Use options.rangeLimit to increase or disable the limit.`);let c=n(...s,t);c.length===0&&(c=r(e,t)),u.push(a(u.pop(),c)),e.nodes=[];return}let d=i.encloseBrace(e),f=e.queue,p=e;for(;p.type!==`brace`&&p.type!==`root`&&p.parent;)p=p.parent,f=p.queue;for(let t=0;t<e.nodes.length;t++){let n=e.nodes[t];if(n.type===`comma`&&e.type===`brace`){t===1&&f.push(``),f.push(``);continue}if(n.type===`close`){u.push(a(u.pop(),f,d));continue}if(n.value&&n.type!==`open`){f.push(a(f.pop(),n.value));continue}n.nodes&&s(n,e)}return f};return i.flatten(s(e))}})),re=n(((e,t)=>{t.exports={MAX_LENGTH:1e4,CHAR_0:`0`,CHAR_9:`9`,CHAR_UPPERCASE_A:`A`,CHAR_LOWERCASE_A:`a`,CHAR_UPPERCASE_Z:`Z`,CHAR_LOWERCASE_Z:`z`,CHAR_LEFT_PARENTHESES:`(`,CHAR_RIGHT_PARENTHESES:`)`,CHAR_ASTERISK:`*`,CHAR_AMPERSAND:`&`,CHAR_AT:`@`,CHAR_BACKSLASH:`\\`,CHAR_BACKTICK:"`",CHAR_CARRIAGE_RETURN:`\r`,CHAR_CIRCUMFLEX_ACCENT:`^`,CHAR_COLON:`:`,CHAR_COMMA:`,`,CHAR_DOLLAR:`$`,CHAR_DOT:`.`,CHAR_DOUBLE_QUOTE:`"`,CHAR_EQUAL:`=`,CHAR_EXCLAMATION_MARK:`!`,CHAR_FORM_FEED:`\f`,CHAR_FORWARD_SLASH:`/`,CHAR_HASH:`#`,CHAR_HYPHEN_MINUS:`-`,CHAR_LEFT_ANGLE_BRACKET:`<`,CHAR_LEFT_CURLY_BRACE:`{`,CHAR_LEFT_SQUARE_BRACKET:`[`,CHAR_LINE_FEED:`
17
+ `,CHAR_NO_BREAK_SPACE:`\xA0`,CHAR_PERCENT:`%`,CHAR_PLUS:`+`,CHAR_QUESTION_MARK:`?`,CHAR_RIGHT_ANGLE_BRACKET:`>`,CHAR_RIGHT_CURLY_BRACE:`}`,CHAR_RIGHT_SQUARE_BRACKET:`]`,CHAR_SEMICOLON:`;`,CHAR_SINGLE_QUOTE:`'`,CHAR_SPACE:` `,CHAR_TAB:` `,CHAR_UNDERSCORE:`_`,CHAR_VERTICAL_LINE:`|`,CHAR_ZERO_WIDTH_NOBREAK_SPACE:``}})),ie=n(((e,t)=>{let n=N(),{MAX_LENGTH:r,CHAR_BACKSLASH:i,CHAR_BACKTICK:a,CHAR_COMMA:o,CHAR_DOT:s,CHAR_LEFT_PARENTHESES:c,CHAR_RIGHT_PARENTHESES:l,CHAR_LEFT_CURLY_BRACE:u,CHAR_RIGHT_CURLY_BRACE:d,CHAR_LEFT_SQUARE_BRACKET:f,CHAR_RIGHT_SQUARE_BRACKET:p,CHAR_DOUBLE_QUOTE:m,CHAR_SINGLE_QUOTE:h,CHAR_NO_BREAK_SPACE:g,CHAR_ZERO_WIDTH_NOBREAK_SPACE:_}=re();t.exports=(e,t={})=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);let v=t||{},y=typeof v.maxLength==`number`?Math.min(r,v.maxLength):r;if(e.length>y)throw SyntaxError(`Input length (${e.length}), exceeds max characters (${y})`);let b={type:`root`,input:e,nodes:[]},x=[b],S=b,C=b,w=0,T=e.length,E=0,D=0,O,k=()=>e[E++],A=e=>{if(e.type===`text`&&C.type===`dot`&&(C.type=`text`),C&&C.type===`text`&&e.type===`text`){C.value+=e.value;return}return S.nodes.push(e),e.parent=S,e.prev=C,C=e,e};for(A({type:`bos`});E<T;)if(S=x[x.length-1],O=k(),!(O===_||O===g)){if(O===i){A({type:`text`,value:(t.keepEscaping?O:``)+k()});continue}if(O===p){A({type:`text`,value:`\\`+O});continue}if(O===f){w++;let e;for(;E<T&&(e=k());){if(O+=e,e===f){w++;continue}if(e===i){O+=k();continue}if(e===p&&(w--,w===0))break}A({type:`text`,value:O});continue}if(O===c){S=A({type:`paren`,nodes:[]}),x.push(S),A({type:`text`,value:O});continue}if(O===l){if(S.type!==`paren`){A({type:`text`,value:O});continue}S=x.pop(),A({type:`text`,value:O}),S=x[x.length-1];continue}if(O===m||O===h||O===a){let e=O,n;for(t.keepQuotes!==!0&&(O=``);E<T&&(n=k());){if(n===i){O+=n+k();continue}if(n===e){t.keepQuotes===!0&&(O+=n);break}O+=n}A({type:`text`,value:O});continue}if(O===u){D++,S=A({type:`brace`,open:!0,close:!1,dollar:C.value&&C.value.slice(-1)===`$`||S.dollar===!0,depth:D,commas:0,ranges:0,nodes:[]}),x.push(S),A({type:`open`,value:O});continue}if(O===d){if(S.type!==`brace`){A({type:`text`,value:O});continue}S=x.pop(),S.close=!0,A({type:`close`,value:O}),D--,S=x[x.length-1];continue}if(O===o&&D>0){if(S.ranges>0){S.ranges=0;let e=S.nodes.shift();S.nodes=[e,{type:`text`,value:n(S)}]}A({type:`comma`,value:O}),S.commas++;continue}if(O===s&&D>0&&S.commas===0){let e=S.nodes;if(D===0||e.length===0){A({type:`text`,value:O});continue}if(C.type===`dot`){if(S.range=[],C.value+=O,C.type=`range`,S.nodes.length!==3&&S.nodes.length!==5){S.invalid=!0,S.ranges=0,C.type=`text`;continue}S.ranges++,S.args=[];continue}if(C.type===`range`){e.pop();let t=e[e.length-1];t.value+=C.value+O,C=t,S.ranges--;continue}A({type:`dot`,value:O});continue}A({type:`text`,value:O})}do if(S=x.pop(),S.type!==`root`){S.nodes.forEach(e=>{e.nodes||(e.type===`open`&&(e.isOpen=!0),e.type===`close`&&(e.isClose=!0),e.nodes||(e.type=`text`),e.invalid=!0)});let e=x[x.length-1],t=e.nodes.indexOf(S);e.nodes.splice(t,1,...S.nodes)}while(x.length>0);return A({type:`eos`}),b}})),ae=n(((e,t)=>{let n=N(),r=te(),i=ne(),a=ie(),o=(e,t={})=>{let n=[];if(Array.isArray(e))for(let r of e){let e=o.create(r,t);Array.isArray(e)?n.push(...e):n.push(e)}else n=[].concat(o.create(e,t));return t&&t.expand===!0&&t.nodupes===!0&&(n=[...new Set(n)]),n};o.parse=(e,t={})=>a(e,t),o.stringify=(e,t={})=>n(typeof e==`string`?o.parse(e,t):e,t),o.compile=(e,t={})=>(typeof e==`string`&&(e=o.parse(e,t)),r(e,t)),o.expand=(e,t={})=>{typeof e==`string`&&(e=o.parse(e,t));let n=i(e,t);return t.noempty===!0&&(n=n.filter(Boolean)),t.nodupes===!0&&(n=[...new Set(n)]),n},o.create=(e,t={})=>e===``||e.length<3?[e]:t.expand===!0?o.expand(e,t):o.compile(e,t),t.exports=o})),oe=n(((t,n)=>{let r=e(`util`),i=ae(),a=e(`picomatch`),o=e(`picomatch/lib/utils`),s=e=>e===``||e===`./`,c=e=>{let t=e.indexOf(`{`);return t>-1&&e.indexOf(`}`,t)>-1},l=(e,t,n)=>{t=[].concat(t),e=[].concat(e);let r=new Set,i=new Set,o=new Set,s=0,c=e=>{o.add(e.output),n&&n.onResult&&n.onResult(e)};for(let o=0;o<t.length;o++){let l=a(String(t[o]),{...n,onResult:c},!0),u=l.state.negated||l.state.negatedExtglob;u&&s++;for(let t of e){let e=l(t,!0);(u?!e.isMatch:e.isMatch)&&(u?r.add(e.output):(r.delete(e.output),i.add(e.output)))}}let l=(s===t.length?[...o]:[...i]).filter(e=>!r.has(e));if(n&&l.length===0){if(n.failglob===!0)throw Error(`No matches found for "${t.join(`, `)}"`);if(n.nonull===!0||n.nullglob===!0)return n.unescape?t.map(e=>e.replace(/\\/g,``)):t}return l};l.match=l,l.matcher=(e,t)=>a(e,t),l.isMatch=(e,t,n)=>a(t,n)(e),l.any=l.isMatch,l.not=(e,t,n={})=>{t=[].concat(t).map(String);let r=new Set,i=[],a=e=>{n.onResult&&n.onResult(e),i.push(e.output)},o=new Set(l(e,t,{...n,onResult:a}));for(let e of i)o.has(e)||r.add(e);return[...r]},l.contains=(e,t,n)=>{if(typeof e!=`string`)throw TypeError(`Expected a string: "${r.inspect(e)}"`);if(Array.isArray(t))return t.some(t=>l.contains(e,t,n));if(typeof t==`string`){if(s(e)||s(t))return!1;if(e.includes(t)||e.startsWith(`./`)&&e.slice(2).includes(t))return!0}return l.isMatch(e,t,{...n,contains:!0})},l.matchKeys=(e,t,n)=>{if(!o.isObject(e))throw TypeError(`Expected the first argument to be an object`);let r=l(Object.keys(e),t,n),i={};for(let t of r)i[t]=e[t];return i},l.some=(e,t,n)=>{let r=[].concat(e);for(let e of[].concat(t)){let t=a(String(e),n);if(r.some(e=>t(e)))return!0}return!1},l.every=(e,t,n)=>{let r=[].concat(e);for(let e of[].concat(t)){let t=a(String(e),n);if(!r.every(e=>t(e)))return!1}return!0},l.all=(e,t,n)=>{if(typeof e!=`string`)throw TypeError(`Expected a string: "${r.inspect(e)}"`);return[].concat(t).every(t=>a(t,n)(e))},l.capture=(e,t,n)=>{let r=o.isWindows(n),i=a.makeRe(String(e),{...n,capture:!0}).exec(r?o.toPosixSlashes(t):t);if(i)return i.slice(1).map(e=>e===void 0?``:e)},l.makeRe=(...e)=>a.makeRe(...e),l.scan=(...e)=>a.scan(...e),l.parse=(e,t)=>{let n=[];for(let r of[].concat(e||[]))for(let e of i(String(r),t))n.push(a.parse(e,t));return n},l.braces=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);return t&&t.nobrace===!0||!c(e)?[e]:i(e,t)},l.braceExpand=(e,t)=>{if(typeof e!=`string`)throw TypeError(`Expected a string`);return l.braces(e,{...t,expand:!0})},l.hasBraces=c,n.exports=l})),se=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.isAbsolute=t.partitionAbsoluteAndRelative=t.removeDuplicateSlashes=t.matchAny=t.convertPatternsToRe=t.makeRe=t.getPatternParts=t.expandBraceExpansion=t.expandPatternsWithBraceExpansion=t.isAffectDepthOfReadingPattern=t.endsWithSlashGlobStar=t.hasGlobStar=t.getBaseDirectory=t.isPatternRelatedToParentDirectory=t.getPatternsOutsideCurrentDirectory=t.getPatternsInsideCurrentDirectory=t.getPositivePatterns=t.getNegativePatterns=t.isPositivePattern=t.isNegativePattern=t.convertToNegativePattern=t.convertToPositivePattern=t.isDynamicPattern=t.isStaticPattern=void 0;let n=e(`path`),r=ee(),i=oe(),a=/[*?]|^!/,o=/\[[^[]*]/,s=/(?:^|[^!*+?@])\([^(]*\|[^|]*\)/,c=/[!*+?@]\([^(]*\)/,l=/,|\.\./,u=/(?!^)\/{2,}/g;function d(e,t={}){return!f(e,t)}t.isStaticPattern=d;function f(e,t={}){return e===``?!1:!!(t.caseSensitiveMatch===!1||e.includes(`\\`)||a.test(e)||o.test(e)||s.test(e)||t.extglob!==!1&&c.test(e)||t.braceExpansion!==!1&&p(e))}t.isDynamicPattern=f;function p(e){let t=e.indexOf(`{`);if(t===-1)return!1;let n=e.indexOf(`}`,t+1);if(n===-1)return!1;let r=e.slice(t,n);return l.test(r)}function m(e){return g(e)?e.slice(1):e}t.convertToPositivePattern=m;function h(e){return`!`+e}t.convertToNegativePattern=h;function g(e){return e.startsWith(`!`)&&e[1]!==`(`}t.isNegativePattern=g;function _(e){return!g(e)}t.isPositivePattern=_;function v(e){return e.filter(g)}t.getNegativePatterns=v;function y(e){return e.filter(_)}t.getPositivePatterns=y;function b(e){return e.filter(e=>!S(e))}t.getPatternsInsideCurrentDirectory=b;function x(e){return e.filter(S)}t.getPatternsOutsideCurrentDirectory=x;function S(e){return e.startsWith(`..`)||e.startsWith(`./..`)}t.isPatternRelatedToParentDirectory=S;function C(e){return r(e,{flipBackslashes:!1})}t.getBaseDirectory=C;function w(e){return e.includes(`**`)}t.hasGlobStar=w;function T(e){return e.endsWith(`/**`)}t.endsWithSlashGlobStar=T;function E(e){let t=n.basename(e);return T(e)||d(t)}t.isAffectDepthOfReadingPattern=E;function D(e){return e.reduce((e,t)=>e.concat(O(t)),[])}t.expandPatternsWithBraceExpansion=D;function O(e){let t=i.braces(e,{expand:!0,nodupes:!0,keepEscaping:!0});return t.sort((e,t)=>e.length-t.length),t.filter(e=>e!==``)}t.expandBraceExpansion=O;function k(e,t){let{parts:n}=i.scan(e,Object.assign(Object.assign({},t),{parts:!0}));return n.length===0&&(n=[e]),n[0].startsWith(`/`)&&(n[0]=n[0].slice(1),n.unshift(``)),n}t.getPatternParts=k;function A(e,t){return i.makeRe(e,t)}t.makeRe=A;function j(e,t){return e.map(e=>A(e,t))}t.convertPatternsToRe=j;function M(e,t){return t.some(t=>t.test(e))}t.matchAny=M;function N(e){return e.replace(u,`/`)}t.removeDuplicateSlashes=N;function P(e){let t=[],n=[];for(let r of e)F(r)?t.push(r):n.push(r);return[t,n]}t.partitionAbsoluteAndRelative=P;function F(e){return n.isAbsolute(e)}t.isAbsolute=F})),ce=n(((t,n)=>{let r=e(`stream`).PassThrough,i=Array.prototype.slice;n.exports=a;function a(){let e=[],t=i.call(arguments),n=!1,a=t[t.length-1];a&&!Array.isArray(a)&&a.pipe==null?t.pop():a={};let s=a.end!==!1,c=a.pipeError===!0;a.objectMode??=!0,a.highWaterMark??=64*1024;let l=r(a);function u(){for(let t=0,n=arguments.length;t<n;t++)e.push(o(arguments[t],a));return d(),this}function d(){if(n)return;n=!0;let t=e.shift();if(!t){process.nextTick(f);return}Array.isArray(t)||(t=[t]);let r=t.length+1;function i(){--r>0||(n=!1,d())}function a(e){function t(){e.removeListener(`merge2UnpipeEnd`,t),e.removeListener(`end`,t),c&&e.removeListener(`error`,n),i()}function n(e){l.emit(`error`,e)}if(e._readableState.endEmitted)return i();e.on(`merge2UnpipeEnd`,t),e.on(`end`,t),c&&e.on(`error`,n),e.pipe(l,{end:!1}),e.resume()}for(let e=0;e<t.length;e++)a(t[e]);i()}function f(){n=!1,l.emit(`queueDrain`),s&&l.end()}return l.setMaxListeners(0),l.add=u,l.on(`unpipe`,function(e){e.emit(`merge2UnpipeEnd`)}),t.length&&u.apply(null,t),l}function o(e,t){if(Array.isArray(e))for(let n=0,r=e.length;n<r;n++)e[n]=o(e[n],t);else{if(!e._readableState&&e.pipe&&(e=e.pipe(r(t))),!e._readableState||!e.pause||!e.pipe)throw Error(`Only readable stream can be merged.`);e.pause()}return e}})),le=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.merge=void 0;let t=ce();function n(e){let n=t(e);return e.forEach(e=>{e.once(`error`,e=>n.emit(`error`,e))}),n.once(`close`,()=>r(e)),n.once(`end`,()=>r(e)),n}e.merge=n;function r(e){e.forEach(e=>e.emit(`close`))}})),ue=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isEmpty=e.isString=void 0;function t(e){return typeof e==`string`}e.isString=t;function n(e){return e===``}e.isEmpty=n})),L=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.string=e.stream=e.pattern=e.path=e.fs=e.errno=e.array=void 0,e.array=E(),e.errno=D(),e.fs=O(),e.path=k(),e.pattern=se(),e.stream=le(),e.string=ue()})),de=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.convertPatternGroupToTask=e.convertPatternGroupsToTasks=e.groupPatternsByBaseDirectory=e.getNegativePatternsAsPositive=e.getPositivePatterns=e.convertPatternsToTasks=e.generate=void 0;let t=L();function n(e,n){let s=r(e,n),c=r(n.ignore,n),l=a(s),u=o(s,c),d=l.filter(e=>t.pattern.isStaticPattern(e,n)),f=l.filter(e=>t.pattern.isDynamicPattern(e,n)),p=i(d,u,!1),m=i(f,u,!0);return p.concat(m)}e.generate=n;function r(e,n){let r=e;return n.braceExpansion&&(r=t.pattern.expandPatternsWithBraceExpansion(r)),n.baseNameMatch&&(r=r.map(e=>e.includes(`/`)?e:`**/${e}`)),r.map(e=>t.pattern.removeDuplicateSlashes(e))}function i(e,n,r){let i=[],a=t.pattern.getPatternsOutsideCurrentDirectory(e),o=t.pattern.getPatternsInsideCurrentDirectory(e),u=s(a),d=s(o);return i.push(...c(u,n,r)),`.`in d?i.push(l(`.`,o,n,r)):i.push(...c(d,n,r)),i}e.convertPatternsToTasks=i;function a(e){return t.pattern.getPositivePatterns(e)}e.getPositivePatterns=a;function o(e,n){return t.pattern.getNegativePatterns(e).concat(n).map(t.pattern.convertToPositivePattern)}e.getNegativePatternsAsPositive=o;function s(e){return e.reduce((e,n)=>{let r=t.pattern.getBaseDirectory(n);return r in e?e[r].push(n):e[r]=[n],e},{})}e.groupPatternsByBaseDirectory=s;function c(e,t,n){return Object.keys(e).map(r=>l(r,e[r],t,n))}e.convertPatternGroupsToTasks=c;function l(e,n,r,i){return{dynamic:i,positive:n,negative:r,base:e,patterns:[].concat(n,r.map(t.pattern.convertToNegativePattern))}}e.convertPatternGroupToTask=l})),fe=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.read=void 0;function t(e,t,i){t.fs.lstat(e,(a,o)=>{if(a!==null){n(i,a);return}if(!o.isSymbolicLink()||!t.followSymbolicLink){r(i,o);return}t.fs.stat(e,(e,a)=>{if(e!==null){if(t.throwErrorOnBrokenSymbolicLink){n(i,e);return}r(i,o);return}t.markSymbolicLink&&(a.isSymbolicLink=()=>!0),r(i,a)})})}e.read=t;function n(e,t){e(t)}function r(e,t){e(null,t)}})),pe=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.read=void 0;function t(e,t){let n=t.fs.lstatSync(e);if(!n.isSymbolicLink()||!t.followSymbolicLink)return n;try{let n=t.fs.statSync(e);return t.markSymbolicLink&&(n.isSymbolicLink=()=>!0),n}catch(e){if(!t.throwErrorOnBrokenSymbolicLink)return n;throw e}}e.read=t})),me=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;let n=e(`fs`);t.FILE_SYSTEM_ADAPTER={lstat:n.lstat,stat:n.stat,lstatSync:n.lstatSync,statSync:n.statSync};function r(e){return e===void 0?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}t.createFileSystemAdapter=r})),he=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=me();e.default=class{constructor(e={}){this._options=e,this.followSymbolicLink=this._getValue(this._options.followSymbolicLink,!0),this.fs=t.createFileSystemAdapter(this._options.fs),this.markSymbolicLink=this._getValue(this._options.markSymbolicLink,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0)}_getValue(e,t){return e??t}}})),R=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.statSync=e.stat=e.Settings=void 0;let t=fe(),n=pe(),r=he();e.Settings=r.default;function i(e,n,r){if(typeof n==`function`){t.read(e,o(),n);return}t.read(e,o(n),r)}e.stat=i;function a(e,t){let r=o(t);return n.read(e,r)}e.statSync=a;function o(e={}){return e instanceof r.default?e:new r.default(e)}})),ge=n(((e,t)=>{
18
+ /*! queue-microtask. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
19
+ let n;t.exports=typeof queueMicrotask==`function`?queueMicrotask.bind(typeof window<`u`?window:global):e=>(n||=Promise.resolve()).then(e).catch(e=>setTimeout(()=>{throw e},0))})),_e=n(((e,t)=>{
20
+ /*! run-parallel. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
21
+ t.exports=r;let n=ge();function r(e,t){let r,i,a,o=!0;Array.isArray(e)?(r=[],i=e.length):(a=Object.keys(e),r={},i=a.length);function s(e){function i(){t&&t(e,r),t=null}o?n(i):i()}function c(e,t,n){r[e]=n,(--i===0||t)&&s(t)}i?a?a.forEach(function(t){e[t](function(e,n){c(t,e,n)})}):e.forEach(function(e,t){e(function(e,n){c(t,e,n)})}):s(null),o=!1}})),z=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.IS_SUPPORT_READDIR_WITH_FILE_TYPES=void 0;let t=process.versions.node.split(`.`);if(t[0]===void 0||t[1]===void 0)throw Error(`Unexpected behavior. The 'process.versions.node' variable has invalid value: ${process.versions.node}`);let n=Number.parseInt(t[0],10),r=Number.parseInt(t[1],10);e.IS_SUPPORT_READDIR_WITH_FILE_TYPES=n>10||n===10&&r>=10})),ve=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDirentFromStats=void 0;var t=class{constructor(e,t){this.name=e,this.isBlockDevice=t.isBlockDevice.bind(t),this.isCharacterDevice=t.isCharacterDevice.bind(t),this.isDirectory=t.isDirectory.bind(t),this.isFIFO=t.isFIFO.bind(t),this.isFile=t.isFile.bind(t),this.isSocket=t.isSocket.bind(t),this.isSymbolicLink=t.isSymbolicLink.bind(t)}};function n(e,n){return new t(e,n)}e.createDirentFromStats=n})),B=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.fs=void 0,e.fs=ve()})),V=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.joinPathSegments=void 0;function t(e,t,n){return e.endsWith(n)?e+t:e+n+t}e.joinPathSegments=t})),ye=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readdir=e.readdirWithFileTypes=e.read=void 0;let t=R(),n=_e(),r=z(),i=B(),a=V();function o(e,t,n){if(!t.stats&&r.IS_SUPPORT_READDIR_WITH_FILE_TYPES){s(e,t,n);return}l(e,t,n)}e.read=o;function s(e,t,r){t.fs.readdir(e,{withFileTypes:!0},(i,o)=>{if(i!==null){u(r,i);return}let s=o.map(n=>({dirent:n,name:n.name,path:a.joinPathSegments(e,n.name,t.pathSegmentSeparator)}));if(!t.followSymbolicLinks){d(r,s);return}n(s.map(e=>c(e,t)),(e,t)=>{if(e!==null){u(r,e);return}d(r,t)})})}e.readdirWithFileTypes=s;function c(e,t){return n=>{if(!e.dirent.isSymbolicLink()){n(null,e);return}t.fs.stat(e.path,(r,a)=>{if(r!==null){if(t.throwErrorOnBrokenSymbolicLink){n(r);return}n(null,e);return}e.dirent=i.fs.createDirentFromStats(e.name,a),n(null,e)})}}function l(e,r,o){r.fs.readdir(e,(s,c)=>{if(s!==null){u(o,s);return}n(c.map(n=>{let o=a.joinPathSegments(e,n,r.pathSegmentSeparator);return e=>{t.stat(o,r.fsStatSettings,(t,a)=>{if(t!==null){e(t);return}let s={name:n,path:o,dirent:i.fs.createDirentFromStats(n,a)};r.stats&&(s.stats=a),e(null,s)})}}),(e,t)=>{if(e!==null){u(o,e);return}d(o,t)})})}e.readdir=l;function u(e,t){e(t)}function d(e,t){e(null,t)}})),be=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.readdir=e.readdirWithFileTypes=e.read=void 0;let t=R(),n=z(),r=B(),i=V();function a(e,t){return!t.stats&&n.IS_SUPPORT_READDIR_WITH_FILE_TYPES?o(e,t):s(e,t)}e.read=a;function o(e,t){return t.fs.readdirSync(e,{withFileTypes:!0}).map(n=>{let a={dirent:n,name:n.name,path:i.joinPathSegments(e,n.name,t.pathSegmentSeparator)};if(a.dirent.isSymbolicLink()&&t.followSymbolicLinks)try{let e=t.fs.statSync(a.path);a.dirent=r.fs.createDirentFromStats(a.name,e)}catch(e){if(t.throwErrorOnBrokenSymbolicLink)throw e}return a})}e.readdirWithFileTypes=o;function s(e,n){return n.fs.readdirSync(e).map(a=>{let o=i.joinPathSegments(e,a,n.pathSegmentSeparator),s=t.statSync(o,n.fsStatSettings),c={name:a,path:o,dirent:r.fs.createDirentFromStats(a,s)};return n.stats&&(c.stats=s),c})}e.readdir=s})),xe=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.createFileSystemAdapter=t.FILE_SYSTEM_ADAPTER=void 0;let n=e(`fs`);t.FILE_SYSTEM_ADAPTER={lstat:n.lstat,stat:n.stat,lstatSync:n.lstatSync,statSync:n.statSync,readdir:n.readdir,readdirSync:n.readdirSync};function r(e){return e===void 0?t.FILE_SYSTEM_ADAPTER:Object.assign(Object.assign({},t.FILE_SYSTEM_ADAPTER),e)}t.createFileSystemAdapter=r})),Se=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=R(),i=xe();t.default=class{constructor(e={}){this._options=e,this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!1),this.fs=i.createFileSystemAdapter(this._options.fs),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,n.sep),this.stats=this._getValue(this._options.stats,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!0),this.fsStatSettings=new r.Settings({followSymbolicLink:this.followSymbolicLinks,fs:this.fs,throwErrorOnBrokenSymbolicLink:this.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return e??t}}})),H=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Settings=e.scandirSync=e.scandir=void 0;let t=ye(),n=be(),r=Se();e.Settings=r.default;function i(e,n,r){if(typeof n==`function`){t.read(e,o(),n);return}t.read(e,o(n),r)}e.scandir=i;function a(e,t){let r=o(t);return n.read(e,r)}e.scandirSync=a;function o(e={}){return e instanceof r.default?e:new r.default(e)}})),Ce=n(((e,t)=>{function n(e){var t=new e,n=t;function r(){var r=t;return r.next?t=r.next:(t=new e,n=t),r.next=null,r}function i(e){n.next=e,n=e}return{get:r,release:i}}t.exports=n})),we=n(((e,t)=>{var n=Ce();function r(e,t,r){if(typeof e==`function`&&(r=t,t=e,e=null),!(r>=1))throw Error(`fastqueue concurrency must be equal to or greater than 1`);var o=n(a),s=null,c=null,l=0,u=null,d={push:v,drain:i,saturated:i,pause:p,paused:!1,get concurrency(){return r},set concurrency(e){if(!(e>=1))throw Error(`fastqueue concurrency must be equal to or greater than 1`);if(r=e,!d.paused)for(;s&&l<r;)l++,b()},running:f,resume:g,idle:_,length:m,getQueue:h,unshift:y,empty:i,kill:x,killAndDrain:S,error:C};return d;function f(){return l}function p(){d.paused=!0}function m(){for(var e=s,t=0;e;)e=e.next,t++;return t}function h(){for(var e=s,t=[];e;)t.push(e.value),e=e.next;return t}function g(){if(d.paused){if(d.paused=!1,s===null){l++,b();return}for(;s&&l<r;)l++,b()}}function _(){return l===0&&d.length()===0}function v(n,a){var f=o.get();f.context=e,f.release=b,f.value=n,f.callback=a||i,f.errorHandler=u,l>=r||d.paused?c?(c.next=f,c=f):(s=f,c=f,d.saturated()):(l++,t.call(e,f.value,f.worked))}function y(n,a){var f=o.get();f.context=e,f.release=b,f.value=n,f.callback=a||i,f.errorHandler=u,l>=r||d.paused?s?(f.next=s,s=f):(s=f,c=f,d.saturated()):(l++,t.call(e,f.value,f.worked))}function b(n){n&&o.release(n);var i=s;i&&l<=r?d.paused?l--:(c===s&&(c=null),s=i.next,i.next=null,t.call(e,i.value,i.worked),c===null&&d.empty()):--l===0&&d.drain()}function x(){s=null,c=null,d.drain=i}function S(){s=null,c=null,d.drain(),d.drain=i}function C(e){u=e}}function i(){}function a(){this.value=null,this.callback=i,this.next=null,this.release=i,this.context=null,this.errorHandler=null;var e=this;this.worked=function(t,n){var r=e.callback,a=e.errorHandler,o=e.value;e.value=null,e.callback=i,e.errorHandler&&a(t,o),r.call(e.context,t,n),e.release(e)}}function o(e,t,n){typeof e==`function`&&(n=t,t=e,e=null);function a(e,n){t.call(this,e).then(function(e){n(null,e)},n)}var o=r(e,a,n),s=o.push,c=o.unshift;return o.push=l,o.unshift=u,o.drained=d,o;function l(e){var t=new Promise(function(t,n){s(e,function(e,r){if(e){n(e);return}t(r)})});return t.catch(i),t}function u(e){var t=new Promise(function(t,n){c(e,function(e,r){if(e){n(e);return}t(r)})});return t.catch(i),t}function d(){return new Promise(function(e){process.nextTick(function(){if(o.idle())e();else{var t=o.drain;o.drain=function(){typeof t==`function`&&t(),e(),o.drain=t}}})})}}t.exports=r,t.exports.promise=o})),U=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.joinPathSegments=e.replacePathSegmentSeparator=e.isAppliedFilter=e.isFatalError=void 0;function t(e,t){return e.errorFilter===null?!0:!e.errorFilter(t)}e.isFatalError=t;function n(e,t){return e===null||e(t)}e.isAppliedFilter=n;function r(e,t){return e.split(/[/\\]/).join(t)}e.replacePathSegmentSeparator=r;function i(e,t,n){return e===``?t:e.endsWith(n)?e+t:e+n+t}e.joinPathSegments=i})),W=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=U();e.default=class{constructor(e,n){this._root=e,this._settings=n,this._root=t.replacePathSegmentSeparator(e,n.pathSegmentSeparator)}}})),G=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`events`),r=H(),i=we(),a=U(),o=W();t.default=class extends o.default{constructor(e,t){super(e,t),this._settings=t,this._scandir=r.scandir,this._emitter=new n.EventEmitter,this._queue=i(this._worker.bind(this),this._settings.concurrency),this._isFatalError=!1,this._isDestroyed=!1,this._queue.drain=()=>{this._isFatalError||this._emitter.emit(`end`)}}read(){return this._isFatalError=!1,this._isDestroyed=!1,setImmediate(()=>{this._pushToQueue(this._root,this._settings.basePath)}),this._emitter}get isDestroyed(){return this._isDestroyed}destroy(){if(this._isDestroyed)throw Error(`The reader is already destroyed`);this._isDestroyed=!0,this._queue.killAndDrain()}onEntry(e){this._emitter.on(`entry`,e)}onError(e){this._emitter.once(`error`,e)}onEnd(e){this._emitter.once(`end`,e)}_pushToQueue(e,t){let n={directory:e,base:t};this._queue.push(n,e=>{e!==null&&this._handleError(e)})}_worker(e,t){this._scandir(e.directory,this._settings.fsScandirSettings,(n,r)=>{if(n!==null){t(n,void 0);return}for(let t of r)this._handleEntry(t,e.base);t(null,void 0)})}_handleError(e){this._isDestroyed||!a.isFatalError(this._settings,e)||(this._isFatalError=!0,this._isDestroyed=!0,this._emitter.emit(`error`,e))}_handleEntry(e,t){if(this._isDestroyed||this._isFatalError)return;let n=e.path;t!==void 0&&(e.path=a.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),a.isAppliedFilter(this._settings.entryFilter,e)&&this._emitEntry(e),e.dirent.isDirectory()&&a.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(n,t===void 0?void 0:e.path)}_emitEntry(e){this._emitter.emit(`entry`,e)}}})),Te=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=G();e.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings),this._storage=[]}read(e){this._reader.onError(t=>{n(e,t)}),this._reader.onEntry(e=>{this._storage.push(e)}),this._reader.onEnd(()=>{r(e,this._storage)}),this._reader.read()}};function n(e,t){e(t)}function r(e,t){e(null,t)}})),Ee=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`stream`),r=G();t.default=class{constructor(e,t){this._root=e,this._settings=t,this._reader=new r.default(this._root,this._settings),this._stream=new n.Readable({objectMode:!0,read:()=>{},destroy:()=>{this._reader.isDestroyed||this._reader.destroy()}})}read(){return this._reader.onError(e=>{this._stream.emit(`error`,e)}),this._reader.onEntry(e=>{this._stream.push(e)}),this._reader.onEnd(()=>{this._stream.push(null)}),this._reader.read(),this._stream}}})),De=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=H(),n=U(),r=W();e.default=class extends r.default{constructor(){super(...arguments),this._scandir=t.scandirSync,this._storage=[],this._queue=new Set}read(){return this._pushToQueue(this._root,this._settings.basePath),this._handleQueue(),this._storage}_pushToQueue(e,t){this._queue.add({directory:e,base:t})}_handleQueue(){for(let e of this._queue.values())this._handleDirectory(e.directory,e.base)}_handleDirectory(e,t){try{let n=this._scandir(e,this._settings.fsScandirSettings);for(let e of n)this._handleEntry(e,t)}catch(e){this._handleError(e)}}_handleError(e){if(n.isFatalError(this._settings,e))throw e}_handleEntry(e,t){let r=e.path;t!==void 0&&(e.path=n.joinPathSegments(t,e.name,this._settings.pathSegmentSeparator)),n.isAppliedFilter(this._settings.entryFilter,e)&&this._pushToStorage(e),e.dirent.isDirectory()&&n.isAppliedFilter(this._settings.deepFilter,e)&&this._pushToQueue(r,t===void 0?void 0:e.path)}_pushToStorage(e){this._storage.push(e)}}})),Oe=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=De();e.default=class{constructor(e,n){this._root=e,this._settings=n,this._reader=new t.default(this._root,this._settings)}read(){return this._reader.read()}}})),ke=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=H();t.default=class{constructor(e={}){this._options=e,this.basePath=this._getValue(this._options.basePath,void 0),this.concurrency=this._getValue(this._options.concurrency,1/0),this.deepFilter=this._getValue(this._options.deepFilter,null),this.entryFilter=this._getValue(this._options.entryFilter,null),this.errorFilter=this._getValue(this._options.errorFilter,null),this.pathSegmentSeparator=this._getValue(this._options.pathSegmentSeparator,n.sep),this.fsScandirSettings=new r.Settings({followSymbolicLinks:this._options.followSymbolicLinks,fs:this._options.fs,pathSegmentSeparator:this._options.pathSegmentSeparator,stats:this._options.stats,throwErrorOnBrokenSymbolicLink:this._options.throwErrorOnBrokenSymbolicLink})}_getValue(e,t){return e??t}}})),K=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Settings=e.walkStream=e.walkSync=e.walk=void 0;let t=Te(),n=Ee(),r=Oe(),i=ke();e.Settings=i.default;function a(e,n,r){if(typeof n==`function`){new t.default(e,c()).read(n);return}new t.default(e,c(n)).read(r)}e.walk=a;function o(e,t){let n=c(t);return new r.default(e,n).read()}e.walkSync=o;function s(e,t){let r=c(t);return new n.default(e,r).read()}e.walkStream=s;function c(e={}){return e instanceof i.default?e:new i.default(e)}})),q=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=R(),i=L();t.default=class{constructor(e){this._settings=e,this._fsStatSettings=new r.Settings({followSymbolicLink:this._settings.followSymbolicLinks,fs:this._settings.fs,throwErrorOnBrokenSymbolicLink:this._settings.followSymbolicLinks})}_getFullEntryPath(e){return n.resolve(this._settings.cwd,e)}_makeEntry(e,t){let n={name:t,path:t,dirent:i.fs.createDirentFromStats(t,e)};return this._settings.stats&&(n.stats=e),n}_isFatalError(e){return!i.errno.isEnoentCodeError(e)&&!this._settings.suppressErrors}}})),J=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`stream`),r=R(),i=K(),a=q();t.default=class extends a.default{constructor(){super(...arguments),this._walkStream=i.walkStream,this._stat=r.stat}dynamic(e,t){return this._walkStream(e,t)}static(e,t){let r=e.map(this._getFullEntryPath,this),i=new n.PassThrough({objectMode:!0});i._write=(n,a,o)=>this._getEntry(r[n],e[n],t).then(e=>{e!==null&&t.entryFilter(e)&&i.push(e),n===r.length-1&&i.end(),o()}).catch(o);for(let e=0;e<r.length;e++)i.write(e);return i}_getEntry(e,t,n){return this._getStat(e).then(e=>this._makeEntry(e,t)).catch(e=>{if(n.errorFilter(e))return null;throw e})}_getStat(e){return new Promise((t,n)=>{this._stat(e,this._fsStatSettings,(e,r)=>e===null?t(r):n(e))})}}})),Ae=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=K(),n=q(),r=J();e.default=class extends n.default{constructor(){super(...arguments),this._walkAsync=t.walk,this._readerStream=new r.default(this._settings)}dynamic(e,t){return new Promise((n,r)=>{this._walkAsync(e,t,(e,t)=>{e===null?n(t):r(e)})})}async static(e,t){let n=[],r=this._readerStream.static(e,t);return new Promise((e,t)=>{r.once(`error`,t),r.on(`data`,e=>n.push(e)),r.once(`end`,()=>e(n))})}}})),je=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=L();e.default=class{constructor(e,t,n){this._patterns=e,this._settings=t,this._micromatchOptions=n,this._storage=[],this._fillStorage()}_fillStorage(){for(let e of this._patterns){let t=this._getPatternSegments(e),n=this._splitSegmentsIntoSections(t);this._storage.push({complete:n.length<=1,pattern:e,segments:t,sections:n})}}_getPatternSegments(e){return t.pattern.getPatternParts(e,this._micromatchOptions).map(e=>t.pattern.isDynamicPattern(e,this._settings)?{dynamic:!0,pattern:e,patternRe:t.pattern.makeRe(e,this._micromatchOptions)}:{dynamic:!1,pattern:e})}_splitSegmentsIntoSections(e){return t.array.splitWhen(e,e=>e.dynamic&&t.pattern.hasGlobStar(e.pattern))}}})),Me=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=je();e.default=class extends t.default{match(e){let t=e.split(`/`),n=t.length,r=this._storage.filter(e=>!e.complete||e.segments.length>n);for(let e of r){let r=e.sections[0];if(!e.complete&&n>r.length||t.every((t,n)=>{let r=e.segments[n];return!!(r.dynamic&&r.patternRe.test(t)||!r.dynamic&&r.pattern===t)}))return!0}return!1}}})),Ne=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=L(),n=Me();e.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t}getFilter(e,t,n){let r=this._getMatcher(t),i=this._getNegativePatternsRe(n);return t=>this._filter(e,t,r,i)}_getMatcher(e){return new n.default(e,this._settings,this._micromatchOptions)}_getNegativePatternsRe(e){let n=e.filter(t.pattern.isAffectDepthOfReadingPattern);return t.pattern.convertPatternsToRe(n,this._micromatchOptions)}_filter(e,n,r,i){if(this._isSkippedByDeep(e,n.path)||this._isSkippedSymbolicLink(n))return!1;let a=t.path.removeLeadingDotSegment(n.path);return this._isSkippedByPositivePatterns(a,r)?!1:this._isSkippedByNegativePatterns(a,i)}_isSkippedByDeep(e,t){return this._settings.deep===1/0?!1:this._getEntryLevel(e,t)>=this._settings.deep}_getEntryLevel(e,t){let n=t.split(`/`).length;return e===``?n:n-e.split(`/`).length}_isSkippedSymbolicLink(e){return!this._settings.followSymbolicLinks&&e.dirent.isSymbolicLink()}_isSkippedByPositivePatterns(e,t){return!this._settings.baseNameMatch&&!t.match(e)}_isSkippedByNegativePatterns(e,n){return!t.pattern.matchAny(e,n)}}})),Pe=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=L();e.default=class{constructor(e,t){this._settings=e,this._micromatchOptions=t,this.index=new Map}getFilter(e,n){let[r,i]=t.pattern.partitionAbsoluteAndRelative(n),a={positive:{all:t.pattern.convertPatternsToRe(e,this._micromatchOptions)},negative:{absolute:t.pattern.convertPatternsToRe(r,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0})),relative:t.pattern.convertPatternsToRe(i,Object.assign(Object.assign({},this._micromatchOptions),{dot:!0}))}};return e=>this._filter(e,a)}_filter(e,n){let r=t.path.removeLeadingDotSegment(e.path);if(this._settings.unique&&this._isDuplicateEntry(r)||this._onlyFileFilter(e)||this._onlyDirectoryFilter(e))return!1;let i=this._isMatchToPatternsSet(r,n,e.dirent.isDirectory());return this._settings.unique&&i&&this._createIndexRecord(r),i}_isDuplicateEntry(e){return this.index.has(e)}_createIndexRecord(e){this.index.set(e,void 0)}_onlyFileFilter(e){return this._settings.onlyFiles&&!e.dirent.isFile()}_onlyDirectoryFilter(e){return this._settings.onlyDirectories&&!e.dirent.isDirectory()}_isMatchToPatternsSet(e,t,n){return!(!this._isMatchToPatterns(e,t.positive.all,n)||this._isMatchToPatterns(e,t.negative.relative,n)||this._isMatchToAbsoluteNegative(e,t.negative.absolute,n))}_isMatchToAbsoluteNegative(e,n,r){if(n.length===0)return!1;let i=t.path.makeAbsolute(this._settings.cwd,e);return this._isMatchToPatterns(i,n,r)}_isMatchToPatterns(e,n,r){if(n.length===0)return!1;let i=t.pattern.matchAny(e,n);return!i&&r?t.pattern.matchAny(e+`/`,n):i}}})),Fe=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=L();e.default=class{constructor(e){this._settings=e}getFilter(){return e=>this._isNonFatalError(e)}_isNonFatalError(e){return t.errno.isEnoentCodeError(e)||this._settings.suppressErrors}}})),Ie=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=L();e.default=class{constructor(e){this._settings=e}getTransformer(){return e=>this._transform(e)}_transform(e){let n=e.path;return this._settings.absolute&&(n=t.path.makeAbsolute(this._settings.cwd,n),n=t.path.unixify(n)),this._settings.markDirectories&&e.dirent.isDirectory()&&(n+=`/`),this._settings.objectMode?Object.assign(Object.assign({},e),{path:n}):n}}})),Y=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`path`),r=Ne(),i=Pe(),a=Fe(),o=Ie();t.default=class{constructor(e){this._settings=e,this.errorFilter=new a.default(this._settings),this.entryFilter=new i.default(this._settings,this._getMicromatchOptions()),this.deepFilter=new r.default(this._settings,this._getMicromatchOptions()),this.entryTransformer=new o.default(this._settings)}_getRootDirectory(e){return n.resolve(this._settings.cwd,e.base)}_getReaderOptions(e){let t=e.base===`.`?``:e.base;return{basePath:t,pathSegmentSeparator:`/`,concurrency:this._settings.concurrency,deepFilter:this.deepFilter.getFilter(t,e.positive,e.negative),entryFilter:this.entryFilter.getFilter(e.positive,e.negative),errorFilter:this.errorFilter.getFilter(),followSymbolicLinks:this._settings.followSymbolicLinks,fs:this._settings.fs,stats:this._settings.stats,throwErrorOnBrokenSymbolicLink:this._settings.throwErrorOnBrokenSymbolicLink,transform:this.entryTransformer.getTransformer()}}_getMicromatchOptions(){return{dot:this._settings.dot,matchBase:this._settings.baseNameMatch,nobrace:!this._settings.braceExpansion,nocase:!this._settings.caseSensitiveMatch,noext:!this._settings.extglob,noglobstar:!this._settings.globstar,posix:!0,strictSlashes:!1}}}})),Le=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=Ae(),n=Y();e.default=class extends n.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}async read(e){let t=this._getRootDirectory(e),n=this._getReaderOptions(e);return(await this.api(t,e,n)).map(e=>n.transform(e))}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}})),Re=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0});let n=e(`stream`),r=J(),i=Y();t.default=class extends i.default{constructor(){super(...arguments),this._reader=new r.default(this._settings)}read(e){let t=this._getRootDirectory(e),r=this._getReaderOptions(e),i=this.api(t,e,r),a=new n.Readable({objectMode:!0,read:()=>{}});return i.once(`error`,e=>a.emit(`error`,e)).on(`data`,e=>a.emit(`data`,r.transform(e))).once(`end`,()=>a.emit(`end`)),a.once(`close`,()=>i.destroy()),a}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}})),ze=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=R(),n=K(),r=q();e.default=class extends r.default{constructor(){super(...arguments),this._walkSync=n.walkSync,this._statSync=t.statSync}dynamic(e,t){return this._walkSync(e,t)}static(e,t){let n=[];for(let r of e){let e=this._getFullEntryPath(r),i=this._getEntry(e,r,t);i===null||!t.entryFilter(i)||n.push(i)}return n}_getEntry(e,t,n){try{let n=this._getStat(e);return this._makeEntry(n,t)}catch(e){if(n.errorFilter(e))return null;throw e}}_getStat(e){return this._statSync(e,this._fsStatSettings)}}})),Be=n((e=>{Object.defineProperty(e,`__esModule`,{value:!0});let t=ze(),n=Y();e.default=class extends n.default{constructor(){super(...arguments),this._reader=new t.default(this._settings)}read(e){let t=this._getRootDirectory(e),n=this._getReaderOptions(e);return this.api(t,e,n).map(n.transform)}api(e,t,n){return t.dynamic?this._reader.dynamic(e,n):this._reader.static(t.patterns,n)}}})),Ve=n((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.DEFAULT_FILE_SYSTEM_ADAPTER=void 0;let n=e(`fs`),r=e(`os`),i=Math.max(r.cpus().length,1);t.DEFAULT_FILE_SYSTEM_ADAPTER={lstat:n.lstat,lstatSync:n.lstatSync,stat:n.stat,statSync:n.statSync,readdir:n.readdir,readdirSync:n.readdirSync},t.default=class{constructor(e={}){this._options=e,this.absolute=this._getValue(this._options.absolute,!1),this.baseNameMatch=this._getValue(this._options.baseNameMatch,!1),this.braceExpansion=this._getValue(this._options.braceExpansion,!0),this.caseSensitiveMatch=this._getValue(this._options.caseSensitiveMatch,!0),this.concurrency=this._getValue(this._options.concurrency,i),this.cwd=this._getValue(this._options.cwd,process.cwd()),this.deep=this._getValue(this._options.deep,1/0),this.dot=this._getValue(this._options.dot,!1),this.extglob=this._getValue(this._options.extglob,!0),this.followSymbolicLinks=this._getValue(this._options.followSymbolicLinks,!0),this.fs=this._getFileSystemMethods(this._options.fs),this.globstar=this._getValue(this._options.globstar,!0),this.ignore=this._getValue(this._options.ignore,[]),this.markDirectories=this._getValue(this._options.markDirectories,!1),this.objectMode=this._getValue(this._options.objectMode,!1),this.onlyDirectories=this._getValue(this._options.onlyDirectories,!1),this.onlyFiles=this._getValue(this._options.onlyFiles,!0),this.stats=this._getValue(this._options.stats,!1),this.suppressErrors=this._getValue(this._options.suppressErrors,!1),this.throwErrorOnBrokenSymbolicLink=this._getValue(this._options.throwErrorOnBrokenSymbolicLink,!1),this.unique=this._getValue(this._options.unique,!0),this.onlyDirectories&&(this.onlyFiles=!1),this.stats&&(this.objectMode=!0),this.ignore=[].concat(this.ignore)}_getValue(e,t){return e===void 0?t:e}_getFileSystemMethods(e={}){return Object.assign(Object.assign({},t.DEFAULT_FILE_SYSTEM_ADAPTER),e)}}})),He=n(((e,t)=>{let n=de(),r=Le(),i=Re(),a=Be(),o=Ve(),s=L();async function c(e,t){u(e);let n=l(e,r.default,t),i=await Promise.all(n);return s.array.flatten(i)}(function(e){e.glob=e,e.globSync=t,e.globStream=r,e.async=e;function t(e,t){u(e);let n=l(e,a.default,t);return s.array.flatten(n)}e.sync=t;function r(e,t){u(e);let n=l(e,i.default,t);return s.stream.merge(n)}e.stream=r;function c(e,t){u(e);let r=[].concat(e),i=new o.default(t);return n.generate(r,i)}e.generateTasks=c;function d(e,t){u(e);let n=new o.default(t);return s.pattern.isDynamicPattern(e,n)}e.isDynamicPattern=d;function f(e){return u(e),s.path.escape(e)}e.escapePath=f;function p(e){return u(e),s.path.convertPathToPattern(e)}e.convertPathToPattern=p,(function(e){function t(e){return u(e),s.path.escapePosixPath(e)}e.escapePath=t;function n(e){return u(e),s.path.convertPosixPathToPattern(e)}e.convertPathToPattern=n})(e.posix||={}),(function(e){function t(e){return u(e),s.path.escapeWindowsPath(e)}e.escapePath=t;function n(e){return u(e),s.path.convertWindowsPathToPattern(e)}e.convertPathToPattern=n})(e.win32||={})})(c||={});function l(e,t,r){let i=[].concat(e),a=new o.default(r),s=n.generate(i,a),c=new t(a);return s.map(c.read,c)}function u(e){if(![].concat(e).every(e=>s.string.isString(e)&&!s.string.isEmpty(e)))throw TypeError(`Patterns must be a string (non empty) or an array of strings`)}t.exports=c}))();function Ue(e){return e.charCodeAt(0)===65279}function We(e){let t=e.indexOf(`\r
22
+ `),n=e.indexOf(`
23
+ `);return t!==-1&&(n===-1||t<n)?`\r
24
+ `:`
25
+ `}function Ge(e){if(e===``)return e;let t=Ue(e),n=t?e.slice(1):e;We(n);let r=n.replace(/^[ \t]+$/gm,``);return t?`\uFEFF${r}`:r}function Ke(){return{clean:Ge}}const qe=/^[\w./-]+$/;function Je(e){let t=[],n=e.split(/\r?\n/),r=!1,i=``,a=``,o=0,s=[];for(let e=0;e<n.length;e++){let c=n[e],l=e+1,u=c.match(/^(```|~~~)([\w-]*)$/);if(u&&!r){r=!0,i=u[1],a=u[2]??``,o=l,s=[];continue}if(r){if(RegExp(`^${i}\\s*$`).test(c)){t.push({language:a,content:s.join(`
26
+ `),startLine:o,endLine:l,fence:i}),r=!1,i=``,a=``,o=0,s=[];continue}s.push(c)}}return t}function Ye(e,t){let n;try{n=JSON.parse(e)}catch{return e}return X(n,0)}function X(e,t){let n=` `.repeat(t),r=` `.repeat(t+1);if(e==null)return`null`;if(typeof e==`boolean`||typeof e==`number`)return String(e);if(typeof e==`string`)return qe.test(e)&&e.length>0?e:JSON.stringify(e);if(Array.isArray(e)){if(e.length===0)return`[]`;if(e.every(e=>typeof e!=`object`||!e)&&e.length<=5)return`[${e.map(e=>X(e,0)).join(` `)}]`;let i=[`[`];for(let n of e){let e=X(n,t+1);i.push(`${r}- ${e}`)}return i.push(`${n}]`),i.join(`
27
+ `)}if(typeof e==`object`){let i=e,a=Object.keys(i);if(a.length===0)return`{}`;let o=[`{`];for(let e of a){let n=X(i[e],t+1);if(typeof i[e]==`object`&&i[e]!==null){o.push(`${r}${e}:`);let t=n.split(`
28
+ `).map((e,t)=>t===0?`${r} ${e}`:e).join(`
29
+ `);o.push(t)}else o.push(`${r}${e}: ${n}`)}return o.push(`${n}}`),o.join(`
30
+ `)}return String(e)}function Xe(e,t){if(t.length===0)return e;let n=e.split(/\r?\n/),r=[],i=[...t].sort((e,t)=>t.startLine-e.startLine),a=[],o=!1,s=0,c=``;for(let e=0;e<n.length;e++){let t=n[e],r=e+1,l=t.match(/^(```|~~~)[\w-]*$/);if(l&&!o){o=!0,s=r,c=l[1];continue}if(o&&RegExp(`^${c}\\s*$`).test(t)){let e=i.find(e=>e.startLine===s&&e.endLine===r);e&&a.push({start:s,end:r,block:e}),o=!1,c=``}}let l=1;for(let e of a.sort((e,t)=>e.start-t.start)){for(;l<e.start;)r.push(n[l-1]),l++;r.push(`${e.block.fence}${e.block.language}`),r.push(e.block.content),r.push(e.block.fence),l=e.end+1}for(;l<=n.length;)r.push(n[l-1]),l++;return r.join(`
31
+ `)}function Ze(){return{extract:Je,transformJson:Ye,reassemble:Xe}}function Qe(e,t){if(t===``)return e;let{frontMatter:n,body:i}=r(e),a=t.endsWith(`
32
+ `)?t:`${t}\n`,o=i.startsWith(`
33
+ `)?i:`\n${i}`;return Object.keys(n).length===0?a+i:c(n,a+o.slice(1))}function $e(e,t){return t===``?e:e+(e.length>0&&!e.endsWith(`
34
+ `)?`
35
+ `:``)+t}function et(){return{prepend:Qe,append:$e}}function tt(){let e=[],t=[];return{record(t){e.push(t)},getStats(){let t=0,n=0,r=0,i=0,a=0,o=0;for(let s of e)switch(s.type){case`create`:t++;break;case`modify`:n++;break;case`delete`:r++;break;case`copy`:o++;break;case`symlink`:case`ensureSymlink`:t++;break;case`ensureDir`:i++;break;case`cleanDir`:a++;break}return{filesToCreate:t,filesToModify:n,filesToDelete:r,directoriesToCreate:i,directoriesToClean:a,copyOperations:o,operations:[...e]}},reset(){e.length=0,t.length=0},isSuccess(){return t.length===0},recordError(e){t.push(e)},getErrors(){return[...t]}}}function Z(e,t,n){let r={type:e,path:t,timestamp:Date.now()};return n!=null&&(r.sourcePath=n),r}var nt=class extends Error{pluginId;key;constructor(e,t){super(`Required data not found: plugin="${e}", key="${t}"`),this.name=`RegistryDataNotFoundError`,this.pluginId=e,this.key=t}},rt=class{storage=new Map;set(e,t,n){let r=this.storage.get(e);r||(r=new Map,this.storage.set(e,r)),r.set(t,n)}get(e,t){let n=this.storage.get(e);if(!n)return;let r=n.get(t);if(r!==void 0)return this.deepFreeze(structuredClone(r))}has(e,t){let n=this.storage.get(e);return n?n.has(t):!1}getRequired(e,t){let n=this.get(e,t);if(n===void 0)throw new nt(e,t);return n}deepFreeze(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e)){for(let t of e)this.deepFreeze(t);return Object.freeze(e)}let t=Object.getOwnPropertyNames(e);for(let n of t){let t=e[n];typeof t==`object`&&t&&this.deepFreeze(t)}return Object.freeze(e)}};function it(){return new rt}var at=class{config;patternMatchers;constructor(e){this.config=e,this.patternMatchers=new Map;for(let t of e.inputClassification.rules)for(let e of t.patterns){let n=`${t.type}:${e}`,r=h(e);this.patternMatchers.set(n,r)}}classifyBundle(e){if(e.type!=null&&e.type!==i.CONFIG_FILE)return e;let t=this.classifyByRules(e);return{...e,type:t.type}}classifyBundles(e){return e.map(e=>this.classifyBundle(e))}getFrontMatter(e,t){return t.frontMatter?t.frontMatter:this.generateFrontMatter(e,t)}matchesType(e,t){let n=this.config.inputClassification.rules.filter(e=>e.type===t);for(let t of n)for(let n of t.patterns){let r=`${t.type}:${n}`,i=this.patternMatchers.get(r);if(i&&i(e))return!0}return!1}getExcludePatterns(){let e=[];for(let t of this.config.inputClassification.rules)for(let n of t.patterns)n.startsWith(`!`)&&e.push(n.slice(1));return e}classifyByRules(e){let t=[...this.config.inputClassification.rules].sort((e,t)=>(t.priority??0)-(e.priority??0));if(e.frontMatter!=null){let t=this.classifyByFrontMatter(e.frontMatter);if(t!=null)return{type:t}}for(let n of t)for(let t of n.patterns){if(t.startsWith(`!`))continue;let r=`${n.type}:${t}`,i=this.patternMatchers.get(r);if(i&&i(e.path))return{type:n.type,rule:n}}return{type:this.config.inputClassification.defaultType}}classifyByFrontMatter(e){if(typeof e.type==`string`)switch(e.type.toLowerCase()){case`memory-prompt`:return i.MEMORY_PROMPT;case`global-prompt`:case`globalprompt`:return i.GLOBAL_PROMPT;case`sub-agent`:case`subagent`:return i.SUB_AGENT;case`fast-command`:case`fastcommand`:return i.FAST_COMMAND;case`skill`:return i.SKILL;case`config`:case`config-file`:return i.CONFIG_FILE}if(e.agents!=null)return i.SUB_AGENT;if(e.command!=null)return i.FAST_COMMAND;if(e.skill!=null)return i.SKILL}generateFrontMatter(e,t){let n={};switch(e){case i.MEMORY_PROMPT:n.type=`memory-prompt`;break;case i.GLOBAL_PROMPT:n.type=`global-prompt`;break;case i.SUB_AGENT:{n.type=`sub-agent`;let e=this.extractNameFromPath(t.path,`agents`);e!=null&&(n.name=e);break}case i.FAST_COMMAND:{n.type=`fast-command`;let e=this.extractNameFromPath(t.path,`commands`);e!=null&&(n.command=e);break}case i.SKILL:{n.type=`skill`;let e=this.extractNameFromPath(t.path,`skills`);e!=null&&(n.skill=e);break}case i.CONFIG_FILE:break}return t.sourceProject!=null&&(n.source=t.sourceProject),n.path=t.path,n}extractNameFromPath(e,t){let n=e.split(`/`),r=n.findIndex(e=>e===t);if(r!==-1&&r+1<n.length){let e=n[r+1];if(e!=null)return e.replace(/\.[^.]*$/,``)}}};function ot(){return{debug:(e,...t)=>{d.debug(e,{args:t})},info:(e,...t)=>{d.info(e,{args:t})},warn:(e,...t)=>{d.warn(e,{args:t})},error:(e,...t)=>{d.error(e,{args:t})}}}function st(e){let{dryRun:t,dryRunTracker:n}=e;return{readFile:async e=>g.readFile(e,`utf-8`),writeFile:async(e,r)=>{if(t){let t=await g.pathExists(e)?`modify`:`create`;d.info(`[dry-run] Would ${t} file: ${e}`),n?.record(Z(t,e));return}await g.ensureDir(m.dirname(e)),await g.writeFile(e,r,`utf-8`)},exists:async e=>g.pathExists(e),ensureDir:async e=>{if(t){await g.pathExists(e)||(d.info(`[dry-run] Would create directory: ${e}`),n?.record(Z(`ensureDir`,e)));return}await g.ensureDir(e)},copy:async(e,r)=>{if(t){d.info(`[dry-run] Would copy: ${e} -> ${r}`),n?.record(Z(`copy`,r,e));return}await g.ensureDir(m.dirname(r)),await g.copy(e,r)},remove:async e=>{if(t){await g.pathExists(e)&&(d.info(`[dry-run] Would delete: ${e}`),n?.record(Z(`delete`,e)));return}await g.remove(e)},cleanDir:async e=>{if(t){await g.pathExists(e)&&(d.info(`[dry-run] Would clean directory: ${e}`),n?.record(Z(`cleanDir`,e)));return}await g.emptyDir(e)},stat:async e=>{let t=await g.stat(e);return{isDirectory:()=>t.isDirectory(),isFile:()=>t.isFile(),size:t.size,mtime:t.mtime}},readdir:async(e,t)=>t?.withFileTypes?g.readdirSync(e,{withFileTypes:!0}).map(e=>({name:e.name,isDirectory:()=>e.isDirectory()})):await g.readdir(e),async readJson(e){return await g.readJson(e)},async lstat(e){let t=await g.lstat(e);return{isSymbolicLink:()=>t.isSymbolicLink(),isDirectory:()=>t.isDirectory(),isFile:()=>t.isFile()}},async readlink(e){return g.readlink(e)},async symlink(t,n,r){if(e.dryRun){e.dryRunTracker?.record(Z(`symlink`,n,t)),d.info(`[DryRun] Would create symlink: ${n} -> ${t} (type: ${r})`);return}await g.symlink(t,n,r)},async ensureSymlink(t,n){if(e.dryRun){e.dryRunTracker?.record(Z(`ensureSymlink`,n,t)),d.info(`[DryRun] Would ensure symlink: ${n} -> ${t}`);return}await g.ensureSymlink(t,n)}}}function ct(){return{match:async(e,t)=>await(0,He.glob)(e,t)}}function lt(e){let t=a.fromPath(e);return{root:e,dist:t.dist(),ref:t.ref(),userHome:p.homedir(),resolve:(...t)=>m.join(e,...t)}}function ut(e={}){let t=p.homedir();return{workspaceGroup:n=>{let r=e[n];return r!==``&&r!==void 0?r:m.join(t,`project`,n)},workspace:(n,r)=>{let i=e[n]??m.join(t,`project`,n);return m.join(i,r)},globalConfig:e=>m.join(t,`.${e}`)}}function dt(e=!1,t=!1){let n={dryRun:e,cleanOnly:t};return e&&(n.dryRunTracker=tt()),n}function ft(){return{frontMatter:s(),blankLineCleaner:Ke(),contentInjection:et(),codeBlockTransform:Ze(),markdown:l()}}const pt=a.forProject(`aindex`).root();function Q(e){let{root:t=pt,config:n,systemConfig:r,dryRun:i=!1,cleanOnly:a=!1,workspaceGroups:o={}}=e,s=[],c=[],l={},u=dt(i,a),d=lt(t),f=ut(o),p={fs:st(u),paths:d,glob:ct(),targets:f,path:{...m,resolve:(...e)=>m.resolve(...e)},log:ot(),config:n,mode:u,meta:l,capabilities:ft(),registry:it(),getInputBundles:e=>c.filter(t=>t.type===e),getAllInputBundles:()=>[...c],emitFile:e=>(s.push(e),e.fileName),getEmittedFiles:()=>[...s],resolveOutputPaths:e=>{let t={};for(let n of e){let e=w(n.path);n.targetType===`workspace`?t.workspacePath=d.resolve(e):n.targetType===`globalConfig`&&(t.globalConfigPath=m.join(d.userHome,e))}return t}};if(r){let e=p;return e.systemConfig=r,e.classificationService=new at(r),e}return p}function mt(e,t){let{root:n=pt,config:r,dryRun:i=!1,cleanOnly:a=!1,workspaceGroups:o={}}=e,s=[],c=t.inputBundles??[],l={},u=t.mode??dt(i,a),d=t.paths??lt(n),f=t.targets??ut(o);return{fs:t.fs??st(u),paths:d,glob:ct(),targets:f,path:{...m,resolve:(...e)=>m.resolve(...e)},log:t.log??ot(),config:r,mode:u,meta:l,capabilities:t.capabilities??ft(),registry:t.registry??it(),getInputBundles:e=>c.filter(t=>t.type===e),getAllInputBundles:()=>[...c],emitFile:e=>(s.push(e),e.fileName),getEmittedFiles:()=>[...s],resolveOutputPaths:e=>{let t={};for(let n of e)n.targetType===`workspace`?t.workspacePath=d.resolve(n.path):n.targetType===`globalConfig`&&(t.globalConfigPath=m.join(d.userHome,n.path));return t}}}function ht(e){if(typeof e!=`object`||!e)throw new u(`Plugin must be a non-null object`,`plugin`);let t=e;if(!(`name`in t))throw new u(`Plugin must have a name property`,`name`);if(typeof t.name!=`string`)throw new u(`Plugin name must be a string`,`name`);if(t.name.trim().length===0)throw new u(`Plugin name cannot be empty or whitespace only`,`name`);let n=t.priority;if(n!=null&&typeof n!=`number`)throw new u(`Plugin priority must be a number`,`priority`);let r=t.dependencies;if(r!=null){if(!Array.isArray(r))throw new u(`Plugin dependencies must be an array`,`dependencies`);for(let e of r)if(typeof e!=`string`)throw new u(`Plugin dependency names must be strings`,`dependencies`)}}function gt(e){ht(e);let t=e,n=t.extends;if(n!=null&&typeof n!=`string`)throw new u(`Plugin extends must be a string`,`extends`);let r=t.inputTypes;if(r!=null){if(!Array.isArray(r))throw new u(`Plugin inputTypes must be an array`,`inputTypes`);let e=Object.values(i);for(let t of r)if(!e.includes(t))throw new u(`Invalid inputType: ${String(t)}. Must be one of: ${e.join(`, `)}`,`inputTypes`)}let a=t.outputs;if(a!=null){if(!Array.isArray(a))throw new u(`Plugin outputs must be an array`,`outputs`);for(let e=0;e<a.length;e++){let t=a[e];if(typeof t!=`object`||!t)throw new u(`Plugin output at index ${e} must be an object`,`outputs`);if(typeof t.id!=`string`||t.id.trim().length===0)throw new u(`Plugin output at index ${e} must have a non-empty id`,`outputs`);let n=[`cli`,`ide`,`config`];if(!n.includes(t.category))throw new u(`Plugin output at index ${e} has invalid category. Must be one of: ${n.join(`, `)}`,`outputs`);if(typeof t.tool!=`string`||t.tool.trim().length===0)throw new u(`Plugin output at index ${e} must have a non-empty tool`,`outputs`);let r=[`workspaceGroup`,`workspace`,`globalConfig`];if(!r.includes(t.targetType))throw new u(`Plugin output at index ${e} has invalid targetType. Must be one of: ${r.join(`, `)}`,`outputs`);if(typeof t.path!=`string`)throw new u(`Plugin output at index ${e} must have a path string`,`outputs`)}}let o=t.filenameTransform;if(o!=null){if(!Array.isArray(o))throw new u(`Plugin filenameTransform must be an array`,`filenameTransform`);for(let e=0;e<o.length;e++){let t=o[e];if(typeof t!=`object`||!t)throw new u(`Filename transform rule at index ${e} must be an object`,`filenameTransform`);let n=t.pattern;if(!(n instanceof RegExp)&&typeof n!=`string`)throw new u(`Filename transform rule at index ${e} must have a pattern (RegExp or string)`,`filenameTransform`);let r=t.replacement;if(typeof r!=`string`&&typeof r!=`function`)throw new u(`Filename transform rule at index ${e} must have a replacement (string or function)`,`filenameTransform`);let i=t.tools;if(i!=null){if(!Array.isArray(i))throw new u(`Filename transform rule at index ${e} tools must be an array`,`filenameTransform`);for(let t of i)if(typeof t!=`string`)throw new u(`Filename transform rule at index ${e} tool names must be strings`,`filenameTransform`)}}}}var _t=class extends Error{pluginName;dependencyChain;constructor(e,t){super(`Circular dependency detected: ${t.join(` -> `)} -> ${e}`),this.name=`CircularDependencyError`,this.pluginName=e,this.dependencyChain=t}},vt=class extends Error{pluginName;inheritanceChain;constructor(e,t){super(`Circular inheritance detected: ${t.join(` -> `)} -> ${e}`),this.name=`CircularInheritanceError`,this.pluginName=e,this.inheritanceChain=t}},$=class e{inputPlugins=[];outputPlugins=[];plugins=[];pluginStates=new Map;context;config;collectedInputBundles=[];resolvedOutputPlugins=new Map;constructor(e){if(`config`in e){let t=e;this.config=t.config,this.context=Q({config:t.config,dryRun:t.dryRun??!1,cleanOnly:t.cleanOnly??!1})}else this.config=e,this.context=Q({config:e})}static async bootstrap(t={}){let n=Date.now(),r,i=[],a=[];if(t.config!=null)r=t.config;else{let e=await import(`./plugins.config-BWHDEGjS.mjs`);r=e.default,i=e.inputPlugins??[],a=e.outputPlugins??[]}let o=x(t,r),s=new e({config:{...r,options:o},dryRun:o.dryRun??!1,cleanOnly:o.cleanOnly??!1});for(let e of i)try{s.registerInput(e)}catch(t){let n=t instanceof Error?t.message:String(t);s.context.log.error(`Failed to register InputPlugin "${e.name}": ${n}`)}for(let e of a)try{s.registerOutput(e)}catch(t){let n=t instanceof Error?t.message:String(t);s.context.log.error(`Failed to register OutputPlugin "${e.name}": ${n}`)}for(let e of r.plugins)try{let t=typeof e==`function`?e():e;s.register(t)}catch(e){let t=e instanceof Error?e.message:String(e);s.context.log.error(`Failed to register plugin: ${t}`)}let c,l=s.getPlugins().length>0,u=s.getInputPlugins().length>0||s.getOutputPlugins().length>0;if(o.cleanOnly===!0){let e=await s.runClean();c={success:e.success,duration:Date.now()-n,pluginsExecuted:s.getOutputPlugins().length,inputPluginsExecuted:0,outputPluginsExecuted:s.getOutputPlugins().length,inputBundlesCollected:0,filesEmitted:0,errors:e.errors,emptyPlugins:[],cleanResult:e}}else if(u){let e=await s.runFull(),t=null;l&&(t=await s.run());let r=[...e.errors];t!=null&&r.push(...t.errors),c={success:e.success&&(t?.success??!0),duration:Date.now()-n,pluginsExecuted:e.pluginsExecuted+(t?.pluginsExecuted??0),inputPluginsExecuted:e.inputPluginsExecuted,outputPluginsExecuted:e.outputPluginsExecuted+(t?.pluginsExecuted??0),inputBundlesCollected:e.inputBundlesCollected,filesEmitted:e.filesEmitted+(t?.filesEmitted??0),errors:r,emptyPlugins:e.emptyPlugins},o.dryRun===!0&&e.dryRunStats!=null&&(c.dryRunStats=e.dryRunStats)}else if(l){let e=await s.run();c={success:e.success,duration:Date.now()-n,pluginsExecuted:e.pluginsExecuted,inputPluginsExecuted:0,outputPluginsExecuted:e.pluginsExecuted,inputBundlesCollected:0,filesEmitted:e.filesEmitted,errors:e.errors,emptyPlugins:[]},o.dryRun===!0&&s.context.mode.dryRunTracker!=null&&(c.dryRunStats=s.context.mode.dryRunTracker.getStats())}else c={success:!0,duration:Date.now()-n,pluginsExecuted:0,inputPluginsExecuted:0,outputPluginsExecuted:0,inputBundlesCollected:0,filesEmitted:0,errors:[],emptyPlugins:[]},o.dryRun===!0&&s.context.mode.dryRunTracker!=null&&(c.dryRunStats=s.context.mode.dryRunTracker.getStats());return c}static async main(n){let r=await import(`./dist-Dmqu6eEt.mjs`),i=(await import(`./picocolors-cXP5_ufZ.mjs`).then(t(1))).default,{shutdownLogger:a}=await import(`./log-ck-k4XJ5.mjs`),{intro:o,outro:s,spinner:c}=r,l={dryRun:!1,clean:!1},u=[];for(let e of n)switch(e){case`--dry-run`:case`-d`:l.dryRun=!0;break;case`--clean`:case`-c`:l.clean=!0;break;default:e.startsWith(`-`)&&u.push(e);break}if(u.length>0){console.error(i.red(`Error: Invalid flag(s): ${u.join(`, `)}`)),f.exitCode=1;return}let d=l.clean?l.dryRun?`Clean (dry-run)`:`Clean`:l.dryRun?`Dry-run`:`Normal`;o(i.bgCyan(i.black(` aindex toolchain - ${d} mode `)));let p=c();try{p.start(`Bootstrapping plugin system...`);let t=await e.bootstrap({dryRun:l.dryRun,cleanOnly:l.clean});p.stop(t.success?`Bootstrap completed successfully`:`Bootstrap completed with errors`),e.displayResult(t,l.clean,i),t.success?s(i.green(l.clean?`Cleanup completed successfully!`:`All tasks completed successfully!`)):(s(i.yellow(`Completed with some errors`)),f.exitCode=1)}catch(e){p.stop(`Execution failed`),console.error(i.red(e instanceof Error?e.message:String(e))),f.exitCode=1}finally{await a()}}static displayResult(e,t,n){let r=e=>e<1e3?`${e}ms`:`${(e/1e3).toFixed(2)}s`;if(t)if(e.success){let t=e.cleanResult;t?console.info(n.green(`Cleanup complete: ${t.filesRemoved} file(s) removed, ${t.directoriesRemoved} director(ies) removed in ${r(e.duration)}`)):console.info(n.green(`Cleanup completed in ${r(e.duration)}`))}else{console.warn(n.yellow(`Cleanup completed with errors: ${e.errors.length} error(s) in ${r(e.duration)}`));for(let t of e.errors)console.error(n.red(` ${t}`))}else{if(e.success)console.info(n.green(`Completed: ${e.pluginsExecuted} plugin(s) executed, ${e.filesEmitted} file(s) emitted in ${r(e.duration)}`));else{console.warn(n.yellow(`Completed with errors: ${e.pluginsExecuted} plugin(s) executed, ${e.errors.length} error(s) in ${r(e.duration)}`));for(let t of e.errors)console.error(n.red(` ${t}`))}if(e.dryRunStats){let t=e.dryRunStats;console.info(n.cyan(`[dry-run] Summary: ${t.filesToCreate} files to create, ${t.filesToModify} files to modify, ${t.filesToDelete} files to delete`))}}}registerInput(e){if(this.validateInputPlugin(e),this.inputPlugins.some(t=>t.name===e.name))throw new o(`InputPlugin "${e.name}" is already registered`,e.name,`registerInput`);this.inputPlugins.push(e),this.pluginStates.set(e.name,{name:e.name,status:`pending`,emittedFiles:[]})}registerOutput(e){if(gt(e),this.outputPlugins.some(t=>t.name===e.name))throw new o(`OutputPlugin "${e.name}" is already registered`,e.name,`registerOutput`);this.outputPlugins.push(e),this.pluginStates.set(e.name,{name:e.name,status:`pending`,emittedFiles:[]})}register(e){if(ht(e),this.plugins.some(t=>t.name===e.name))throw new o(`Plugin "${e.name}" is already registered`,e.name,`register`);this.plugins.push(e),this.pluginStates.set(e.name,{name:e.name,status:`pending`,emittedFiles:[]})}getPlugins(){return[...this.plugins]}getInputPlugins(){return[...this.inputPlugins]}getOutputPlugins(){return[...this.outputPlugins]}getPluginState(e){return this.pluginStates.get(e)}sortPlugins(e){let t=[],n=new Set,r=new Set,i=new Map;for(let t of e)i.set(t.name,t);let a=(e,o=[])=>{if(n.has(e.name))return;if(r.has(e.name))throw new _t(e.name,o);r.add(e.name);let s=[...o,e.name],c=e.dependencies;if(c!=null&&Array.isArray(c))for(let e of c){let t=i.get(e);t!=null&&a(t,s)}r.delete(e.name),n.add(e.name),t.push(e)},o=[...e].sort((e,t)=>(e.priority??100)-(t.priority??100));for(let e of o)a(e);return t}resolveInheritance(e){let t=this.resolvedOutputPlugins.get(e.name);if(t!=null)return t;if(e.extends==null)return this.resolvedOutputPlugins.set(e.name,e),e;let n=[],r=e;for(;r!=null;){let e=r.extends;if(e==null)break;if(n.includes(r.name))throw new vt(r.name,n);n.push(r.name);let t=this.outputPlugins.find(t=>t.name===e);if(t==null)break;r=t}let i=[e];for(r=e;r!=null;){let e=r.extends;if(e==null)break;let t=this.outputPlugins.find(t=>t.name===e);if(t==null)break;i.unshift(t),r=t}let a=i[0];if(a==null)return this.resolvedOutputPlugins.set(e.name,e),e;let o={...a};for(let e=1;e<i.length;e++){let t=i[e];t!=null&&(o=this.mergePlugins(o,t))}return this.resolvedOutputPlugins.set(e.name,o),o}mergePlugins(e,t){let n={...e,...t,name:t.name},r=e.outputs,i=t.outputs;i==null?r!=null&&(n.outputs=r):n.outputs=i;let a=e.inputTypes,o=t.inputTypes;o==null?a!=null&&(n.inputTypes=a):n.inputTypes=o;let s=e.filenameTransform,c=t.filenameTransform;c==null?s!=null&&(n.filenameTransform=s):n.filenameTransform=c;let l=e.dependencies,u=t.dependencies;if(l!=null||u!=null){let e=l??[],t=u??[];n.dependencies=[...new Set([...e,...t])]}return n}validateInputPlugin(e){if(typeof e!=`object`||!e)throw new u(`InputPlugin must be a non-null object`,`plugin`);let t=e;if(!(`name`in t))throw new u(`InputPlugin must have a name property`,`name`);if(typeof t.name!=`string`)throw new u(`InputPlugin name must be a string`,`name`);if(t.name.trim().length===0)throw new u(`InputPlugin name cannot be empty or whitespace only`,`name`);let n=t.priority;if(n!=null&&typeof n!=`number`)throw new u(`InputPlugin priority must be a number`,`priority`);if(!(`scan`in t)||typeof t.scan!=`function`)throw new u(`InputPlugin must have a scan method`,`scan`)}async run(){let e=Date.now(),t=[],n=0,r=new Set,i=this.sortPlugins(this.plugins),a=this.config.options?.onError??`continue`;for(let e of i){let i=this.pluginStates.get(e.name);if(i==null)continue;let o=e.dependencies;if(o!=null&&o.some(e=>r.has(e))){i.status=`skipped`;continue}i.status=`running`,i.startTime=Date.now();try{await this.runPluginLifecycle(e),i.status=`completed`,n++}catch(n){if(i.status=`failed`,i.error=n instanceof Error?n:Error(String(n)),r.add(e.name),t.push(`[${e.name}] ${i.error.message}`),a===`stop`)break}finally{i.endTime=Date.now()}}return{success:t.length===0,pluginsExecuted:n,filesEmitted:this.context.getEmittedFiles().length,errors:t,duration:Date.now()-e}}async runFull(){let e=Date.now(),t=[],n=[],r=new Set,i=0,a=this.config.options?.onError??`continue`,o=this.context.mode.cleanOnly?`clean`:this.context.mode.dryRun?`dryRun`:`normal`,s=(await this.runInputPhase(a,r,t)).executed;if(a===`stop`&&t.length>0){let r={success:!1,pluginsExecuted:s,inputPluginsExecuted:s,outputPluginsExecuted:0,inputBundlesCollected:this.collectedInputBundles.length,filesEmitted:0,errors:t,emptyPlugins:n,duration:Date.now()-e};return this.context.mode.dryRun&&this.context.mode.dryRunTracker!=null&&(r.dryRunStats=this.context.mode.dryRunTracker.getStats()),r}i=(await this.runOutputPhase(o,a,r,t,n)).executed;let c={success:t.length===0,pluginsExecuted:s+i,inputPluginsExecuted:s,outputPluginsExecuted:i,inputBundlesCollected:this.collectedInputBundles.length,filesEmitted:this.context.getEmittedFiles().length,errors:t,emptyPlugins:n,duration:Date.now()-e};if(this.context.mode.dryRun&&this.context.mode.dryRunTracker!=null){let e=this.context.mode.dryRunTracker.getStats();c.dryRunStats=e,this.context.log.info(`[dry-run] Summary: ${e.filesToCreate} files to create, ${e.filesToModify} files to modify, ${e.filesToDelete} files to delete`),e.directoriesToCreate>0&&this.context.log.info(`[dry-run] Directories: ${e.directoriesToCreate} to create, ${e.directoriesToClean} to clean`),e.copyOperations>0&&this.context.log.info(`[dry-run] Copy operations: ${e.copyOperations}`)}return c}async runClean(){let e=Date.now(),t=new T(this.context.fs,this.context.targets,this.context.log),n=t.collectTargets(this.outputPlugins);this.context.log.info(`Clean mode: collected ${n.length} targets from ${this.outputPlugins.length} plugins`);let r=await t.clean(n,this.context.mode.dryRun);for(let[e,t]of Object.entries(r.targetsByPlugin)){let n=t.length;this.context.mode.dryRun?this.context.log.info(`[dry-run] Plugin "${e}": would remove ${n} targets`):this.context.log.info(`Plugin "${e}": removed ${n} targets`)}return this.context.mode.dryRun?this.context.log.info(`[dry-run] Clean complete: would remove ${r.filesRemoved} files, ${r.directoriesRemoved} directories`):this.context.log.info(`Clean complete: removed ${r.filesRemoved} files, ${r.directoriesRemoved} directories`),{...r,duration:Date.now()-e}}async runInputPhase(e,t,n){let r=0,i=this.sortPlugins(this.inputPlugins);for(let a of i){let i=this.pluginStates.get(a.name);if(i!=null){i.status=`running`,i.startTime=Date.now();try{let e=await a.scan(this.context);this.collectedInputBundles.push(...e),i.status=`completed`,r++,this.context.log.debug(`InputPlugin "${a.name}" collected ${e.length} bundles`)}catch(r){if(i.status=`failed`,i.error=r instanceof Error?r:Error(String(r)),t.add(a.name),n.push(`[${a.name}:scan] ${i.error.message}`),e===`stop`)break}finally{i.endTime=Date.now()}}}return this.updateContextWithBundles(),{executed:r}}async runOutputPhase(e,t,n,r,i){let a=0,o=this.sortPlugins(this.outputPlugins).map(e=>this.resolveInheritance(e));for(let s of o){let o=this.pluginStates.get(s.name);if(o==null)continue;let c=s.dependencies;if(c!=null&&c.some(e=>n.has(e))){o.status=`skipped`,this.context.log.warn(`Skipping plugin "${s.name}" due to failed dependency`);continue}o.status=`running`,o.startTime=Date.now();let l=this.context.getEmittedFiles().length;try{await this.runOutputPluginLifecycle(s,e),o.status=`completed`,a++,this.context.getEmittedFiles().length===l&&(this.warnEmptyPlugin(s.name),i.push(s.name))}catch(e){o.status=`failed`,o.error=e instanceof Error?e:Error(String(e)),n.add(s.name);let i=e.hookName??`unknown`;if(r.push(`[${s.name}:${i}] ${o.error.message}`),t===`stop`)break}finally{o.endTime=Date.now()}}return{executed:a}}async runOutputPluginLifecycle(e,t){let n=this.outputPlugins.map(e=>e.name),r=this.context.getEmittedFiles(),i=this.getCleanupTargets(e);await this.runOutputHook(e,`beforeCleanup`,{targets:i,dryRun:this.context.mode.dryRun}),await this.runOutputHook(e,`buildStart`,{plugins:n,mode:t}),await this.runOutputHook(e,`generateBundle`,{emittedFiles:r});let a=this.getOutputDir(e);await this.runOutputHook(e,`writeBundle`,{outputDir:a,files:this.context.getEmittedFiles()}),await this.runOutputHook(e,`afterCleanup`,{targets:i,dryRun:this.context.mode.dryRun}),await this.runOutputHook(e,`buildEnd`,{success:!0,errors:[]})}async runOutputHook(e,t,n){let r=e[t];if(typeof r==`function`)try{await r(this.context,n)}catch(n){let r=n instanceof Error?n:Error(String(n));throw new o(`Hook "${String(t)}" failed: ${r.message}`,e.name,String(t),r)}}getCleanupTargets(e){let t=e.outputs;return t==null?[]:t.filter(e=>e.enabled!==!1).map(e=>e.path)}getOutputDir(e){let t=e.outputs;return t==null||t.length===0?this.context.paths.dist:t[0]?.path??this.context.paths.dist}updateContextWithBundles(){let e=this.collectedInputBundles;this.context=mt({config:this.config,dryRun:this.context.mode.dryRun,cleanOnly:this.context.mode.cleanOnly},{fs:this.context.fs,paths:this.context.paths,targets:this.context.targets,log:this.context.log,mode:this.context.mode,capabilities:this.context.capabilities,inputBundles:e,registry:this.context.registry})}warnEmptyPlugin(e){this.context.log.warn(`Plugin "${e}" produced no output`)}async runPluginLifecycle(e){await this.runHook(e,`buildStart`),await this.runHook(e,`generateBundle`),await this.runHook(e,`writeBundle`),await this.runHook(e,`buildEnd`)}async runHook(e,t){let n=e[t];if(typeof n==`function`)try{await n(this.context)}catch(n){let r=n instanceof Error?n:Error(String(n));throw new o(`Hook "${String(t)}" failed: ${r.message}`,e.name,String(t),r)}}lastTransformSummary=null;async runTransform(e,t){let n=e,r=e,i=!1,a=[],s=[],c=this.sortPlugins(this.plugins);for(let e of c){let c=e.transform;if(c!=null)try{let n=await c(r,t,this.context,{sourceMap:!1});if(n!=null){let t=r;r=n.code,i=!0,a.push({pluginName:e.name,inputLength:t.length,outputLength:n.code.length,changed:t!==n.code})}}catch(t){let i=t instanceof Error?t:Error(String(t));if(s.push({pluginName:e.name,message:i.message,error:i}),this.context.log.error(`Transform failed in plugin "${e.name}": ${i.message}`),(this.config.options?.onError??`continue`)===`stop`)throw this.lastTransformSummary={originalLength:n.length,finalLength:r.length,transformations:a,errors:s,success:!1},new o(`Transform failed: ${i.message}`,e.name,`transform`,i)}}return this.lastTransformSummary={originalLength:n.length,finalLength:r.length,transformations:a,errors:s,success:s.length===0},i?{code:r}:null}getTransformSummary(){return this.lastTransformSummary}getContext(){return this.context}};function yt(e){let t={dryRun:!1,clean:!1},n=[];for(let r of e)switch(r){case`--dry-run`:case`-d`:t.dryRun=!0;break;case`--clean`:case`-c`:t.clean=!0;break;default:r.startsWith(`-`)&&n.push(r);break}return{flags:t,invalidFlags:n}}$.main(f.argv.slice(2));export{$ as PluginRunner,yt as parseArgs};
@@ -0,0 +1 @@
1
+ import{t as e}from"./logger-CST5WaQ3.mjs";let t=null,n=!1;new class{id;constructor(e){this.id=e}formatMessage(e,...t){let n=e;return t.forEach(e=>{n=n.replace(`{}`,String(e))}),n.trim()}canLog(){return!n}trace(t,...n){this.canLog()&&e.log(`trace`,this.formatMessage(t,...n),{id:this.id})}debug(t,...n){this.canLog()&&e.log(`debug`,this.formatMessage(t,...n),{id:this.id})}info(t,...n){this.canLog()&&e.log(`info`,this.formatMessage(t,...n),{id:this.id})}warn(t,...n){this.canLog()&&e.log(`warn`,this.formatMessage(t,...n),{id:this.id})}error(t,...n){this.canLog()&&e.log(`error`,this.formatMessage(t,...n),{id:this.id})}}(`default`);async function r(){if(!n){if(t!=null){await t;return}t=(async()=>{try{n=!0,await new Promise(e=>{setTimeout(e,100)}),await new Promise((t,n)=>{let r=setTimeout(()=>{n(Error(`Logger shutdown timeout`))},5e3);e.on(`finish`,()=>{clearTimeout(r),t()}),e.end()})}catch{n=!0}})(),await t}}export{r as shutdownLogger};
@@ -0,0 +1 @@
1
+ import e from"node:process";import t from"winston";const n={error:0,warn:1,fatal:2,info:3,debug:4,trace:5};function r(){return e.env.NODE_ENV===`test`||e.env.VITEST===`true`||e.env.JEST_WORKER_ID!=null}function i(){let t=e.env.DEBUG===`true`||e.env.DEBUG===`1`,n=e.argv.includes(`--debug`);return t||n}function a(){return r()?!i():!1}const o=t.format(e=>{let{timestamp:t,level:n,message:r,stack:i,...a}=e,o={...a},s={ts:typeof t==`string`?Number.isNaN(Date.parse(t))?Date.now():new Date(t).valueOf():Date.now(),lvl:n,msg:typeof r==`string`?r:JSON.stringify(r)},c=o.id;typeof c==`string`&&c.length>0&&(s.id=c,delete o.id),typeof i==`string`&&i.length>0&&(s.stack=i);let l=Object.entries(o);return l.length>0&&(s.meta=Object.fromEntries(l)),e[Symbol.for(`message`)]=JSON.stringify(s),e});var s=t.createLogger({levels:n,level:`trace`,format:t.format.combine(t.format.timestamp(),t.format.errors({stack:!0}),o()),transports:[new t.transports.Console({level:`trace`})],silent:a(),exitOnError:!1});export{s as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./chunk-YV1pC1vC.mjs";var t=e(((e,t)=>{let n=process||{},r=n.argv||[],i=n.env||{},a=!(i.NO_COLOR||r.includes(`--no-color`))&&(!!i.FORCE_COLOR||r.includes(`--color`)||n.platform===`win32`||(n.stdout||{}).isTTY&&i.TERM!==`dumb`||!!i.CI),o=(e,t,n=e)=>r=>{let i=``+r,a=i.indexOf(t,e.length);return~a?e+s(i,t,n,a)+t:e+i+t},s=(e,t,n,r)=>{let i=``,a=0;do i+=e.substring(a,r)+n,a=r+t.length,r=e.indexOf(t,a);while(~r);return i+e.substring(a)},c=(e=a)=>{let t=e?o:()=>String;return{isColorSupported:e,reset:t(`\x1B[0m`,`\x1B[0m`),bold:t(`\x1B[1m`,`\x1B[22m`,`\x1B[22m\x1B[1m`),dim:t(`\x1B[2m`,`\x1B[22m`,`\x1B[22m\x1B[2m`),italic:t(`\x1B[3m`,`\x1B[23m`),underline:t(`\x1B[4m`,`\x1B[24m`),inverse:t(`\x1B[7m`,`\x1B[27m`),hidden:t(`\x1B[8m`,`\x1B[28m`),strikethrough:t(`\x1B[9m`,`\x1B[29m`),black:t(`\x1B[30m`,`\x1B[39m`),red:t(`\x1B[31m`,`\x1B[39m`),green:t(`\x1B[32m`,`\x1B[39m`),yellow:t(`\x1B[33m`,`\x1B[39m`),blue:t(`\x1B[34m`,`\x1B[39m`),magenta:t(`\x1B[35m`,`\x1B[39m`),cyan:t(`\x1B[36m`,`\x1B[39m`),white:t(`\x1B[37m`,`\x1B[39m`),gray:t(`\x1B[90m`,`\x1B[39m`),bgBlack:t(`\x1B[40m`,`\x1B[49m`),bgRed:t(`\x1B[41m`,`\x1B[49m`),bgGreen:t(`\x1B[42m`,`\x1B[49m`),bgYellow:t(`\x1B[43m`,`\x1B[49m`),bgBlue:t(`\x1B[44m`,`\x1B[49m`),bgMagenta:t(`\x1B[45m`,`\x1B[49m`),bgCyan:t(`\x1B[46m`,`\x1B[49m`),bgWhite:t(`\x1B[47m`,`\x1B[49m`),blackBright:t(`\x1B[90m`,`\x1B[39m`),redBright:t(`\x1B[91m`,`\x1B[39m`),greenBright:t(`\x1B[92m`,`\x1B[39m`),yellowBright:t(`\x1B[93m`,`\x1B[39m`),blueBright:t(`\x1B[94m`,`\x1B[39m`),magentaBright:t(`\x1B[95m`,`\x1B[39m`),cyanBright:t(`\x1B[96m`,`\x1B[39m`),whiteBright:t(`\x1B[97m`,`\x1B[39m`),bgBlackBright:t(`\x1B[100m`,`\x1B[49m`),bgRedBright:t(`\x1B[101m`,`\x1B[49m`),bgGreenBright:t(`\x1B[102m`,`\x1B[49m`),bgYellowBright:t(`\x1B[103m`,`\x1B[49m`),bgBlueBright:t(`\x1B[104m`,`\x1B[49m`),bgMagentaBright:t(`\x1B[105m`,`\x1B[49m`),bgCyanBright:t(`\x1B[106m`,`\x1B[49m`),bgWhiteBright:t(`\x1B[107m`,`\x1B[49m`)}};t.exports=c(),t.exports.createColors=c}));export default t();export{t};
@@ -0,0 +1 @@
1
+ import{c as e,d as t,f as n,i as r,s as i,t as a}from"./frontMatter-Xmvgjkyh.mjs";import o from"node:os";import s from"node:path";import c from"picomatch";import l from"fs-extra";const u=[{id:`workspace-root`,category:`ide`,tool:`agents`,targetType:`workspace`,path:``,enabled:!0}];function d(t,n=`AGENTS.md`){let r={type:`asset`,fileName:n,source:t.content,targetType:`workspace`,inputType:e.MEMORY_PROMPT};return t.frontMatter&&(r.frontMatter=t.frontMatter),r}function f(e,t){let n=t.path.dirname(e.path);return n===`.`?``:n}function p(t={}){let{cleanTarget:n=!1,outputFilename:r=`AGENTS.md`,emitFiles:i=!0}=t,a=[];return{name:`agentsMd`,priority:100,inputTypes:[e.MEMORY_PROMPT],outputs:u,buildStart(e,t){a=[],e.log.debug(`AgentsMdPlugin: Starting build`)},async generateBundle(t,n){let o=t.getInputBundles(e.MEMORY_PROMPT);if(o.length===0){t.log.debug(`AgentsMdPlugin: No MemoryPrompt bundles found`);return}t.log.debug(`AgentsMdPlugin: Processing ${o.length} MemoryPrompt bundle(s)`);for(let e of o){let n=d(e,r);i&&t.emitFile(n),a.push(e)}t.registry.set(`agentsMd`,`processedBundles`,a),t.registry.set(`agentsMd`,`outputFilename`,r)},async writeBundle(t,o){if(!i){t.log.debug(`AgentsMdPlugin: File emission disabled`);return}let{files:s}=o,c=s.filter(t=>t.inputType===e.MEMORY_PROMPT&&t.fileName===r);if(c.length===0){t.log.debug(`AgentsMdPlugin: No files to write`);return}n&&t.log.debug(`AgentsMdPlugin: Cleaning target directories`);let l=0;for(let e of c)try{let n=a.find(t=>t.content===e.source);if(n){let r=f(n,t),i=r?t.paths.resolve(r,e.fileName):t.paths.resolve(e.fileName),a=t.path.dirname(i);await t.fs.ensureDir(a),await t.fs.writeFile(i,e.source),l++,t.log.debug(`AgentsMdPlugin: Wrote ${i}`)}}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`AgentsMdPlugin: Failed to write ${e.fileName}: ${r}`)}l>0&&t.log.info(`AgentsMdPlugin: Wrote ${l} AGENTS.md file(s)`)}}}function m(e,t){if(t.length===0)return!1;let n=e.replace(/\\/g,`/`);for(let e of t){let t=c(e.replace(/\\/g,`/`),{dot:!0});if(t(n))return!0;let r=n.split(`/`);for(let e=1;e<=r.length;e++)if(t(r.slice(0,e).join(`/`)))return!0}return!1}const h=[`node_modules`,`.git`];function ee(t){let{distDir:n,excludePatterns:r=h}=t;return{name:`aindexInput`,priority:30,async scan(t){let i=[],a=t.config.options?.excludePatterns??[],o=[...new Set([...r,...a])];if(!await t.fs.exists(n))return t.log.warn(`Aindex dist directory not found: ${n}`),t.registry.set(`aindexInput`,`distInfo`,null),i;t.log.debug(`Scanning aindex dist directory: ${n}`);let s={distPath:n,hasGlobalMd:!1,commandFiles:[],agentFiles:[],skillDirs:[]};try{let r=t.path.join(n,`GLOBAL.md`);if(await t.fs.exists(r)){s.hasGlobalMd=!0;let n=await v(t,r,e.CONFIG_FILE);n!=null&&i.push(n)}let a=t.path.join(n,`commands`);if(await t.fs.exists(a)){let n=await g(t,a,e.CONFIG_FILE,o);i.push(...n),s.commandFiles=n.map(e=>e.path)}let c=t.path.join(n,`agents`);if(await t.fs.exists(c)){let n=await g(t,c,e.CONFIG_FILE,o);i.push(...n),s.agentFiles=n.map(e=>e.path)}let l=t.path.join(n,`skills`);if(await t.fs.exists(l)){let e=await _(t,l,o);i.push(...e),s.skillDirs=e.map(e=>t.path.dirname(e.path))}}catch(e){let n=e instanceof Error?e.message:String(e);t.log.error(`Failed to scan aindex dist directory: ${n}`)}return t.registry.set(`aindexInput`,`distInfo`,s),t.log.info(`Discovered ${i.length} file(s) from aindex dist: ${s.hasGlobalMd?`1 GLOBAL.md, `:``}${s.commandFiles.length} command(s), ${s.agentFiles.length} agent(s), ${s.skillDirs.length} skill(s)`),i}}}async function g(e,t,n,r){let i=[];try{let a=await e.fs.readdir(t,{withFileTypes:!0});for(let o of a){if(typeof o==`string`||r.includes(o.name))continue;let a=e.path.join(t,o.name);if(m(o.name,r)){e.log.debug(`Skipping excluded path: ${o.name}`);continue}if(o.isDirectory()){let t=await g(e,a,n,r);i.push(...t)}else if(o.name.endsWith(`.md`)){let t=await v(e,a,n);t!=null&&i.push(t)}}}catch(n){e.log.debug(`Failed to scan directory ${t}: ${n instanceof Error?n.message:String(n)}`)}return i}async function _(t,n,r){let i=[];try{let a=await t.fs.readdir(n,{withFileTypes:!0});for(let o of a)if(typeof o!=`string`&&!r.includes(o.name)&&o.isDirectory()){let r=t.path.join(n,o.name),a=await t.fs.readdir(r);for(let n of a)if(typeof n==`string`&&n.endsWith(`.md`)){let a=await v(t,t.path.join(r,n),e.CONFIG_FILE);a!=null&&i.push(a)}}}catch(e){t.log.debug(`Failed to scan skills directory ${n}: ${e instanceof Error?e.message:String(e)}`)}return i}async function v(e,t,n){try{let r=await e.fs.readFile(t),i;t.endsWith(`.md`)&&(i=e.capabilities.frontMatter.parse(r).frontMatter);let a={type:n,path:t,content:r,sourceProject:`aindex`};return i!=null&&Object.keys(i).length>0&&(a.frontMatter=i),a}catch(n){return e.log.debug(`Failed to read file ${t}: ${n instanceof Error?n.message:String(n)}`),null}}const te=[{id:`workspace-workflows`,category:`ide`,tool:`windsurf`,targetType:`workspace`,path:`.windsurf/workflows`,enabled:!0}],ne=[e.FAST_COMMAND];function y(e,t){return t.path.basename(e.path)}function b(e=3){return{auto_execution_mode:e}}function x(t,n,r=3){let o=y(t,n),s=a(t.content,i.WORKFLOW_AUTO,``,{auto_execution_mode:r}),c=b(r);return n.log.debug(`WindsurfIDEPlugin: Processing FastCommand ${t.path}`),{type:`asset`,fileName:o,source:s,targetType:`workspace`,inputType:e.FAST_COMMAND,frontMatter:c}}function re(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,targetDir:i=`.windsurf/workflows`,autoExecutionMode:a=3}=t,o=[],s=[];return{name:`windsurfIde`,priority:100,inputTypes:ne,outputs:te,buildStart(e,t){o=[],s=[],e.log.debug(`WindsurfIDEPlugin: Starting build`)},async generateBundle(t,n){let c=t.getInputBundles(e.FAST_COMMAND);if(c.length>0){t.log.debug(`WindsurfIDEPlugin: Processing ${c.length} FastCommand bundle(s)`);for(let e of c){let n=x(e,t,a);r&&(t.emitFile(n),s.push(n)),o.push(e)}}t.registry.set(`windsurfIde`,`fastCommandBundles`,o),t.registry.set(`windsurfIde`,`emittedFiles`,s),t.registry.set(`windsurfIde`,`targetDir`,i),t.registry.set(`windsurfIde`,`autoExecutionMode`,a)},async writeBundle(t,a){if(!r){t.log.debug(`WindsurfIDEPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(t=>t.inputType===e.FAST_COMMAND);if(s.length===0){t.log.debug(`WindsurfIDEPlugin: No files to write`);return}let c=t.paths.resolve(i);if(n){t.log.debug(`WindsurfIDEPlugin: Cleaning target directory`);try{await t.fs.cleanDir(c)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`WindsurfIDEPlugin: Failed to clean target directory: ${n}`)}}await t.fs.ensureDir(c);let l=0;for(let e of s)try{let n=t.path.join(c,e.fileName),r=t.path.dirname(n);await t.fs.ensureDir(r),await t.fs.writeFile(n,e.source),l++,t.log.debug(`WindsurfIDEPlugin: Wrote ${n}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`WindsurfIDEPlugin: Failed to write ${e.fileName}: ${r}`)}l>0&&t.log.info(`WindsurfIDEPlugin: Wrote ${l} file(s) to Windsurf workflows`)}}}const ie=[{id:`workspace-workflows`,category:`ide`,tool:`antigravity`,targetType:`workspace`,path:`.agent/workflows`,enabled:!0},{id:`workspace-rules`,category:`ide`,tool:`antigravity`,targetType:`workspace`,path:`.agent/rules`,enabled:!0}],ae=[e.FAST_COMMAND,e.MEMORY_PROMPT];function S(e,t){return t.path.basename(e.path)}function oe(t,n,r=3){let o=S(t,n),s=a(t.content,i.WORKFLOW_AUTO,``,{auto_execution_mode:r}),c=b(r);return n.log.debug(`AntigravityIDEPlugin: Processing FastCommand ${t.path}`),{type:`asset`,fileName:o,source:s,targetType:`workspace`,inputType:e.FAST_COMMAND,frontMatter:c}}function se(t,n){let r=S(t,n);return n.log.debug(`AntigravityIDEPlugin: Processing MemoryPrompt ${t.path}`),{type:`asset`,fileName:r,source:t.content,targetType:`workspace`,inputType:e.MEMORY_PROMPT}}function ce(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,workflowsDir:i=`.agent/workflows`,rulesDir:a=`.agent/rules`,autoExecutionMode:o=3}=t,s=[],c=[],l=[],u=[];return{name:`antigravityIde`,priority:100,extends:`windsurfIde`,inputTypes:ae,outputs:ie,buildStart(e,t){s=[],c=[],l=[],u=[],e.log.debug(`AntigravityIDEPlugin: Starting build`)},async generateBundle(t,n){let d=t.getInputBundles(e.FAST_COMMAND);if(d.length>0){t.log.debug(`AntigravityIDEPlugin: Processing ${d.length} FastCommand bundle(s)`);for(let e of d){let n=oe(e,t,o);r&&(t.emitFile(n),l.push(n)),s.push(e)}}let f=t.getInputBundles(e.MEMORY_PROMPT);if(f.length>0){t.log.debug(`AntigravityIDEPlugin: Processing ${f.length} MemoryPrompt bundle(s)`);for(let e of f){let n=se(e,t);r&&(t.emitFile(n),u.push(n)),c.push(e)}}t.registry.set(`antigravityIde`,`fastCommandBundles`,s),t.registry.set(`antigravityIde`,`memoryPromptBundles`,c),t.registry.set(`antigravityIde`,`workflowEmittedFiles`,l),t.registry.set(`antigravityIde`,`rulesEmittedFiles`,u),t.registry.set(`antigravityIde`,`workflowsDir`,i),t.registry.set(`antigravityIde`,`rulesDir`,a),t.registry.set(`antigravityIde`,`autoExecutionMode`,o)},async writeBundle(t,o){if(!r){t.log.debug(`AntigravityIDEPlugin: File emission disabled`);return}let{files:s}=o,c=s.filter(t=>t.inputType===e.FAST_COMMAND||t.inputType===e.MEMORY_PROMPT);if(c.length===0){t.log.debug(`AntigravityIDEPlugin: No files to write`);return}let l=t.paths.resolve(i),u=t.paths.resolve(a);if(n){t.log.debug(`AntigravityIDEPlugin: Cleaning target directories`);try{await t.fs.cleanDir(l)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`AntigravityIDEPlugin: Failed to clean workflows directory: ${n}`)}try{await t.fs.cleanDir(u)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`AntigravityIDEPlugin: Failed to clean rules directory: ${n}`)}}await t.fs.ensureDir(l),await t.fs.ensureDir(u);let d=0,f=0;for(let n of c)try{if(n.inputType===e.FAST_COMMAND){let e=t.path.join(l,n.fileName),r=t.path.dirname(e);await t.fs.ensureDir(r),await t.fs.writeFile(e,n.source),d++,t.log.debug(`AntigravityIDEPlugin: Wrote workflow ${e}`)}else if(n.inputType===e.MEMORY_PROMPT){let e=t.path.join(u,n.fileName),r=t.path.dirname(e);await t.fs.ensureDir(r),await t.fs.writeFile(e,n.source),f++,t.log.debug(`AntigravityIDEPlugin: Wrote rule ${e}`)}}catch(e){let r=e instanceof Error?e.message:String(e);t.log.error(`AntigravityIDEPlugin: Failed to write ${n.fileName}: ${r}`)}let p=d+f;p>0&&t.log.info(`AntigravityIDEPlugin: Wrote ${p} file(s) (${d} workflows, ${f} rules)`)}}}const C=[{id:`global-config`,category:`cli`,tool:`claude`,targetType:`globalConfig`,path:`$USER_HOME/.claude`,enabled:!0},{id:`workspace-config`,category:`cli`,tool:`claude`,targetType:`workspace`,path:`.claude`,enabled:!0}],w=[e.GLOBAL_PROMPT,e.SUB_AGENT,e.FAST_COMMAND,e.SKILL];function le(t){switch(t){case e.GLOBAL_PROMPT:return``;case e.SUB_AGENT:return`agents`;case e.FAST_COMMAND:return`commands`;case e.SKILL:return`skills`;case e.MEMORY_PROMPT:case e.CONFIG_FILE:return``}}function T(t,n){return t===e.GLOBAL_PROMPT?`CLAUDE.md`:n}function E(e,t){let n=t.path.basename(e.path);return T(e.type,n)}function D(e,t,n){let r=le(e.type),i=E(e,n),a={type:`asset`,fileName:r?n.path.join(r,i):i,source:e.content,targetType:t,inputType:e.type};return e.frontMatter&&(a.frontMatter=e.frontMatter),a}function O(e={}){let{cleanTarget:t=!1,emitFiles:n=!0,emitGlobal:r=!0,emitWorkspace:i=!0,globalConfigPath:a,workspaceConfigPath:o=`.claude`}=e,s=[],c=[],l=[],u=``,d=``;return{name:`claudeCodeCli`,priority:100,inputTypes:w,outputs:C,buildStart(e,t){s=[],c=[],l=[];let n=e.resolveOutputPaths(C);u=o?e.paths.resolve(o):n.workspacePath??e.paths.resolve(`.claude`),d=a??n.globalConfigPath??e.path.join(e.paths.userHome,`.claude`),e.log.debug(`ClaudeCodeCLIPlugin: Starting build`),e.log.debug(`ClaudeCodeCLIPlugin: Workspace path: ${u}`),e.log.debug(`ClaudeCodeCLIPlugin: Global path: ${d}`)},async generateBundle(e,t){let a=[];for(let t of w){let n=e.getInputBundles(t);a.push(...n)}if(a.length===0){e.log.debug(`ClaudeCodeCLIPlugin: No input bundles found`);return}e.log.debug(`ClaudeCodeCLIPlugin: Processing ${a.length} input bundle(s)`);for(let t of a){if(r){let r=D(t,`globalConfig`,e);c.push(r),n&&e.emitFile(r)}if(i){let r=D(t,`workspace`,e);l.push(r),n&&e.emitFile(r)}s.push(t)}e.registry.set(`claudeCodeCli`,`processedBundles`,s),e.registry.set(`claudeCodeCli`,`globalEmittedFiles`,c),e.registry.set(`claudeCodeCli`,`workspaceEmittedFiles`,l)},async writeBundle(e,a){if(!n){e.log.debug(`ClaudeCodeCLIPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(e=>w.includes(e.inputType));if(s.length===0){e.log.debug(`ClaudeCodeCLIPlugin: No files to write`);return}if(t){if(e.log.debug(`ClaudeCodeCLIPlugin: Cleaning target directories`),r)try{await e.fs.cleanDir(d)}catch(t){let n=t instanceof Error?t.message:String(t);e.log.warn(`ClaudeCodeCLIPlugin: Failed to clean global directory: ${n}`)}if(i)try{await e.fs.cleanDir(u)}catch(t){let n=t instanceof Error?t.message:String(t);e.log.warn(`ClaudeCodeCLIPlugin: Failed to clean workspace directory: ${n}`)}}let c=0,l=0;for(let t of s)try{if(t.targetType===`globalConfig`&&r){let n=e.path.join(d,t.fileName),r=e.path.dirname(n);await e.fs.ensureDir(r),await e.fs.writeFile(n,t.source),c++,e.log.debug(`ClaudeCodeCLIPlugin: Wrote global ${n}`)}else if(t.targetType===`workspace`&&i){let n=e.path.join(u,t.fileName),r=e.path.dirname(n);await e.fs.ensureDir(r),await e.fs.writeFile(n,t.source),l++,e.log.debug(`ClaudeCodeCLIPlugin: Wrote workspace ${n}`)}}catch(n){let r=n instanceof Error?n.message:String(n);e.log.error(`ClaudeCodeCLIPlugin: Failed to write ${t.fileName}: ${r}`)}let f=c+l;f>0&&e.log.info(`ClaudeCodeCLIPlugin: Wrote ${f} file(s) (${c} global, ${l} workspace)`)}}}const k=[{id:`workspace-rules`,category:`ide`,tool:`cursor`,targetType:`workspace`,path:`.cursor/rules`,enabled:!0}],A=[e.MEMORY_PROMPT],j=[{pattern:/\.md$/,replacement:`.mdc`,tools:[`cursor`]}];function M(e){return e.replace(/\.md$/,`.mdc`)}function N(e,t){let n=t.path.dirname(e.path).replace(/[\\/]/g,`_`).replace(/^_+|_+$/g,``);return n===``||n===`.`?`_root.mdc`:`${n}.mdc`}function P(t,n){let r=N(t,n);n.log.debug(`CursorIDEPlugin: Processing MemoryPrompt ${t.path} -> ${r}`);let i={type:`asset`,fileName:r,source:t.content,targetType:`workspace`,inputType:e.MEMORY_PROMPT};return t.frontMatter&&(i.frontMatter=t.frontMatter),i}function F(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,targetDir:i=`.cursor/rules`}=t,a=[],o=[];return{name:`cursorIde`,priority:100,inputTypes:A,outputs:k,filenameTransform:j,buildStart(e,t){a=[],o=[],e.log.debug(`CursorIDEPlugin: Starting build`)},transformFilename(e,t){return e.endsWith(`.md`)?M(e):null},async generateBundle(t,n){let s=t.getInputBundles(e.MEMORY_PROMPT);if(s.length>0){t.log.debug(`CursorIDEPlugin: Processing ${s.length} MemoryPrompt bundle(s)`);for(let e of s){let n=P(e,t);r&&(t.emitFile(n),o.push(n)),a.push(e)}}t.registry.set(`cursorIde`,`memoryPromptBundles`,a),t.registry.set(`cursorIde`,`emittedFiles`,o),t.registry.set(`cursorIde`,`targetDir`,i)},async writeBundle(t,a){if(!r){t.log.debug(`CursorIDEPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(t=>t.inputType===e.MEMORY_PROMPT&&t.fileName.endsWith(`.mdc`));if(s.length===0){t.log.debug(`CursorIDEPlugin: No files to write`);return}let c=t.paths.resolve(i);if(n){t.log.debug(`CursorIDEPlugin: Cleaning target directory`);try{await t.fs.cleanDir(c)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`CursorIDEPlugin: Failed to clean target directory: ${n}`)}}await t.fs.ensureDir(c);let l=0;for(let e of s)try{let n=t.path.join(c,e.fileName),r=t.path.dirname(n);await t.fs.ensureDir(r),await t.fs.writeFile(n,e.source),l++,t.log.debug(`CursorIDEPlugin: Wrote ${n}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`CursorIDEPlugin: Failed to write ${e.fileName}: ${r}`)}l>0&&t.log.info(`CursorIDEPlugin: Wrote ${l} file(s) to Cursor rules`)}}}const I=[{id:`workspace-rules`,category:`ide`,tool:`codebuddy`,targetType:`workspace`,path:`.codebuddy/.rules`,enabled:!0}],L=[e.MEMORY_PROMPT],R=[{pattern:/\.md$/,replacement:`.mdc`,tools:[`codebuddy`]}];function z(e,t){return N(e,t)}function B(t,n){let r=z(t,n);n.log.debug(`CodeBuddyIDEPlugin: Processing MemoryPrompt ${t.path} -> ${r}`);let i={type:`asset`,fileName:r,source:t.content,targetType:`workspace`,inputType:e.MEMORY_PROMPT};return t.frontMatter&&(i.frontMatter=t.frontMatter),i}function V(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,targetDir:i=`.codebuddy/.rules`}=t,a=[],o=[];return{name:`codeBuddyIde`,priority:100,extends:`cursorIde`,inputTypes:L,outputs:I,filenameTransform:R,buildStart(e,t){a=[],o=[],e.log.debug(`CodeBuddyIDEPlugin: Starting build`)},transformFilename(e,t){return e.endsWith(`.md`)?M(e):null},async generateBundle(t,n){let s=t.getInputBundles(e.MEMORY_PROMPT);if(s.length>0){t.log.debug(`CodeBuddyIDEPlugin: Processing ${s.length} MemoryPrompt bundle(s)`);for(let e of s){let n=B(e,t);r&&(t.emitFile(n),o.push(n)),a.push(e)}}t.registry.set(`codeBuddyIde`,`memoryPromptBundles`,a),t.registry.set(`codeBuddyIde`,`emittedFiles`,o),t.registry.set(`codeBuddyIde`,`targetDir`,i)},async writeBundle(t,a){if(!r){t.log.debug(`CodeBuddyIDEPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(t=>t.inputType===e.MEMORY_PROMPT&&t.fileName.endsWith(`.mdc`));if(s.length===0){t.log.debug(`CodeBuddyIDEPlugin: No files to write`);return}let c=t.paths.resolve(i);if(n){t.log.debug(`CodeBuddyIDEPlugin: Cleaning target directory`);try{await t.fs.cleanDir(c)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`CodeBuddyIDEPlugin: Failed to clean target directory: ${n}`)}}await t.fs.ensureDir(c);let l=0;for(let e of s)try{let n=t.path.join(c,e.fileName),r=t.path.dirname(n);await t.fs.ensureDir(r),await t.fs.writeFile(n,e.source),l++,t.log.debug(`CodeBuddyIDEPlugin: Wrote ${n}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`CodeBuddyIDEPlugin: Failed to write ${e.fileName}: ${r}`)}l>0&&t.log.info(`CodeBuddyIDEPlugin: Wrote ${l} file(s) to CodeBuddy rules`)}}}const H=[{id:`global-config`,category:`cli`,tool:`codex`,targetType:`globalConfig`,path:`$USER_HOME/.codex`,enabled:!0}],U=[e.GLOBAL_PROMPT,e.FAST_COMMAND];function W(t){switch(t){case e.GLOBAL_PROMPT:return``;case e.FAST_COMMAND:return`commands`;case e.MEMORY_PROMPT:case e.SUB_AGENT:case e.SKILL:case e.CONFIG_FILE:return``}}function ue(e,t){return t.path.basename(e.path)}function G(e,t){let n=W(e.type),r=ue(e,t),i={type:`asset`,fileName:n?t.path.join(n,r):r,source:e.content,targetType:`globalConfig`,inputType:e.type};return e.frontMatter&&(i.frontMatter=e.frontMatter),i}function de(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,globalConfigPath:i}=t,a=[],s=[],c=[];return{name:`codexCli`,priority:100,extends:`agentsMd`,inputTypes:U,outputs:H,buildStart(e,t){a=[],s=[],c=[],e.log.debug(`CodexCLIPlugin: Starting build`)},async generateBundle(t,n){let i=t.getInputBundles(e.GLOBAL_PROMPT);if(i.length>0){t.log.debug(`CodexCLIPlugin: Processing ${i.length} GlobalPrompt bundle(s)`);for(let e of i){let n=G(e,t);r&&(t.emitFile(n),c.push(n)),a.push(e)}}let o=t.getInputBundles(e.FAST_COMMAND);if(o.length>0){t.log.debug(`CodexCLIPlugin: Processing ${o.length} FastCommand bundle(s)`);for(let e of o){let n=G(e,t);r&&(t.emitFile(n),c.push(n)),s.push(e)}}t.registry.set(`codexCli`,`globalPromptBundles`,a),t.registry.set(`codexCli`,`fastCommandBundles`,s),t.registry.set(`codexCli`,`globalEmittedFiles`,c)},async writeBundle(t,a){if(!r){t.log.debug(`CodexCLIPlugin: File emission disabled`);return}let{files:s}=a,c=s.filter(t=>t.targetType===`globalConfig`&&(t.inputType===e.GLOBAL_PROMPT||t.inputType===e.FAST_COMMAND));if(c.length===0){t.log.debug(`CodexCLIPlugin: No files to write`);return}if(n){t.log.debug(`CodexCLIPlugin: Cleaning target directory`);try{let e=i??o.homedir()+(o.platform()===`win32`?`\\.codex`:`/.codex`);await t.fs.cleanDir(e)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`CodexCLIPlugin: Failed to clean global directory: ${n}`)}}let l=0;for(let e of c)try{let n=i??o.homedir()+(o.platform()===`win32`?`\\.codex`:`/.codex`),r=t.path.join(n,e.fileName),a=t.path.dirname(r);await t.fs.ensureDir(a),await t.fs.writeFile(r,e.source),l++,t.log.debug(`CodexCLIPlugin: Wrote global ${r}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`CodexCLIPlugin: Failed to write ${e.fileName}: ${r}`)}try{let e=i??o.homedir()+(o.platform()===`win32`?`\\.codex`:`/.codex`),n=t.path.join(e,`AGENTS.md`);await t.fs.exists(n)&&t.log.info(`CodexCLIPlugin: Registered global prompt file at ${n}`)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`CodexCLIPlugin: Failed to register global prompt file: ${n}`)}l>0&&t.log.info(`CodexCLIPlugin: Wrote ${l} file(s) to global config`)}}}const fe=[{id:`workspace-editorconfig`,category:`config`,tool:`editorconfig`,targetType:`workspace`,path:`.editorconfig`,enabled:!0}],pe=[e.CONFIG_FILE];function me(t,n=`.editorconfig`,r){if(t.type!==e.CONFIG_FILE)return!1;let i=t.path.replace(/\\/g,`/`);return r.path.basename(i)===n}function he(e,t,n=`.editorconfig`){return e.filter(e=>me(e,n,t))}function ge(t,n,r=`.editorconfig`){return t.content===``?(n.log.debug(`EditorconfigConfigPlugin: Skipping empty bundle ${t.path}`),null):(n.log.debug(`EditorconfigConfigPlugin: Processing ${t.path}`),{type:`asset`,fileName:r,source:t.content,targetType:`workspace`,inputType:e.CONFIG_FILE})}function _e(t={}){let{emitFiles:n=!0,targetFilename:r=`.editorconfig`,sourcePattern:i=`.editorconfig`}=t,a=[],o=[];return{name:`editorconfigConfig`,priority:200,inputTypes:pe,outputs:fe,buildStart(e,t){a=[],o=[],e.log.debug(`EditorconfigConfigPlugin: Starting build`)},async generateBundle(t,s){let c=he(t.getInputBundles(e.CONFIG_FILE),t,i);if(c.length===0){t.log.debug(`EditorconfigConfigPlugin: No editorconfig files found`);return}t.log.debug(`EditorconfigConfigPlugin: Processing ${c.length} editorconfig bundle(s)`);for(let e of c){let i=ge(e,t,r);i!=null&&n&&(t.emitFile(i),o.push(i)),a.push(e)}t.registry.set(`editorconfigConfig`,`configBundles`,a),t.registry.set(`editorconfigConfig`,`emittedFiles`,o),t.registry.set(`editorconfigConfig`,`targetFilename`,r)},async writeBundle(t,i){if(!n){t.log.debug(`EditorconfigConfigPlugin: File emission disabled`);return}let{files:a}=i,o=a.filter(t=>t.inputType===e.CONFIG_FILE&&t.fileName===r);if(o.length===0){t.log.debug(`EditorconfigConfigPlugin: No editorconfig files to write`);return}let s=0;for(let e of o)try{let n=t.paths.resolve(e.fileName);await t.fs.writeFile(n,e.source),s++,t.log.debug(`EditorconfigConfigPlugin: Wrote ${n}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`EditorconfigConfigPlugin: Failed to write ${e.fileName}: ${r}`)}s>0&&t.log.info(`EditorconfigConfigPlugin: Wrote ${s} .editorconfig file(s)`)}}}const K=[{id:`global-config`,category:`cli`,tool:`factory`,targetType:`globalConfig`,path:`.factory`,enabled:!0},{id:`workspace-config`,category:`cli`,tool:`factory`,targetType:`workspace`,path:`.factory`,enabled:!0}],q=[e.GLOBAL_PROMPT,e.SUB_AGENT,e.FAST_COMMAND,e.SKILL];function ve(e={}){let{cleanTarget:t=!1,emitFiles:n=!0,emitGlobal:r=!0,emitWorkspace:i=!0,globalConfigPath:a,workspaceConfigPath:o=`.factory`}=e,s=[],c=[],l=[],u=``,d=``;return{name:`factoryDroidCli`,priority:100,extends:`claudeCodeCli`,inputTypes:q,outputs:K,buildStart(e,t){s=[],c=[],l=[];let n=e.resolveOutputPaths(K);u=o?e.paths.resolve(o):n.workspacePath??e.paths.resolve(`.factory`),d=a??n.globalConfigPath??e.path.join(e.paths.userHome,`.factory`),e.log.debug(`FactoryDroidCLIPlugin: Starting build`),e.log.debug(`FactoryDroidCLIPlugin: Workspace path: ${u}`),e.log.debug(`FactoryDroidCLIPlugin: Global path: ${d}`)},async generateBundle(e,t){let a=[];for(let t of q){let n=e.getInputBundles(t);a.push(...n)}if(a.length===0){e.log.debug(`FactoryDroidCLIPlugin: No input bundles found`);return}e.log.debug(`FactoryDroidCLIPlugin: Processing ${a.length} input bundle(s)`);for(let t of a){if(r){let r=D(t,`globalConfig`,e);c.push(r),n&&e.emitFile(r)}if(i){let r=D(t,`workspace`,e);l.push(r),n&&e.emitFile(r)}s.push(t)}e.registry.set(`factoryDroidCli`,`processedBundles`,s),e.registry.set(`factoryDroidCli`,`globalEmittedFiles`,c),e.registry.set(`factoryDroidCli`,`workspaceEmittedFiles`,l)},async writeBundle(e,a){if(!n){e.log.debug(`FactoryDroidCLIPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(e=>q.includes(e.inputType));if(s.length===0){e.log.debug(`FactoryDroidCLIPlugin: No files to write`);return}if(t){if(e.log.debug(`FactoryDroidCLIPlugin: Cleaning target directories`),r)try{await e.fs.cleanDir(d)}catch(t){let n=t instanceof Error?t.message:String(t);e.log.warn(`FactoryDroidCLIPlugin: Failed to clean global directory: ${n}`)}if(i)try{await e.fs.cleanDir(u)}catch(t){let n=t instanceof Error?t.message:String(t);e.log.warn(`FactoryDroidCLIPlugin: Failed to clean workspace directory: ${n}`)}}let c=0,l=0;for(let t of s)try{if(t.targetType===`globalConfig`&&r){let n=e.path.join(d,t.fileName),r=e.path.dirname(n);await e.fs.ensureDir(r),await e.fs.writeFile(n,t.source),c++,e.log.debug(`FactoryDroidCLIPlugin: Wrote global ${n}`)}else if(t.targetType===`workspace`&&i){let n=e.path.join(u,t.fileName),r=e.path.dirname(n);await e.fs.ensureDir(r),await e.fs.writeFile(n,t.source),l++,e.log.debug(`FactoryDroidCLIPlugin: Wrote workspace ${n}`)}}catch(n){let r=n instanceof Error?n.message:String(n);e.log.error(`FactoryDroidCLIPlugin: Failed to write ${t.fileName}: ${r}`)}let f=c+l;f>0&&e.log.info(`FactoryDroidCLIPlugin: Wrote ${f} file(s) (${c} global, ${l} workspace)`)}}}function ye(e,t){let n=t.path.dirname(e.path);return n===`.`?``:n}const be=[{id:`workspace-gemini`,category:`cli`,tool:`gemini`,targetType:`workspace`,path:`GEMINI.md`,enabled:!0},{id:`global-config`,category:`cli`,tool:`gemini`,targetType:`globalConfig`,path:`.gemini`,enabled:!0}],xe=[e.MEMORY_PROMPT,e.GLOBAL_PROMPT];function Se(e,t){return t.path.basename(e.path)}function Ce(t,n,r){let i={type:`asset`,fileName:Se(t,r),source:t.content,targetType:n,inputType:e.GLOBAL_PROMPT};return t.frontMatter&&(i.frontMatter=t.frontMatter),i}function we(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,emitGlobal:i=!0,emitWorkspace:a=!0,globalConfigPath:s,outputFilename:c=`GEMINI.md`}=t,l=[],u=[],f=[],p=[];return{name:`geminiCli`,priority:100,extends:`agentsMd`,inputTypes:xe,outputs:be,buildStart(e,t){l=[],u=[],f=[],p=[],e.log.debug(`GeminiCLIPlugin: Starting build`)},async generateBundle(t,n){let o=t.getInputBundles(e.MEMORY_PROMPT);if(o.length>0){t.log.debug(`GeminiCLIPlugin: Processing ${o.length} MemoryPrompt bundle(s)`);for(let e of o){let n=d(e,c);r&&a&&(t.emitFile(n),f.push(n)),l.push(e)}}let s=t.getInputBundles(e.GLOBAL_PROMPT);if(s.length>0){t.log.debug(`GeminiCLIPlugin: Processing ${s.length} GlobalPrompt bundle(s)`);for(let e of s){if(i){let n=Ce(e,`globalConfig`,t);r&&(t.emitFile(n),p.push(n))}u.push(e)}}t.registry.set(`geminiCli`,`memoryPromptBundles`,l),t.registry.set(`geminiCli`,`globalPromptBundles`,u),t.registry.set(`geminiCli`,`workspaceEmittedFiles`,f),t.registry.set(`geminiCli`,`globalEmittedFiles`,p),t.registry.set(`geminiCli`,`outputFilename`,c)},async writeBundle(t,u){if(!r){t.log.debug(`GeminiCLIPlugin: File emission disabled`);return}let{files:d}=u,f=d.filter(t=>t.inputType===e.MEMORY_PROMPT&&t.fileName===c||t.inputType===e.GLOBAL_PROMPT);if(f.length===0){t.log.debug(`GeminiCLIPlugin: No files to write`);return}if(n&&(t.log.debug(`GeminiCLIPlugin: Cleaning target directories`),i))try{let e=s??o.homedir()+(o.platform()===`win32`?`\\.gemini`:`/.gemini`);await t.fs.cleanDir(e)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`GeminiCLIPlugin: Failed to clean global directory: ${n}`)}let p=0,m=0;for(let n of f)try{if(n.inputType===e.MEMORY_PROMPT&&a){let e=l.find(e=>e.content===n.source);if(e){let r=ye(e,t),i=r?t.paths.resolve(r,n.fileName):t.paths.resolve(n.fileName),a=t.path.dirname(i);await t.fs.ensureDir(a),await t.fs.writeFile(i,n.source),p++,t.log.debug(`GeminiCLIPlugin: Wrote workspace ${i}`)}}else if(n.inputType===e.GLOBAL_PROMPT&&i){let e=s??o.homedir()+(o.platform()===`win32`?`\\.gemini`:`/.gemini`),r=t.path.join(e,n.fileName),i=t.path.dirname(r);await t.fs.ensureDir(i),await t.fs.writeFile(r,n.source),m++,t.log.debug(`GeminiCLIPlugin: Wrote global ${r}`)}}catch(e){let r=e instanceof Error?e.message:String(e);t.log.error(`GeminiCLIPlugin: Failed to write ${n.fileName}: ${r}`)}let h=p+m;h>0&&t.log.info(`GeminiCLIPlugin: Wrote ${h} file(s) (${p} workspace, ${m} global)`)}}}const Te=[{id:`workspace-idea`,category:`config`,tool:`jetbrains`,targetType:`workspace`,path:`.idea`,enabled:!0}],Ee=[e.CONFIG_FILE];function De(t,n=`.idea`){if(t.type!==e.CONFIG_FILE)return!1;let r=t.path.replace(/\\/g,`/`);return r.includes(`/${n}`)||r.endsWith(n)}function Oe(e,t=`.idea`){return e.filter(e=>De(e,t))}function ke(t,n){if(t.content===``)return n.log.debug(`JetBrainsIDEConfigPlugin: Skipping directory ${t.path}`),null;let r=t.path.replace(/\\/g,`/`),i=r.lastIndexOf(`.idea`);if(i===-1)return n.log.warn(`JetBrainsIDEConfigPlugin: Invalid path ${t.path}`),null;let a=r.substring(i);return n.log.debug(`JetBrainsIDEConfigPlugin: Processing ${a}`),{type:`asset`,fileName:a,source:t.content,targetType:`workspace`,inputType:e.CONFIG_FILE}}async function J(e,t,n){let r=0;try{let i=await e.fs.readdir(t,{withFileTypes:!0});for(let a of i){if(typeof a==`string`)continue;let i=e.path.join(t,a.name),o=e.path.join(n,a.name);a.isDirectory()?(await e.fs.ensureDir(o),r+=await J(e,i,o)):(await e.fs.copy(i,o),r++,e.log.debug(`JetBrainsIDEConfigPlugin: Copied ${a.name}`))}}catch(t){let n=t instanceof Error?t.message:String(t);e.log.error(`JetBrainsIDEConfigPlugin: Failed to copy directory: ${n}`)}return r}function Ae(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,targetDir:i=`.idea`,sourcePattern:a=`.idea`}=t,o=[],s=[],c=[];return{name:`jetBrainsIdeConfig`,priority:200,inputTypes:Ee,outputs:Te,buildStart(e,t){o=[],s=[],c=[],e.log.debug(`JetBrainsIDEConfigPlugin: Starting build`)},async generateBundle(t,n){let l=Oe(t.getInputBundles(e.CONFIG_FILE),a);if(l.length===0){t.log.debug(`JetBrainsIDEConfigPlugin: No JetBrains config files found`);return}t.log.debug(`JetBrainsIDEConfigPlugin: Processing ${l.length} config bundle(s)`);for(let e of l){if(e.content===``){c.push(e);continue}let n=ke(e,t);n!=null&&r&&(t.emitFile(n),s.push(n)),o.push(e)}t.registry.set(`jetBrainsIdeConfig`,`configBundles`,o),t.registry.set(`jetBrainsIdeConfig`,`directoryBundles`,c),t.registry.set(`jetBrainsIdeConfig`,`emittedFiles`,s),t.registry.set(`jetBrainsIdeConfig`,`targetDir`,i)},async writeBundle(t,a){if(!r){t.log.debug(`JetBrainsIDEConfigPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(t=>t.inputType===e.CONFIG_FILE&&t.fileName.includes(`.idea`)),l=t.paths.resolve(i);if(n){t.log.debug(`JetBrainsIDEConfigPlugin: Cleaning target directory`);try{await t.fs.cleanDir(l)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`JetBrainsIDEConfigPlugin: Failed to clean target directory: ${n}`)}}await t.fs.ensureDir(l);let u=0;for(let e of c)try{let n=e.path,r=l;t.log.debug(`JetBrainsIDEConfigPlugin: Copying directory ${n} to ${r}`);let i=await J(t,n,r);u+=i}catch(e){let n=e instanceof Error?e.message:String(e);t.log.error(`JetBrainsIDEConfigPlugin: Failed to copy directory: ${n}`)}for(let e of s)try{let n=e.fileName.replace(/^\.idea[\\/]?/,``),r=t.path.join(l,n),i=t.path.dirname(r);await t.fs.ensureDir(i),await t.fs.writeFile(r,e.source),u++,t.log.debug(`JetBrainsIDEConfigPlugin: Wrote ${r}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`JetBrainsIDEConfigPlugin: Failed to write ${e.fileName}: ${r}`)}u>0&&t.log.info(`JetBrainsIDEConfigPlugin: Wrote ${u} file(s) to .idea/`)}}}const je=[{id:`workspace-steering`,category:`ide`,tool:`kiro`,targetType:`workspace`,path:`.kiro/steering`,enabled:!0}],Me=[e.MEMORY_PROMPT,e.GLOBAL_PROMPT];function Ne(e,t){let n=t.path.dirname(e.path).replace(/\\/g,`/`);return n===`.`||n===``?`**/*`:`**/${n}/**`}function Pe(e,t){let n=t.path.dirname(e.path).replace(/[\\/]/g,`_`).replace(/^_+|_+$/g,``);return n===``||n===`.`?`_root.md`:`${n}.md`}function Fe(t,n){let o=Ne(t,n),s=Pe(t,n),c=a(t.content,i.KIRO_FILE_MATCH,o),l=r(i.KIRO_FILE_MATCH,{type:i.KIRO_FILE_MATCH,filePattern:o});return n.log.debug(`KiroIDEPlugin: Generated pattern "${o}" for ${t.path}`),{type:`asset`,fileName:s,source:c,targetType:`workspace`,inputType:e.MEMORY_PROMPT,frontMatter:l}}function Ie(t,n){let o=n.path.basename(t.path),s=a(t.content,i.KIRO_ALWAYS),c=r(i.KIRO_ALWAYS,{type:i.KIRO_ALWAYS});return n.log.debug(`KiroIDEPlugin: Processing GlobalPrompt ${t.path}`),{type:`asset`,fileName:o,source:s,targetType:`workspace`,inputType:e.GLOBAL_PROMPT,frontMatter:c}}function Le(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,targetDir:i=`.kiro/steering`}=t,a=[],o=[],s=[];return{name:`kiroIde`,priority:100,inputTypes:Me,outputs:je,buildStart(e,t){a=[],o=[],s=[],e.log.debug(`KiroIDEPlugin: Starting build`)},async generateBundle(t,n){let c=t.getInputBundles(e.MEMORY_PROMPT);if(c.length>0){t.log.debug(`KiroIDEPlugin: Processing ${c.length} MemoryPrompt bundle(s)`);for(let e of c){let n=Fe(e,t);r&&(t.emitFile(n),s.push(n)),a.push(e)}}let l=t.getInputBundles(e.GLOBAL_PROMPT);if(l.length>0){t.log.debug(`KiroIDEPlugin: Processing ${l.length} GlobalPrompt bundle(s)`);for(let e of l){let n=Ie(e,t);r&&(t.emitFile(n),s.push(n)),o.push(e)}}t.registry.set(`kiroIde`,`memoryPromptBundles`,a),t.registry.set(`kiroIde`,`globalPromptBundles`,o),t.registry.set(`kiroIde`,`emittedFiles`,s),t.registry.set(`kiroIde`,`targetDir`,i)},async writeBundle(t,a){if(!r){t.log.debug(`KiroIDEPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(t=>t.inputType===e.MEMORY_PROMPT||t.inputType===e.GLOBAL_PROMPT);if(s.length===0){t.log.debug(`KiroIDEPlugin: No files to write`);return}let c=t.paths.resolve(i);if(n){t.log.debug(`KiroIDEPlugin: Cleaning target directory`);try{await t.fs.cleanDir(c)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`KiroIDEPlugin: Failed to clean target directory: ${n}`)}}await t.fs.ensureDir(c);let l=0;for(let e of s)try{let n=t.path.join(c,e.fileName),r=t.path.dirname(n);await t.fs.ensureDir(r),await t.fs.writeFile(n,e.source),l++,t.log.debug(`KiroIDEPlugin: Wrote ${n}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`KiroIDEPlugin: Failed to write ${e.fileName}: ${r}`)}l>0&&t.log.info(`KiroIDEPlugin: Wrote ${l} file(s) to Kiro steering`)}}}const Re=[{id:`workspace-rules`,category:`ide`,tool:`qoder`,targetType:`workspace`,path:`.qoder/rules`,enabled:!0}],ze=[e.MEMORY_PROMPT];function Be(e,t){let n=t.path.dirname(e.path).replace(/\\/g,`/`);return n===`.`||n===``?`**/*`:`**/${n}/**`}function Ve(e,t){let n=t.path.dirname(e.path).replace(/[\\/]/g,`_`).replace(/^_+|_+$/g,``);return n===``||n===`.`?`_root.mdc`:`${n}.mdc`}function He(t,n){let o=Be(t,n),s=Ve(t,n),c=a(t.content,i.QODER_GLOB,o),l=r(i.QODER_GLOB,{type:i.QODER_GLOB,filePattern:o});return n.log.debug(`QoderIDEPlugin: Generated pattern "${o}" for ${t.path}`),{type:`asset`,fileName:s,source:c,targetType:`workspace`,inputType:e.MEMORY_PROMPT,frontMatter:l}}function Ue(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,targetDir:i=`.qoder/rules`}=t,a=[],o=[];return{name:`qoderIde`,priority:100,inputTypes:ze,outputs:Re,buildStart(e,t){a=[],o=[],e.log.debug(`QoderIDEPlugin: Starting build`)},async generateBundle(t,n){let s=t.getInputBundles(e.MEMORY_PROMPT);if(s.length>0){t.log.debug(`QoderIDEPlugin: Processing ${s.length} MemoryPrompt bundle(s)`);for(let e of s){let n=He(e,t);r&&(t.emitFile(n),o.push(n)),a.push(e)}}t.registry.set(`qoderIde`,`memoryPromptBundles`,a),t.registry.set(`qoderIde`,`emittedFiles`,o),t.registry.set(`qoderIde`,`targetDir`,i)},async writeBundle(t,a){if(!r){t.log.debug(`QoderIDEPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(t=>t.inputType===e.MEMORY_PROMPT&&t.fileName.endsWith(`.mdc`));if(s.length===0){t.log.debug(`QoderIDEPlugin: No files to write`);return}let c=t.paths.resolve(i);if(n){t.log.debug(`QoderIDEPlugin: Cleaning target directory`);try{await t.fs.cleanDir(c)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`QoderIDEPlugin: Failed to clean target directory: ${n}`)}}await t.fs.ensureDir(c);let l=0;for(let e of s)try{let n=t.path.join(c,e.fileName),r=t.path.dirname(n);await t.fs.ensureDir(r),await t.fs.writeFile(n,e.source),l++,t.log.debug(`QoderIDEPlugin: Wrote ${n}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`QoderIDEPlugin: Failed to write ${e.fileName}: ${r}`)}l>0&&t.log.info(`QoderIDEPlugin: Wrote ${l} file(s) to Qoder rules`)}}}const We=[`node_modules`,`.git`];function Ge(e){let{refDir:t,excludePatterns:n=We,distDirName:r=`dist`}=e;return{name:`refInput`,priority:20,async scan(e){let i=[],a=[],o=e.config.options?.excludePatterns??[],s=[...new Set([...n,...o])];if(!await e.fs.exists(t))return e.log.warn(`Ref directory not found: ${t}`),e.registry.set(`refInput`,`projects`,[]),i;e.log.debug(`Scanning ref directory: ${t}`);try{let n=await e.fs.readdir(t,{withFileTypes:!0});for(let o of n){if(typeof o==`string`||!o.isDirectory()||s.includes(o.name))continue;if(m(`ref/${o.name}`,s)){e.log.debug(`Skipping excluded ref project: ${o.name}`);continue}let n=e.path.join(t,o.name),c=e.path.join(n,r);if(!await e.fs.exists(c)){e.log.debug(`No dist directory found for ref project: ${o.name}`);continue}let l=await Ke(e,o.name,n,c);if(l!=null){a.push(l);let t=await qe(e,l);i.push(...t)}}}catch(t){let n=t instanceof Error?t.message:String(t);e.log.error(`Failed to scan ref directory: ${n}`)}return e.registry.set(`refInput`,`projects`,a),e.log.info(`Discovered ${a.length} ref project(s) with ${i.length} file(s)`),i}}}async function Ke(e,t,n,r){try{let i=[];return await Y(e,r,i),{name:t,path:n,distPath:r,files:i}}catch(n){return e.log.debug(`Failed to scan ref project ${t}: ${n instanceof Error?n.message:String(n)}`),null}}async function Y(e,t,n){let r=await e.fs.readdir(t,{withFileTypes:!0});for(let i of r){if(typeof i==`string`)continue;let r=e.path.join(t,i.name);i.isDirectory()?await Y(e,r,n):n.push(r)}}async function qe(e,t){let n=[];for(let r of t.files){let i=await Je(e,r,t);i!=null&&n.push(i)}return n}async function Je(t,n,r){try{let i=await t.fs.readFile(n),a=t.path.basename(n),o;a.endsWith(`.md`)&&(o=t.capabilities.frontMatter.parse(i).frontMatter);let s={type:e.CONFIG_FILE,path:n,content:i,sourceProject:r.name};return o!=null&&(s.frontMatter=o),s}catch(e){return t.log.debug(`Failed to read file ${n}: ${e instanceof Error?e.message:String(e)}`),null}}const Ye=[{id:`workspace-vscode`,category:`config`,tool:`vscode`,targetType:`workspace`,path:`.vscode`,enabled:!0}],Xe=[e.CONFIG_FILE];function Ze(t,n=`.vscode`){if(t.type!==e.CONFIG_FILE)return!1;let r=t.path.replace(/\\/g,`/`);return r.includes(`/${n}`)||r.endsWith(n)}function X(e,t=`.vscode`){return e.filter(e=>Ze(e,t))}function Qe(t,n){if(t.content===``)return n.log.debug(`VSCodeIDEConfigPlugin: Skipping directory ${t.path}`),null;let r=t.path.replace(/\\/g,`/`),i=r.lastIndexOf(`.vscode`);if(i===-1)return n.log.warn(`VSCodeIDEConfigPlugin: Invalid path ${t.path}`),null;let a=r.substring(i);return n.log.debug(`VSCodeIDEConfigPlugin: Processing ${a}`),{type:`asset`,fileName:a,source:t.content,targetType:`workspace`,inputType:e.CONFIG_FILE}}async function Z(e,t,n){let r=0;try{let i=await e.fs.readdir(t,{withFileTypes:!0});for(let a of i){if(typeof a==`string`)continue;let i=e.path.join(t,a.name),o=e.path.join(n,a.name);a.isDirectory()?(await e.fs.ensureDir(o),r+=await Z(e,i,o)):(await e.fs.copy(i,o),r++,e.log.debug(`VSCodeIDEConfigPlugin: Copied ${a.name}`))}}catch(t){let n=t instanceof Error?t.message:String(t);e.log.error(`VSCodeIDEConfigPlugin: Failed to copy directory: ${n}`)}return r}function $e(t={}){let{cleanTarget:n=!1,emitFiles:r=!0,targetDir:i=`.vscode`,sourcePattern:a=`.vscode`}=t,o=[],s=[],c=[];return{name:`vscodeIdeConfig`,priority:200,inputTypes:Xe,outputs:Ye,buildStart(e,t){o=[],s=[],c=[],e.log.debug(`VSCodeIDEConfigPlugin: Starting build`)},async generateBundle(t,n){let l=X(t.getInputBundles(e.CONFIG_FILE),a);if(l.length===0){t.log.debug(`VSCodeIDEConfigPlugin: No VSCode config files found`);return}t.log.debug(`VSCodeIDEConfigPlugin: Processing ${l.length} config bundle(s)`);for(let e of l){if(e.content===``){c.push(e);continue}let n=Qe(e,t);n!=null&&r&&(t.emitFile(n),s.push(n)),o.push(e)}t.registry.set(`vscodeIdeConfig`,`configBundles`,o),t.registry.set(`vscodeIdeConfig`,`directoryBundles`,c),t.registry.set(`vscodeIdeConfig`,`emittedFiles`,s),t.registry.set(`vscodeIdeConfig`,`targetDir`,i)},async writeBundle(t,a){if(!r){t.log.debug(`VSCodeIDEConfigPlugin: File emission disabled`);return}let{files:o}=a,s=o.filter(t=>t.inputType===e.CONFIG_FILE&&t.fileName.includes(`.vscode`)),l=t.paths.resolve(i);if(n){t.log.debug(`VSCodeIDEConfigPlugin: Cleaning target directory`);try{await t.fs.cleanDir(l)}catch(e){let n=e instanceof Error?e.message:String(e);t.log.warn(`VSCodeIDEConfigPlugin: Failed to clean target directory: ${n}`)}}await t.fs.ensureDir(l);let u=0;for(let e of c)try{let n=e.path,r=l;t.log.debug(`VSCodeIDEConfigPlugin: Copying directory ${n} to ${r}`);let i=await Z(t,n,r);u+=i}catch(e){let n=e instanceof Error?e.message:String(e);t.log.error(`VSCodeIDEConfigPlugin: Failed to copy directory: ${n}`)}for(let e of s)try{let n=e.fileName.replace(/^\.vscode[\\/]?/,``),r=t.path.join(l,n),i=t.path.dirname(r);await t.fs.ensureDir(i),await t.fs.writeFile(r,e.source),u++,t.log.debug(`VSCodeIDEConfigPlugin: Wrote ${r}`)}catch(n){let r=n instanceof Error?n.message:String(n);t.log.error(`VSCodeIDEConfigPlugin: Failed to write ${e.fileName}: ${r}`)}u>0&&t.log.info(`VSCodeIDEConfigPlugin: Wrote ${u} file(s) to .vscode/`)}}}const et=[`node_modules`,`.git`,`dist`,`build`,`.cache`,`coverage`],tt=[`.editorconfig`,`.vscode/settings.json`,`.idea`];function nt(e={}){let{workspaceGroupDir:t=n,excludePatterns:r=et,configFilePatterns:i=tt}=e;return{name:`workspaceGroupInput`,priority:10,async scan(e){let n=[],a=[],o=e.config.options?.excludePatterns??[],s=[...new Set([...r,...o])];if(!await e.fs.exists(t))return e.log.warn(`Workspace group directory not found: ${t}`),e.registry.set(`workspaceGroupInput`,`workspaces`,[]),n;e.log.debug(`Scanning workspace group: ${t}`);try{let r=await e.fs.readdir(t,{withFileTypes:!0});for(let o of r){if(typeof o==`string`||!o.isDirectory()||s.includes(o.name))continue;if(m(o.name,s)){e.log.debug(`Skipping excluded path: ${o.name}`);continue}let r=e.paths.resolve(t,o.name),c=await rt(e,o.name,r,i);if(c!=null){if(a.push(c),c.hasAgentsMd){let t=await it(e,e.path.join(r,`AGENTS.md`),o.name);t!=null&&n.push(t)}for(let t of c.configFiles){let r=await at(e,t,o.name);r!=null&&n.push(r)}}}}catch(t){let n=t instanceof Error?t.message:String(t);e.log.error(`Failed to scan workspace group: ${n}`)}return e.registry.set(`workspaceGroupInput`,`workspaces`,a),e.log.info(`Discovered ${a.length} workspace(s) in ${t}`),n}}}async function rt(e,t,n,r){try{if(!(await e.fs.stat(n)).isDirectory())return null;let i=e.path.join(n,`AGENTS.md`),a=await e.fs.exists(i),o=[];for(let t of r){let r=e.path.join(n,t);!t.includes(`/`)&&!t.includes(`.`)?await e.fs.exists(r)&&(await e.fs.stat(r)).isDirectory()&&o.push(r):await e.fs.exists(r)&&o.push(r)}return{name:t,path:n,hasAgentsMd:a,configFiles:o}}catch(n){return e.log.debug(`Failed to scan workspace ${t}: ${n instanceof Error?n.message:String(n)}`),null}}async function it(t,n,r){try{let i=await t.fs.readFile(n),{frontMatter:a}=t.capabilities.frontMatter.parse(i);return{type:e.MEMORY_PROMPT,path:n,content:i,frontMatter:a,sourceProject:r}}catch(e){return t.log.debug(`Failed to read AGENTS.md from ${r}: ${e instanceof Error?e.message:String(e)}`),null}}async function at(t,n,r){try{if((await t.fs.stat(n)).isDirectory())return{type:e.CONFIG_FILE,path:n,content:``,sourceProject:r};let i=await t.fs.readFile(n);return{type:e.CONFIG_FILE,path:n,content:i,sourceProject:r}}catch(e){return t.log.debug(`Failed to read config file ${n}: ${e instanceof Error?e.message:String(e)}`),null}}const Q=t.forProject(`aindex`),$={aindexDistDir:Q.dist(),refDir:Q.ref(),excludePatterns:[`ref/*/dist`],workspaceGroupsDir:n};function ot(e){let t={...$,...e};return[nt(),Ge({refDir:t.refDir,excludePatterns:t.excludePatterns}),ee({distDir:t.aindexDistDir,excludePatterns:t.excludePatterns})]}const st=ot(),ct=[p(),O(),we(),de(),ve(),Le(),Ue(),re(),ce(),F(),V(),Ae(),$e(),_e()];var lt={plugins:[],options:{parallel:!1,onError:`continue`,logLevel:`info`,excludePatterns:$.excludePatterns}};export{lt as default,st as inputPlugins,ct as outputPlugins};
package/package.json ADDED
@@ -0,0 +1,71 @@
1
+ {
2
+ "name": "@truenine/memory-sync-cli",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "description": "TrueNine Life CLI Tools",
6
+ "author": "TrueNine",
7
+ "license": "UNLICENSED",
8
+ "homepage": "https://github.com/TrueNine/memory-sync-cli",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/TrueNine/memory-sync-cli.git",
12
+ "directory": "_ai/scripts"
13
+ },
14
+ "exports": {
15
+ ".": "./dist/index.mjs",
16
+ "./package.json": "./package.json"
17
+ },
18
+ "main": "./dist/index.mjs",
19
+ "module": "./dist/index.mjs",
20
+ "bin": {
21
+ "tnmsc": "./dist/index.mjs"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "engines": {
27
+ "node": ">= 25.2.1"
28
+ },
29
+ "publishConfig": {
30
+ "access": "public",
31
+ "registry": "https://registry.npmjs.org/"
32
+ },
33
+ "dependencies": {
34
+ "@clack/prompts": "^0.11.0",
35
+ "fast-glob": "^3.3.3",
36
+ "fs-extra": "^11.3.2",
37
+ "picocolors": "^1.1.1",
38
+ "picomatch": "^4.0.3",
39
+ "remark-frontmatter": "^5.0.0",
40
+ "remark-gfm": "^4.0.1",
41
+ "remark-parse": "^11.0.0",
42
+ "remark-stringify": "^11.0.0",
43
+ "unified": "^11.0.5",
44
+ "winston": "^3.19.0",
45
+ "yaml": "^2.8.2"
46
+ },
47
+ "devDependencies": {
48
+ "@truenine/eslint9-config": "^1.0.19",
49
+ "@types/fs-extra": "^11.0.4",
50
+ "@types/mdast": "^4.0.4",
51
+ "@types/node": "^25.0.1",
52
+ "@types/picomatch": "^4.0.2",
53
+ "@vitest/coverage-v8": "4.0.15",
54
+ "eslint": "^9.39.1",
55
+ "fast-check": "^4.4.0",
56
+ "tsdown": "0.17.3",
57
+ "tsx": "^4.21.0",
58
+ "typescript": "^5.9.3",
59
+ "vite": "^7.2.7",
60
+ "vitest": "^4.0.15"
61
+ },
62
+ "scripts": {
63
+ "dev": "tsx src/index.ts",
64
+ "build": "tsc --noEmit -p tsconfig.lib.json && eslint --fix && tsdown",
65
+ "build:tsdown": "tsdown",
66
+ "test": "vitest run",
67
+ "test:watch": "vitest",
68
+ "lint": "eslint --fix",
69
+ "type-check": "tsc --noEmit -p tsconfig.lib.json"
70
+ }
71
+ }