@sunasteriskrnd/takumi 1.0.0-dev.33 → 1.0.0-dev.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +528 -2182
- package/package.json +1 -6
package/dist/index.js
CHANGED
|
@@ -2732,14 +2732,14 @@ var init_get_east_asian_width = __esm(() => {
|
|
|
2732
2732
|
init_lookup();
|
|
2733
2733
|
});
|
|
2734
2734
|
|
|
2735
|
-
// node_modules/
|
|
2735
|
+
// node_modules/emoji-regex/index.js
|
|
2736
2736
|
var require_emoji_regex = __commonJS((exports, module) => {
|
|
2737
2737
|
module.exports = () => {
|
|
2738
2738
|
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\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?|[\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](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\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-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED8\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDD1D\uDEEF]\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE]|[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE]|\uDEEF\u200D\uD83D\uDC69\uD83C[\uDFFB-\uDFFE])))?))?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE8A\uDE8E-\uDEC2\uDEC6\uDEC8\uDECD-\uDEDC\uDEDF-\uDEEA\uDEEF]|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC30\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3\uDE70]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF]|\uDEEF\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
2739
2739
|
};
|
|
2740
2740
|
});
|
|
2741
2741
|
|
|
2742
|
-
// node_modules/
|
|
2742
|
+
// node_modules/string-width/index.js
|
|
2743
2743
|
function stringWidth(string, options2 = {}) {
|
|
2744
2744
|
if (typeof string !== "string" || string.length === 0) {
|
|
2745
2745
|
return 0;
|
|
@@ -19815,7 +19815,7 @@ var package_default;
|
|
|
19815
19815
|
var init_package = __esm(() => {
|
|
19816
19816
|
package_default = {
|
|
19817
19817
|
name: "@sunasteriskrnd/takumi",
|
|
19818
|
-
version: "1.0.0-dev.
|
|
19818
|
+
version: "1.0.0-dev.35",
|
|
19819
19819
|
description: "CLI tool for bootstrapping and managing Takumi projects",
|
|
19820
19820
|
type: "module",
|
|
19821
19821
|
repository: {
|
|
@@ -19874,15 +19874,12 @@ var init_package = __esm(() => {
|
|
|
19874
19874
|
"@clack/prompts": "^0.7.0",
|
|
19875
19875
|
"@octokit/rest": "^22.0.0",
|
|
19876
19876
|
"@supabase/supabase-js": "^2.106.1",
|
|
19877
|
-
"better-sqlite3": "^12.6.2",
|
|
19878
19877
|
cac: "^6.7.14",
|
|
19879
|
-
"cli-progress": "^3.12.0",
|
|
19880
19878
|
"compare-versions": "^6.1.1",
|
|
19881
19879
|
diff: "^8.0.3",
|
|
19882
19880
|
"fs-extra": "^11.2.0",
|
|
19883
19881
|
"gray-matter": "^4.0.3",
|
|
19884
19882
|
ignore: "^5.3.2",
|
|
19885
|
-
minimatch: "^10.1.1",
|
|
19886
19883
|
open: "^10.1.0",
|
|
19887
19884
|
ora: "^8.0.0",
|
|
19888
19885
|
"p-limit": "^7.2.0",
|
|
@@ -19900,9 +19897,7 @@ var init_package = __esm(() => {
|
|
|
19900
19897
|
"@biomejs/biome": "^1.9.4",
|
|
19901
19898
|
"@semantic-release/changelog": "^6.0.3",
|
|
19902
19899
|
"@semantic-release/git": "^10.0.1",
|
|
19903
|
-
"@types/better-sqlite3": "^7.6.13",
|
|
19904
19900
|
"@types/bun": "latest",
|
|
19905
|
-
"@types/cli-progress": "^3.11.6",
|
|
19906
19901
|
"@types/diff": "^8.0.0",
|
|
19907
19902
|
"@types/fs-extra": "^11.0.4",
|
|
19908
19903
|
"@types/node": "^22.19.7",
|
|
@@ -29249,1673 +29244,21 @@ var init_selective_merger = __esm(() => {
|
|
|
29249
29244
|
import_semver = __toESM(require_semver2(), 1);
|
|
29250
29245
|
});
|
|
29251
29246
|
|
|
29252
|
-
// node_modules/balanced-match/dist/esm/index.js
|
|
29253
|
-
var balanced = (a3, b3, str2) => {
|
|
29254
|
-
const ma = a3 instanceof RegExp ? maybeMatch(a3, str2) : a3;
|
|
29255
|
-
const mb = b3 instanceof RegExp ? maybeMatch(b3, str2) : b3;
|
|
29256
|
-
const r2 = ma !== null && mb != null && range(ma, mb, str2);
|
|
29257
|
-
return r2 && {
|
|
29258
|
-
start: r2[0],
|
|
29259
|
-
end: r2[1],
|
|
29260
|
-
pre: str2.slice(0, r2[0]),
|
|
29261
|
-
body: str2.slice(r2[0] + ma.length, r2[1]),
|
|
29262
|
-
post: str2.slice(r2[1] + mb.length)
|
|
29263
|
-
};
|
|
29264
|
-
}, maybeMatch = (reg, str2) => {
|
|
29265
|
-
const m2 = str2.match(reg);
|
|
29266
|
-
return m2 ? m2[0] : null;
|
|
29267
|
-
}, range = (a3, b3, str2) => {
|
|
29268
|
-
let begs, beg, left, right = undefined, result;
|
|
29269
|
-
let ai = str2.indexOf(a3);
|
|
29270
|
-
let bi = str2.indexOf(b3, ai + 1);
|
|
29271
|
-
let i = ai;
|
|
29272
|
-
if (ai >= 0 && bi > 0) {
|
|
29273
|
-
if (a3 === b3) {
|
|
29274
|
-
return [ai, bi];
|
|
29275
|
-
}
|
|
29276
|
-
begs = [];
|
|
29277
|
-
left = str2.length;
|
|
29278
|
-
while (i >= 0 && !result) {
|
|
29279
|
-
if (i === ai) {
|
|
29280
|
-
begs.push(i);
|
|
29281
|
-
ai = str2.indexOf(a3, i + 1);
|
|
29282
|
-
} else if (begs.length === 1) {
|
|
29283
|
-
const r2 = begs.pop();
|
|
29284
|
-
if (r2 !== undefined)
|
|
29285
|
-
result = [r2, bi];
|
|
29286
|
-
} else {
|
|
29287
|
-
beg = begs.pop();
|
|
29288
|
-
if (beg !== undefined && beg < left) {
|
|
29289
|
-
left = beg;
|
|
29290
|
-
right = bi;
|
|
29291
|
-
}
|
|
29292
|
-
bi = str2.indexOf(b3, i + 1);
|
|
29293
|
-
}
|
|
29294
|
-
i = ai < bi && ai >= 0 ? ai : bi;
|
|
29295
|
-
}
|
|
29296
|
-
if (begs.length && right !== undefined) {
|
|
29297
|
-
result = [left, right];
|
|
29298
|
-
}
|
|
29299
|
-
}
|
|
29300
|
-
return result;
|
|
29301
|
-
};
|
|
29302
|
-
|
|
29303
|
-
// node_modules/brace-expansion/dist/esm/index.js
|
|
29304
|
-
function numeric(str2) {
|
|
29305
|
-
return !isNaN(str2) ? parseInt(str2, 10) : str2.charCodeAt(0);
|
|
29306
|
-
}
|
|
29307
|
-
function escapeBraces(str2) {
|
|
29308
|
-
return str2.replace(slashPattern, escSlash).replace(openPattern, escOpen).replace(closePattern, escClose).replace(commaPattern, escComma).replace(periodPattern, escPeriod);
|
|
29309
|
-
}
|
|
29310
|
-
function unescapeBraces(str2) {
|
|
29311
|
-
return str2.replace(escSlashPattern, "\\").replace(escOpenPattern, "{").replace(escClosePattern, "}").replace(escCommaPattern, ",").replace(escPeriodPattern, ".");
|
|
29312
|
-
}
|
|
29313
|
-
function parseCommaParts(str2) {
|
|
29314
|
-
if (!str2) {
|
|
29315
|
-
return [""];
|
|
29316
|
-
}
|
|
29317
|
-
const parts = [];
|
|
29318
|
-
const m2 = balanced("{", "}", str2);
|
|
29319
|
-
if (!m2) {
|
|
29320
|
-
return str2.split(",");
|
|
29321
|
-
}
|
|
29322
|
-
const { pre, body, post: post2 } = m2;
|
|
29323
|
-
const p = pre.split(",");
|
|
29324
|
-
p[p.length - 1] += "{" + body + "}";
|
|
29325
|
-
const postParts = parseCommaParts(post2);
|
|
29326
|
-
if (post2.length) {
|
|
29327
|
-
p[p.length - 1] += postParts.shift();
|
|
29328
|
-
p.push.apply(p, postParts);
|
|
29329
|
-
}
|
|
29330
|
-
parts.push.apply(parts, p);
|
|
29331
|
-
return parts;
|
|
29332
|
-
}
|
|
29333
|
-
function expand(str2, options2 = {}) {
|
|
29334
|
-
if (!str2) {
|
|
29335
|
-
return [];
|
|
29336
|
-
}
|
|
29337
|
-
const { max = EXPANSION_MAX } = options2;
|
|
29338
|
-
if (str2.slice(0, 2) === "{}") {
|
|
29339
|
-
str2 = "\\{\\}" + str2.slice(2);
|
|
29340
|
-
}
|
|
29341
|
-
return expand_(escapeBraces(str2), max, true).map(unescapeBraces);
|
|
29342
|
-
}
|
|
29343
|
-
function embrace(str2) {
|
|
29344
|
-
return "{" + str2 + "}";
|
|
29345
|
-
}
|
|
29346
|
-
function isPadded(el) {
|
|
29347
|
-
return /^-?0\d/.test(el);
|
|
29348
|
-
}
|
|
29349
|
-
function lte(i, y3) {
|
|
29350
|
-
return i <= y3;
|
|
29351
|
-
}
|
|
29352
|
-
function gte(i, y3) {
|
|
29353
|
-
return i >= y3;
|
|
29354
|
-
}
|
|
29355
|
-
function expand_(str2, max, isTop) {
|
|
29356
|
-
const expansions = [];
|
|
29357
|
-
const m2 = balanced("{", "}", str2);
|
|
29358
|
-
if (!m2)
|
|
29359
|
-
return [str2];
|
|
29360
|
-
const pre = m2.pre;
|
|
29361
|
-
const post2 = m2.post.length ? expand_(m2.post, max, false) : [""];
|
|
29362
|
-
if (/\$$/.test(m2.pre)) {
|
|
29363
|
-
for (let k2 = 0;k2 < post2.length && k2 < max; k2++) {
|
|
29364
|
-
const expansion = pre + "{" + m2.body + "}" + post2[k2];
|
|
29365
|
-
expansions.push(expansion);
|
|
29366
|
-
}
|
|
29367
|
-
} else {
|
|
29368
|
-
const isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m2.body);
|
|
29369
|
-
const isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m2.body);
|
|
29370
|
-
const isSequence = isNumericSequence || isAlphaSequence;
|
|
29371
|
-
const isOptions = m2.body.indexOf(",") >= 0;
|
|
29372
|
-
if (!isSequence && !isOptions) {
|
|
29373
|
-
if (m2.post.match(/,(?!,).*\}/)) {
|
|
29374
|
-
str2 = m2.pre + "{" + m2.body + escClose + m2.post;
|
|
29375
|
-
return expand_(str2, max, true);
|
|
29376
|
-
}
|
|
29377
|
-
return [str2];
|
|
29378
|
-
}
|
|
29379
|
-
let n;
|
|
29380
|
-
if (isSequence) {
|
|
29381
|
-
n = m2.body.split(/\.\./);
|
|
29382
|
-
} else {
|
|
29383
|
-
n = parseCommaParts(m2.body);
|
|
29384
|
-
if (n.length === 1 && n[0] !== undefined) {
|
|
29385
|
-
n = expand_(n[0], max, false).map(embrace);
|
|
29386
|
-
if (n.length === 1) {
|
|
29387
|
-
return post2.map((p) => m2.pre + n[0] + p);
|
|
29388
|
-
}
|
|
29389
|
-
}
|
|
29390
|
-
}
|
|
29391
|
-
let N2;
|
|
29392
|
-
if (isSequence && n[0] !== undefined && n[1] !== undefined) {
|
|
29393
|
-
const x3 = numeric(n[0]);
|
|
29394
|
-
const y3 = numeric(n[1]);
|
|
29395
|
-
const width = Math.max(n[0].length, n[1].length);
|
|
29396
|
-
let incr = n.length === 3 && n[2] !== undefined ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
29397
|
-
let test = lte;
|
|
29398
|
-
const reverse = y3 < x3;
|
|
29399
|
-
if (reverse) {
|
|
29400
|
-
incr *= -1;
|
|
29401
|
-
test = gte;
|
|
29402
|
-
}
|
|
29403
|
-
const pad = n.some(isPadded);
|
|
29404
|
-
N2 = [];
|
|
29405
|
-
for (let i = x3;test(i, y3); i += incr) {
|
|
29406
|
-
let c2;
|
|
29407
|
-
if (isAlphaSequence) {
|
|
29408
|
-
c2 = String.fromCharCode(i);
|
|
29409
|
-
if (c2 === "\\") {
|
|
29410
|
-
c2 = "";
|
|
29411
|
-
}
|
|
29412
|
-
} else {
|
|
29413
|
-
c2 = String(i);
|
|
29414
|
-
if (pad) {
|
|
29415
|
-
const need = width - c2.length;
|
|
29416
|
-
if (need > 0) {
|
|
29417
|
-
const z3 = new Array(need + 1).join("0");
|
|
29418
|
-
if (i < 0) {
|
|
29419
|
-
c2 = "-" + z3 + c2.slice(1);
|
|
29420
|
-
} else {
|
|
29421
|
-
c2 = z3 + c2;
|
|
29422
|
-
}
|
|
29423
|
-
}
|
|
29424
|
-
}
|
|
29425
|
-
}
|
|
29426
|
-
N2.push(c2);
|
|
29427
|
-
}
|
|
29428
|
-
} else {
|
|
29429
|
-
N2 = [];
|
|
29430
|
-
for (let j2 = 0;j2 < n.length; j2++) {
|
|
29431
|
-
N2.push.apply(N2, expand_(n[j2], max, false));
|
|
29432
|
-
}
|
|
29433
|
-
}
|
|
29434
|
-
for (let j2 = 0;j2 < N2.length; j2++) {
|
|
29435
|
-
for (let k2 = 0;k2 < post2.length && expansions.length < max; k2++) {
|
|
29436
|
-
const expansion = pre + N2[j2] + post2[k2];
|
|
29437
|
-
if (!isTop || isSequence || expansion) {
|
|
29438
|
-
expansions.push(expansion);
|
|
29439
|
-
}
|
|
29440
|
-
}
|
|
29441
|
-
}
|
|
29442
|
-
}
|
|
29443
|
-
return expansions;
|
|
29444
|
-
}
|
|
29445
|
-
var escSlash, escOpen, escClose, escComma, escPeriod, escSlashPattern, escOpenPattern, escClosePattern, escCommaPattern, escPeriodPattern, slashPattern, openPattern, closePattern, commaPattern, periodPattern, EXPANSION_MAX = 1e5;
|
|
29446
|
-
var init_esm = __esm(() => {
|
|
29447
|
-
escSlash = "\x00SLASH" + Math.random() + "\x00";
|
|
29448
|
-
escOpen = "\x00OPEN" + Math.random() + "\x00";
|
|
29449
|
-
escClose = "\x00CLOSE" + Math.random() + "\x00";
|
|
29450
|
-
escComma = "\x00COMMA" + Math.random() + "\x00";
|
|
29451
|
-
escPeriod = "\x00PERIOD" + Math.random() + "\x00";
|
|
29452
|
-
escSlashPattern = new RegExp(escSlash, "g");
|
|
29453
|
-
escOpenPattern = new RegExp(escOpen, "g");
|
|
29454
|
-
escClosePattern = new RegExp(escClose, "g");
|
|
29455
|
-
escCommaPattern = new RegExp(escComma, "g");
|
|
29456
|
-
escPeriodPattern = new RegExp(escPeriod, "g");
|
|
29457
|
-
slashPattern = /\\\\/g;
|
|
29458
|
-
openPattern = /\\{/g;
|
|
29459
|
-
closePattern = /\\}/g;
|
|
29460
|
-
commaPattern = /\\,/g;
|
|
29461
|
-
periodPattern = /\\\./g;
|
|
29462
|
-
});
|
|
29463
|
-
|
|
29464
|
-
// node_modules/minimatch/dist/esm/assert-valid-pattern.js
|
|
29465
|
-
var MAX_PATTERN_LENGTH, assertValidPattern = (pattern) => {
|
|
29466
|
-
if (typeof pattern !== "string") {
|
|
29467
|
-
throw new TypeError("invalid pattern");
|
|
29468
|
-
}
|
|
29469
|
-
if (pattern.length > MAX_PATTERN_LENGTH) {
|
|
29470
|
-
throw new TypeError("pattern is too long");
|
|
29471
|
-
}
|
|
29472
|
-
};
|
|
29473
|
-
var init_assert_valid_pattern = __esm(() => {
|
|
29474
|
-
MAX_PATTERN_LENGTH = 1024 * 64;
|
|
29475
|
-
});
|
|
29476
|
-
|
|
29477
|
-
// node_modules/minimatch/dist/esm/brace-expressions.js
|
|
29478
|
-
var posixClasses, braceEscape = (s) => s.replace(/[[\]\\-]/g, "\\$&"), regexpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), rangesToString = (ranges) => ranges.join(""), parseClass = (glob, position) => {
|
|
29479
|
-
const pos = position;
|
|
29480
|
-
if (glob.charAt(pos) !== "[") {
|
|
29481
|
-
throw new Error("not in a brace expression");
|
|
29482
|
-
}
|
|
29483
|
-
const ranges = [];
|
|
29484
|
-
const negs = [];
|
|
29485
|
-
let i = pos + 1;
|
|
29486
|
-
let sawStart = false;
|
|
29487
|
-
let uflag = false;
|
|
29488
|
-
let escaping = false;
|
|
29489
|
-
let negate = false;
|
|
29490
|
-
let endPos = pos;
|
|
29491
|
-
let rangeStart = "";
|
|
29492
|
-
WHILE:
|
|
29493
|
-
while (i < glob.length) {
|
|
29494
|
-
const c2 = glob.charAt(i);
|
|
29495
|
-
if ((c2 === "!" || c2 === "^") && i === pos + 1) {
|
|
29496
|
-
negate = true;
|
|
29497
|
-
i++;
|
|
29498
|
-
continue;
|
|
29499
|
-
}
|
|
29500
|
-
if (c2 === "]" && sawStart && !escaping) {
|
|
29501
|
-
endPos = i + 1;
|
|
29502
|
-
break;
|
|
29503
|
-
}
|
|
29504
|
-
sawStart = true;
|
|
29505
|
-
if (c2 === "\\") {
|
|
29506
|
-
if (!escaping) {
|
|
29507
|
-
escaping = true;
|
|
29508
|
-
i++;
|
|
29509
|
-
continue;
|
|
29510
|
-
}
|
|
29511
|
-
}
|
|
29512
|
-
if (c2 === "[" && !escaping) {
|
|
29513
|
-
for (const [cls, [unip, u, neg]] of Object.entries(posixClasses)) {
|
|
29514
|
-
if (glob.startsWith(cls, i)) {
|
|
29515
|
-
if (rangeStart) {
|
|
29516
|
-
return ["$.", false, glob.length - pos, true];
|
|
29517
|
-
}
|
|
29518
|
-
i += cls.length;
|
|
29519
|
-
if (neg)
|
|
29520
|
-
negs.push(unip);
|
|
29521
|
-
else
|
|
29522
|
-
ranges.push(unip);
|
|
29523
|
-
uflag = uflag || u;
|
|
29524
|
-
continue WHILE;
|
|
29525
|
-
}
|
|
29526
|
-
}
|
|
29527
|
-
}
|
|
29528
|
-
escaping = false;
|
|
29529
|
-
if (rangeStart) {
|
|
29530
|
-
if (c2 > rangeStart) {
|
|
29531
|
-
ranges.push(braceEscape(rangeStart) + "-" + braceEscape(c2));
|
|
29532
|
-
} else if (c2 === rangeStart) {
|
|
29533
|
-
ranges.push(braceEscape(c2));
|
|
29534
|
-
}
|
|
29535
|
-
rangeStart = "";
|
|
29536
|
-
i++;
|
|
29537
|
-
continue;
|
|
29538
|
-
}
|
|
29539
|
-
if (glob.startsWith("-]", i + 1)) {
|
|
29540
|
-
ranges.push(braceEscape(c2 + "-"));
|
|
29541
|
-
i += 2;
|
|
29542
|
-
continue;
|
|
29543
|
-
}
|
|
29544
|
-
if (glob.startsWith("-", i + 1)) {
|
|
29545
|
-
rangeStart = c2;
|
|
29546
|
-
i += 2;
|
|
29547
|
-
continue;
|
|
29548
|
-
}
|
|
29549
|
-
ranges.push(braceEscape(c2));
|
|
29550
|
-
i++;
|
|
29551
|
-
}
|
|
29552
|
-
if (endPos < i) {
|
|
29553
|
-
return ["", false, 0, false];
|
|
29554
|
-
}
|
|
29555
|
-
if (!ranges.length && !negs.length) {
|
|
29556
|
-
return ["$.", false, glob.length - pos, true];
|
|
29557
|
-
}
|
|
29558
|
-
if (negs.length === 0 && ranges.length === 1 && /^\\?.$/.test(ranges[0]) && !negate) {
|
|
29559
|
-
const r2 = ranges[0].length === 2 ? ranges[0].slice(-1) : ranges[0];
|
|
29560
|
-
return [regexpEscape(r2), false, endPos - pos, false];
|
|
29561
|
-
}
|
|
29562
|
-
const sranges = "[" + (negate ? "^" : "") + rangesToString(ranges) + "]";
|
|
29563
|
-
const snegs = "[" + (negate ? "" : "^") + rangesToString(negs) + "]";
|
|
29564
|
-
const comb = ranges.length && negs.length ? "(" + sranges + "|" + snegs + ")" : ranges.length ? sranges : snegs;
|
|
29565
|
-
return [comb, uflag, endPos - pos, true];
|
|
29566
|
-
};
|
|
29567
|
-
var init_brace_expressions = __esm(() => {
|
|
29568
|
-
posixClasses = {
|
|
29569
|
-
"[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", true],
|
|
29570
|
-
"[:alpha:]": ["\\p{L}\\p{Nl}", true],
|
|
29571
|
-
"[:ascii:]": ["\\x" + "00-\\x" + "7f", false],
|
|
29572
|
-
"[:blank:]": ["\\p{Zs}\\t", true],
|
|
29573
|
-
"[:cntrl:]": ["\\p{Cc}", true],
|
|
29574
|
-
"[:digit:]": ["\\p{Nd}", true],
|
|
29575
|
-
"[:graph:]": ["\\p{Z}\\p{C}", true, true],
|
|
29576
|
-
"[:lower:]": ["\\p{Ll}", true],
|
|
29577
|
-
"[:print:]": ["\\p{C}", true],
|
|
29578
|
-
"[:punct:]": ["\\p{P}", true],
|
|
29579
|
-
"[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", true],
|
|
29580
|
-
"[:upper:]": ["\\p{Lu}", true],
|
|
29581
|
-
"[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", true],
|
|
29582
|
-
"[:xdigit:]": ["A-Fa-f0-9", false]
|
|
29583
|
-
};
|
|
29584
|
-
});
|
|
29585
|
-
|
|
29586
|
-
// node_modules/minimatch/dist/esm/unescape.js
|
|
29587
|
-
var unescape = (s, { windowsPathsNoEscape = false, magicalBraces = true } = {}) => {
|
|
29588
|
-
if (magicalBraces) {
|
|
29589
|
-
return windowsPathsNoEscape ? s.replace(/\[([^/\\])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\])\]/g, "$1$2").replace(/\\([^/])/g, "$1");
|
|
29590
|
-
}
|
|
29591
|
-
return windowsPathsNoEscape ? s.replace(/\[([^/\\{}])\]/g, "$1") : s.replace(/((?!\\).|^)\[([^/\\{}])\]/g, "$1$2").replace(/\\([^/{}])/g, "$1");
|
|
29592
|
-
};
|
|
29593
|
-
|
|
29594
|
-
// node_modules/minimatch/dist/esm/ast.js
|
|
29595
|
-
var _a, types2, isExtglobType = (c2) => types2.has(c2), isExtglobAST = (c2) => isExtglobType(c2.type), adoptionMap, adoptionWithSpaceMap, adoptionAnyMap, usurpMap, startNoTraversal = "(?!(?:^|/)\\.\\.?(?:$|/))", startNoDot = "(?!\\.)", addPatternStart, justDots, reSpecials, regExpEscape = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), qmark = "[^/]", star, starNoEmpty, ID = 0, AST;
|
|
29596
|
-
var init_ast = __esm(() => {
|
|
29597
|
-
init_brace_expressions();
|
|
29598
|
-
types2 = new Set(["!", "?", "+", "*", "@"]);
|
|
29599
|
-
adoptionMap = new Map([
|
|
29600
|
-
["!", ["@"]],
|
|
29601
|
-
["?", ["?", "@"]],
|
|
29602
|
-
["@", ["@"]],
|
|
29603
|
-
["*", ["*", "+", "?", "@"]],
|
|
29604
|
-
["+", ["+", "@"]]
|
|
29605
|
-
]);
|
|
29606
|
-
adoptionWithSpaceMap = new Map([
|
|
29607
|
-
["!", ["?"]],
|
|
29608
|
-
["@", ["?"]],
|
|
29609
|
-
["+", ["?", "*"]]
|
|
29610
|
-
]);
|
|
29611
|
-
adoptionAnyMap = new Map([
|
|
29612
|
-
["!", ["?", "@"]],
|
|
29613
|
-
["?", ["?", "@"]],
|
|
29614
|
-
["@", ["?", "@"]],
|
|
29615
|
-
["*", ["*", "+", "?", "@"]],
|
|
29616
|
-
["+", ["+", "@", "?", "*"]]
|
|
29617
|
-
]);
|
|
29618
|
-
usurpMap = new Map([
|
|
29619
|
-
["!", new Map([["!", "@"]])],
|
|
29620
|
-
[
|
|
29621
|
-
"?",
|
|
29622
|
-
new Map([
|
|
29623
|
-
["*", "*"],
|
|
29624
|
-
["+", "*"]
|
|
29625
|
-
])
|
|
29626
|
-
],
|
|
29627
|
-
[
|
|
29628
|
-
"@",
|
|
29629
|
-
new Map([
|
|
29630
|
-
["!", "!"],
|
|
29631
|
-
["?", "?"],
|
|
29632
|
-
["@", "@"],
|
|
29633
|
-
["*", "*"],
|
|
29634
|
-
["+", "+"]
|
|
29635
|
-
])
|
|
29636
|
-
],
|
|
29637
|
-
[
|
|
29638
|
-
"+",
|
|
29639
|
-
new Map([
|
|
29640
|
-
["?", "*"],
|
|
29641
|
-
["*", "*"]
|
|
29642
|
-
])
|
|
29643
|
-
]
|
|
29644
|
-
]);
|
|
29645
|
-
addPatternStart = new Set(["[", "."]);
|
|
29646
|
-
justDots = new Set(["..", "."]);
|
|
29647
|
-
reSpecials = new Set("().*{}+?[]^$\\!");
|
|
29648
|
-
star = qmark + "*?";
|
|
29649
|
-
starNoEmpty = qmark + "+?";
|
|
29650
|
-
AST = class AST {
|
|
29651
|
-
type;
|
|
29652
|
-
#root;
|
|
29653
|
-
#hasMagic;
|
|
29654
|
-
#uflag = false;
|
|
29655
|
-
#parts = [];
|
|
29656
|
-
#parent;
|
|
29657
|
-
#parentIndex;
|
|
29658
|
-
#negs;
|
|
29659
|
-
#filledNegs = false;
|
|
29660
|
-
#options;
|
|
29661
|
-
#toString;
|
|
29662
|
-
#emptyExt = false;
|
|
29663
|
-
id = ++ID;
|
|
29664
|
-
get depth() {
|
|
29665
|
-
return (this.#parent?.depth ?? -1) + 1;
|
|
29666
|
-
}
|
|
29667
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
|
29668
|
-
return {
|
|
29669
|
-
"@@type": "AST",
|
|
29670
|
-
id: this.id,
|
|
29671
|
-
type: this.type,
|
|
29672
|
-
root: this.#root.id,
|
|
29673
|
-
parent: this.#parent?.id,
|
|
29674
|
-
depth: this.depth,
|
|
29675
|
-
partsLength: this.#parts.length,
|
|
29676
|
-
parts: this.#parts
|
|
29677
|
-
};
|
|
29678
|
-
}
|
|
29679
|
-
constructor(type, parent, options2 = {}) {
|
|
29680
|
-
this.type = type;
|
|
29681
|
-
if (type)
|
|
29682
|
-
this.#hasMagic = true;
|
|
29683
|
-
this.#parent = parent;
|
|
29684
|
-
this.#root = this.#parent ? this.#parent.#root : this;
|
|
29685
|
-
this.#options = this.#root === this ? options2 : this.#root.#options;
|
|
29686
|
-
this.#negs = this.#root === this ? [] : this.#root.#negs;
|
|
29687
|
-
if (type === "!" && !this.#root.#filledNegs)
|
|
29688
|
-
this.#negs.push(this);
|
|
29689
|
-
this.#parentIndex = this.#parent ? this.#parent.#parts.length : 0;
|
|
29690
|
-
}
|
|
29691
|
-
get hasMagic() {
|
|
29692
|
-
if (this.#hasMagic !== undefined)
|
|
29693
|
-
return this.#hasMagic;
|
|
29694
|
-
for (const p of this.#parts) {
|
|
29695
|
-
if (typeof p === "string")
|
|
29696
|
-
continue;
|
|
29697
|
-
if (p.type || p.hasMagic)
|
|
29698
|
-
return this.#hasMagic = true;
|
|
29699
|
-
}
|
|
29700
|
-
return this.#hasMagic;
|
|
29701
|
-
}
|
|
29702
|
-
toString() {
|
|
29703
|
-
return this.#toString !== undefined ? this.#toString : !this.type ? this.#toString = this.#parts.map((p) => String(p)).join("") : this.#toString = this.type + "(" + this.#parts.map((p) => String(p)).join("|") + ")";
|
|
29704
|
-
}
|
|
29705
|
-
#fillNegs() {
|
|
29706
|
-
if (this !== this.#root)
|
|
29707
|
-
throw new Error("should only call on root");
|
|
29708
|
-
if (this.#filledNegs)
|
|
29709
|
-
return this;
|
|
29710
|
-
this.toString();
|
|
29711
|
-
this.#filledNegs = true;
|
|
29712
|
-
let n;
|
|
29713
|
-
while (n = this.#negs.pop()) {
|
|
29714
|
-
if (n.type !== "!")
|
|
29715
|
-
continue;
|
|
29716
|
-
let p = n;
|
|
29717
|
-
let pp = p.#parent;
|
|
29718
|
-
while (pp) {
|
|
29719
|
-
for (let i = p.#parentIndex + 1;!pp.type && i < pp.#parts.length; i++) {
|
|
29720
|
-
for (const part of n.#parts) {
|
|
29721
|
-
if (typeof part === "string") {
|
|
29722
|
-
throw new Error("string part in extglob AST??");
|
|
29723
|
-
}
|
|
29724
|
-
part.copyIn(pp.#parts[i]);
|
|
29725
|
-
}
|
|
29726
|
-
}
|
|
29727
|
-
p = pp;
|
|
29728
|
-
pp = p.#parent;
|
|
29729
|
-
}
|
|
29730
|
-
}
|
|
29731
|
-
return this;
|
|
29732
|
-
}
|
|
29733
|
-
push(...parts) {
|
|
29734
|
-
for (const p of parts) {
|
|
29735
|
-
if (p === "")
|
|
29736
|
-
continue;
|
|
29737
|
-
if (typeof p !== "string" && !(p instanceof _a && p.#parent === this)) {
|
|
29738
|
-
throw new Error("invalid part: " + p);
|
|
29739
|
-
}
|
|
29740
|
-
this.#parts.push(p);
|
|
29741
|
-
}
|
|
29742
|
-
}
|
|
29743
|
-
toJSON() {
|
|
29744
|
-
const ret = this.type === null ? this.#parts.slice().map((p) => typeof p === "string" ? p : p.toJSON()) : [this.type, ...this.#parts.map((p) => p.toJSON())];
|
|
29745
|
-
if (this.isStart() && !this.type)
|
|
29746
|
-
ret.unshift([]);
|
|
29747
|
-
if (this.isEnd() && (this === this.#root || this.#root.#filledNegs && this.#parent?.type === "!")) {
|
|
29748
|
-
ret.push({});
|
|
29749
|
-
}
|
|
29750
|
-
return ret;
|
|
29751
|
-
}
|
|
29752
|
-
isStart() {
|
|
29753
|
-
if (this.#root === this)
|
|
29754
|
-
return true;
|
|
29755
|
-
if (!this.#parent?.isStart())
|
|
29756
|
-
return false;
|
|
29757
|
-
if (this.#parentIndex === 0)
|
|
29758
|
-
return true;
|
|
29759
|
-
const p = this.#parent;
|
|
29760
|
-
for (let i = 0;i < this.#parentIndex; i++) {
|
|
29761
|
-
const pp = p.#parts[i];
|
|
29762
|
-
if (!(pp instanceof _a && pp.type === "!")) {
|
|
29763
|
-
return false;
|
|
29764
|
-
}
|
|
29765
|
-
}
|
|
29766
|
-
return true;
|
|
29767
|
-
}
|
|
29768
|
-
isEnd() {
|
|
29769
|
-
if (this.#root === this)
|
|
29770
|
-
return true;
|
|
29771
|
-
if (this.#parent?.type === "!")
|
|
29772
|
-
return true;
|
|
29773
|
-
if (!this.#parent?.isEnd())
|
|
29774
|
-
return false;
|
|
29775
|
-
if (!this.type)
|
|
29776
|
-
return this.#parent?.isEnd();
|
|
29777
|
-
const pl = this.#parent ? this.#parent.#parts.length : 0;
|
|
29778
|
-
return this.#parentIndex === pl - 1;
|
|
29779
|
-
}
|
|
29780
|
-
copyIn(part) {
|
|
29781
|
-
if (typeof part === "string")
|
|
29782
|
-
this.push(part);
|
|
29783
|
-
else
|
|
29784
|
-
this.push(part.clone(this));
|
|
29785
|
-
}
|
|
29786
|
-
clone(parent) {
|
|
29787
|
-
const c2 = new _a(this.type, parent);
|
|
29788
|
-
for (const p of this.#parts) {
|
|
29789
|
-
c2.copyIn(p);
|
|
29790
|
-
}
|
|
29791
|
-
return c2;
|
|
29792
|
-
}
|
|
29793
|
-
static #parseAST(str2, ast, pos, opt, extDepth) {
|
|
29794
|
-
const maxDepth = opt.maxExtglobRecursion ?? 2;
|
|
29795
|
-
let escaping = false;
|
|
29796
|
-
let inBrace = false;
|
|
29797
|
-
let braceStart = -1;
|
|
29798
|
-
let braceNeg = false;
|
|
29799
|
-
if (ast.type === null) {
|
|
29800
|
-
let i2 = pos;
|
|
29801
|
-
let acc2 = "";
|
|
29802
|
-
while (i2 < str2.length) {
|
|
29803
|
-
const c2 = str2.charAt(i2++);
|
|
29804
|
-
if (escaping || c2 === "\\") {
|
|
29805
|
-
escaping = !escaping;
|
|
29806
|
-
acc2 += c2;
|
|
29807
|
-
continue;
|
|
29808
|
-
}
|
|
29809
|
-
if (inBrace) {
|
|
29810
|
-
if (i2 === braceStart + 1) {
|
|
29811
|
-
if (c2 === "^" || c2 === "!") {
|
|
29812
|
-
braceNeg = true;
|
|
29813
|
-
}
|
|
29814
|
-
} else if (c2 === "]" && !(i2 === braceStart + 2 && braceNeg)) {
|
|
29815
|
-
inBrace = false;
|
|
29816
|
-
}
|
|
29817
|
-
acc2 += c2;
|
|
29818
|
-
continue;
|
|
29819
|
-
} else if (c2 === "[") {
|
|
29820
|
-
inBrace = true;
|
|
29821
|
-
braceStart = i2;
|
|
29822
|
-
braceNeg = false;
|
|
29823
|
-
acc2 += c2;
|
|
29824
|
-
continue;
|
|
29825
|
-
}
|
|
29826
|
-
const doRecurse = !opt.noext && isExtglobType(c2) && str2.charAt(i2) === "(" && extDepth <= maxDepth;
|
|
29827
|
-
if (doRecurse) {
|
|
29828
|
-
ast.push(acc2);
|
|
29829
|
-
acc2 = "";
|
|
29830
|
-
const ext = new _a(c2, ast);
|
|
29831
|
-
i2 = _a.#parseAST(str2, ext, i2, opt, extDepth + 1);
|
|
29832
|
-
ast.push(ext);
|
|
29833
|
-
continue;
|
|
29834
|
-
}
|
|
29835
|
-
acc2 += c2;
|
|
29836
|
-
}
|
|
29837
|
-
ast.push(acc2);
|
|
29838
|
-
return i2;
|
|
29839
|
-
}
|
|
29840
|
-
let i = pos + 1;
|
|
29841
|
-
let part = new _a(null, ast);
|
|
29842
|
-
const parts = [];
|
|
29843
|
-
let acc = "";
|
|
29844
|
-
while (i < str2.length) {
|
|
29845
|
-
const c2 = str2.charAt(i++);
|
|
29846
|
-
if (escaping || c2 === "\\") {
|
|
29847
|
-
escaping = !escaping;
|
|
29848
|
-
acc += c2;
|
|
29849
|
-
continue;
|
|
29850
|
-
}
|
|
29851
|
-
if (inBrace) {
|
|
29852
|
-
if (i === braceStart + 1) {
|
|
29853
|
-
if (c2 === "^" || c2 === "!") {
|
|
29854
|
-
braceNeg = true;
|
|
29855
|
-
}
|
|
29856
|
-
} else if (c2 === "]" && !(i === braceStart + 2 && braceNeg)) {
|
|
29857
|
-
inBrace = false;
|
|
29858
|
-
}
|
|
29859
|
-
acc += c2;
|
|
29860
|
-
continue;
|
|
29861
|
-
} else if (c2 === "[") {
|
|
29862
|
-
inBrace = true;
|
|
29863
|
-
braceStart = i;
|
|
29864
|
-
braceNeg = false;
|
|
29865
|
-
acc += c2;
|
|
29866
|
-
continue;
|
|
29867
|
-
}
|
|
29868
|
-
const doRecurse = !opt.noext && isExtglobType(c2) && str2.charAt(i) === "(" && (extDepth <= maxDepth || ast && ast.#canAdoptType(c2));
|
|
29869
|
-
if (doRecurse) {
|
|
29870
|
-
const depthAdd = ast && ast.#canAdoptType(c2) ? 0 : 1;
|
|
29871
|
-
part.push(acc);
|
|
29872
|
-
acc = "";
|
|
29873
|
-
const ext = new _a(c2, part);
|
|
29874
|
-
part.push(ext);
|
|
29875
|
-
i = _a.#parseAST(str2, ext, i, opt, extDepth + depthAdd);
|
|
29876
|
-
continue;
|
|
29877
|
-
}
|
|
29878
|
-
if (c2 === "|") {
|
|
29879
|
-
part.push(acc);
|
|
29880
|
-
acc = "";
|
|
29881
|
-
parts.push(part);
|
|
29882
|
-
part = new _a(null, ast);
|
|
29883
|
-
continue;
|
|
29884
|
-
}
|
|
29885
|
-
if (c2 === ")") {
|
|
29886
|
-
if (acc === "" && ast.#parts.length === 0) {
|
|
29887
|
-
ast.#emptyExt = true;
|
|
29888
|
-
}
|
|
29889
|
-
part.push(acc);
|
|
29890
|
-
acc = "";
|
|
29891
|
-
ast.push(...parts, part);
|
|
29892
|
-
return i;
|
|
29893
|
-
}
|
|
29894
|
-
acc += c2;
|
|
29895
|
-
}
|
|
29896
|
-
ast.type = null;
|
|
29897
|
-
ast.#hasMagic = undefined;
|
|
29898
|
-
ast.#parts = [str2.substring(pos - 1)];
|
|
29899
|
-
return i;
|
|
29900
|
-
}
|
|
29901
|
-
#canAdoptWithSpace(child) {
|
|
29902
|
-
return this.#canAdopt(child, adoptionWithSpaceMap);
|
|
29903
|
-
}
|
|
29904
|
-
#canAdopt(child, map = adoptionMap) {
|
|
29905
|
-
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null) {
|
|
29906
|
-
return false;
|
|
29907
|
-
}
|
|
29908
|
-
const gc = child.#parts[0];
|
|
29909
|
-
if (!gc || typeof gc !== "object" || gc.type === null) {
|
|
29910
|
-
return false;
|
|
29911
|
-
}
|
|
29912
|
-
return this.#canAdoptType(gc.type, map);
|
|
29913
|
-
}
|
|
29914
|
-
#canAdoptType(c2, map = adoptionAnyMap) {
|
|
29915
|
-
return !!map.get(this.type)?.includes(c2);
|
|
29916
|
-
}
|
|
29917
|
-
#adoptWithSpace(child, index) {
|
|
29918
|
-
const gc = child.#parts[0];
|
|
29919
|
-
const blank = new _a(null, gc, this.options);
|
|
29920
|
-
blank.#parts.push("");
|
|
29921
|
-
gc.push(blank);
|
|
29922
|
-
this.#adopt(child, index);
|
|
29923
|
-
}
|
|
29924
|
-
#adopt(child, index) {
|
|
29925
|
-
const gc = child.#parts[0];
|
|
29926
|
-
this.#parts.splice(index, 1, ...gc.#parts);
|
|
29927
|
-
for (const p of gc.#parts) {
|
|
29928
|
-
if (typeof p === "object")
|
|
29929
|
-
p.#parent = this;
|
|
29930
|
-
}
|
|
29931
|
-
this.#toString = undefined;
|
|
29932
|
-
}
|
|
29933
|
-
#canUsurpType(c2) {
|
|
29934
|
-
const m2 = usurpMap.get(this.type);
|
|
29935
|
-
return !!m2?.has(c2);
|
|
29936
|
-
}
|
|
29937
|
-
#canUsurp(child) {
|
|
29938
|
-
if (!child || typeof child !== "object" || child.type !== null || child.#parts.length !== 1 || this.type === null || this.#parts.length !== 1) {
|
|
29939
|
-
return false;
|
|
29940
|
-
}
|
|
29941
|
-
const gc = child.#parts[0];
|
|
29942
|
-
if (!gc || typeof gc !== "object" || gc.type === null) {
|
|
29943
|
-
return false;
|
|
29944
|
-
}
|
|
29945
|
-
return this.#canUsurpType(gc.type);
|
|
29946
|
-
}
|
|
29947
|
-
#usurp(child) {
|
|
29948
|
-
const m2 = usurpMap.get(this.type);
|
|
29949
|
-
const gc = child.#parts[0];
|
|
29950
|
-
const nt = m2?.get(gc.type);
|
|
29951
|
-
if (!nt)
|
|
29952
|
-
return false;
|
|
29953
|
-
this.#parts = gc.#parts;
|
|
29954
|
-
for (const p of this.#parts) {
|
|
29955
|
-
if (typeof p === "object") {
|
|
29956
|
-
p.#parent = this;
|
|
29957
|
-
}
|
|
29958
|
-
}
|
|
29959
|
-
this.type = nt;
|
|
29960
|
-
this.#toString = undefined;
|
|
29961
|
-
this.#emptyExt = false;
|
|
29962
|
-
}
|
|
29963
|
-
static fromGlob(pattern, options2 = {}) {
|
|
29964
|
-
const ast = new _a(null, undefined, options2);
|
|
29965
|
-
_a.#parseAST(pattern, ast, 0, options2, 0);
|
|
29966
|
-
return ast;
|
|
29967
|
-
}
|
|
29968
|
-
toMMPattern() {
|
|
29969
|
-
if (this !== this.#root)
|
|
29970
|
-
return this.#root.toMMPattern();
|
|
29971
|
-
const glob = this.toString();
|
|
29972
|
-
const [re2, body, hasMagic, uflag] = this.toRegExpSource();
|
|
29973
|
-
const anyMagic = hasMagic || this.#hasMagic || this.#options.nocase && !this.#options.nocaseMagicOnly && glob.toUpperCase() !== glob.toLowerCase();
|
|
29974
|
-
if (!anyMagic) {
|
|
29975
|
-
return body;
|
|
29976
|
-
}
|
|
29977
|
-
const flags = (this.#options.nocase ? "i" : "") + (uflag ? "u" : "");
|
|
29978
|
-
return Object.assign(new RegExp(`^${re2}$`, flags), {
|
|
29979
|
-
_src: re2,
|
|
29980
|
-
_glob: glob
|
|
29981
|
-
});
|
|
29982
|
-
}
|
|
29983
|
-
get options() {
|
|
29984
|
-
return this.#options;
|
|
29985
|
-
}
|
|
29986
|
-
toRegExpSource(allowDot) {
|
|
29987
|
-
const dot = allowDot ?? !!this.#options.dot;
|
|
29988
|
-
if (this.#root === this) {
|
|
29989
|
-
this.#flatten();
|
|
29990
|
-
this.#fillNegs();
|
|
29991
|
-
}
|
|
29992
|
-
if (!isExtglobAST(this)) {
|
|
29993
|
-
const noEmpty = this.isStart() && this.isEnd() && !this.#parts.some((s) => typeof s !== "string");
|
|
29994
|
-
const src = this.#parts.map((p) => {
|
|
29995
|
-
const [re2, _3, hasMagic, uflag] = typeof p === "string" ? _a.#parseGlob(p, this.#hasMagic, noEmpty) : p.toRegExpSource(allowDot);
|
|
29996
|
-
this.#hasMagic = this.#hasMagic || hasMagic;
|
|
29997
|
-
this.#uflag = this.#uflag || uflag;
|
|
29998
|
-
return re2;
|
|
29999
|
-
}).join("");
|
|
30000
|
-
let start2 = "";
|
|
30001
|
-
if (this.isStart()) {
|
|
30002
|
-
if (typeof this.#parts[0] === "string") {
|
|
30003
|
-
const dotTravAllowed = this.#parts.length === 1 && justDots.has(this.#parts[0]);
|
|
30004
|
-
if (!dotTravAllowed) {
|
|
30005
|
-
const aps = addPatternStart;
|
|
30006
|
-
const needNoTrav = dot && aps.has(src.charAt(0)) || src.startsWith("\\.") && aps.has(src.charAt(2)) || src.startsWith("\\.\\.") && aps.has(src.charAt(4));
|
|
30007
|
-
const needNoDot = !dot && !allowDot && aps.has(src.charAt(0));
|
|
30008
|
-
start2 = needNoTrav ? startNoTraversal : needNoDot ? startNoDot : "";
|
|
30009
|
-
}
|
|
30010
|
-
}
|
|
30011
|
-
}
|
|
30012
|
-
let end = "";
|
|
30013
|
-
if (this.isEnd() && this.#root.#filledNegs && this.#parent?.type === "!") {
|
|
30014
|
-
end = "(?:$|\\/)";
|
|
30015
|
-
}
|
|
30016
|
-
const final2 = start2 + src + end;
|
|
30017
|
-
return [
|
|
30018
|
-
final2,
|
|
30019
|
-
unescape(src),
|
|
30020
|
-
this.#hasMagic = !!this.#hasMagic,
|
|
30021
|
-
this.#uflag
|
|
30022
|
-
];
|
|
30023
|
-
}
|
|
30024
|
-
const repeated = this.type === "*" || this.type === "+";
|
|
30025
|
-
const start = this.type === "!" ? "(?:(?!(?:" : "(?:";
|
|
30026
|
-
let body = this.#partsToRegExp(dot);
|
|
30027
|
-
if (this.isStart() && this.isEnd() && !body && this.type !== "!") {
|
|
30028
|
-
const s = this.toString();
|
|
30029
|
-
const me2 = this;
|
|
30030
|
-
me2.#parts = [s];
|
|
30031
|
-
me2.type = null;
|
|
30032
|
-
me2.#hasMagic = undefined;
|
|
30033
|
-
return [s, unescape(this.toString()), false, false];
|
|
30034
|
-
}
|
|
30035
|
-
let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(true);
|
|
30036
|
-
if (bodyDotAllowed === body) {
|
|
30037
|
-
bodyDotAllowed = "";
|
|
30038
|
-
}
|
|
30039
|
-
if (bodyDotAllowed) {
|
|
30040
|
-
body = `(?:${body})(?:${bodyDotAllowed})*?`;
|
|
30041
|
-
}
|
|
30042
|
-
let final = "";
|
|
30043
|
-
if (this.type === "!" && this.#emptyExt) {
|
|
30044
|
-
final = (this.isStart() && !dot ? startNoDot : "") + starNoEmpty;
|
|
30045
|
-
} else {
|
|
30046
|
-
const close = this.type === "!" ? "))" + (this.isStart() && !dot && !allowDot ? startNoDot : "") + star + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && bodyDotAllowed ? ")" : this.type === "*" && bodyDotAllowed ? `)?` : `)${this.type}`;
|
|
30047
|
-
final = start + body + close;
|
|
30048
|
-
}
|
|
30049
|
-
return [
|
|
30050
|
-
final,
|
|
30051
|
-
unescape(body),
|
|
30052
|
-
this.#hasMagic = !!this.#hasMagic,
|
|
30053
|
-
this.#uflag
|
|
30054
|
-
];
|
|
30055
|
-
}
|
|
30056
|
-
#flatten() {
|
|
30057
|
-
if (!isExtglobAST(this)) {
|
|
30058
|
-
for (const p of this.#parts) {
|
|
30059
|
-
if (typeof p === "object") {
|
|
30060
|
-
p.#flatten();
|
|
30061
|
-
}
|
|
30062
|
-
}
|
|
30063
|
-
} else {
|
|
30064
|
-
let iterations = 0;
|
|
30065
|
-
let done = false;
|
|
30066
|
-
do {
|
|
30067
|
-
done = true;
|
|
30068
|
-
for (let i = 0;i < this.#parts.length; i++) {
|
|
30069
|
-
const c2 = this.#parts[i];
|
|
30070
|
-
if (typeof c2 === "object") {
|
|
30071
|
-
c2.#flatten();
|
|
30072
|
-
if (this.#canAdopt(c2)) {
|
|
30073
|
-
done = false;
|
|
30074
|
-
this.#adopt(c2, i);
|
|
30075
|
-
} else if (this.#canAdoptWithSpace(c2)) {
|
|
30076
|
-
done = false;
|
|
30077
|
-
this.#adoptWithSpace(c2, i);
|
|
30078
|
-
} else if (this.#canUsurp(c2)) {
|
|
30079
|
-
done = false;
|
|
30080
|
-
this.#usurp(c2);
|
|
30081
|
-
}
|
|
30082
|
-
}
|
|
30083
|
-
}
|
|
30084
|
-
} while (!done && ++iterations < 10);
|
|
30085
|
-
}
|
|
30086
|
-
this.#toString = undefined;
|
|
30087
|
-
}
|
|
30088
|
-
#partsToRegExp(dot) {
|
|
30089
|
-
return this.#parts.map((p) => {
|
|
30090
|
-
if (typeof p === "string") {
|
|
30091
|
-
throw new Error("string type in extglob ast??");
|
|
30092
|
-
}
|
|
30093
|
-
const [re2, _3, _hasMagic, uflag] = p.toRegExpSource(dot);
|
|
30094
|
-
this.#uflag = this.#uflag || uflag;
|
|
30095
|
-
return re2;
|
|
30096
|
-
}).filter((p) => !(this.isStart() && this.isEnd()) || !!p).join("|");
|
|
30097
|
-
}
|
|
30098
|
-
static #parseGlob(glob, hasMagic, noEmpty = false) {
|
|
30099
|
-
let escaping = false;
|
|
30100
|
-
let re2 = "";
|
|
30101
|
-
let uflag = false;
|
|
30102
|
-
let inStar = false;
|
|
30103
|
-
for (let i = 0;i < glob.length; i++) {
|
|
30104
|
-
const c2 = glob.charAt(i);
|
|
30105
|
-
if (escaping) {
|
|
30106
|
-
escaping = false;
|
|
30107
|
-
re2 += (reSpecials.has(c2) ? "\\" : "") + c2;
|
|
30108
|
-
continue;
|
|
30109
|
-
}
|
|
30110
|
-
if (c2 === "*") {
|
|
30111
|
-
if (inStar)
|
|
30112
|
-
continue;
|
|
30113
|
-
inStar = true;
|
|
30114
|
-
re2 += noEmpty && /^[*]+$/.test(glob) ? starNoEmpty : star;
|
|
30115
|
-
hasMagic = true;
|
|
30116
|
-
continue;
|
|
30117
|
-
} else {
|
|
30118
|
-
inStar = false;
|
|
30119
|
-
}
|
|
30120
|
-
if (c2 === "\\") {
|
|
30121
|
-
if (i === glob.length - 1) {
|
|
30122
|
-
re2 += "\\\\";
|
|
30123
|
-
} else {
|
|
30124
|
-
escaping = true;
|
|
30125
|
-
}
|
|
30126
|
-
continue;
|
|
30127
|
-
}
|
|
30128
|
-
if (c2 === "[") {
|
|
30129
|
-
const [src, needUflag, consumed, magic] = parseClass(glob, i);
|
|
30130
|
-
if (consumed) {
|
|
30131
|
-
re2 += src;
|
|
30132
|
-
uflag = uflag || needUflag;
|
|
30133
|
-
i += consumed - 1;
|
|
30134
|
-
hasMagic = hasMagic || magic;
|
|
30135
|
-
continue;
|
|
30136
|
-
}
|
|
30137
|
-
}
|
|
30138
|
-
if (c2 === "?") {
|
|
30139
|
-
re2 += qmark;
|
|
30140
|
-
hasMagic = true;
|
|
30141
|
-
continue;
|
|
30142
|
-
}
|
|
30143
|
-
re2 += regExpEscape(c2);
|
|
30144
|
-
}
|
|
30145
|
-
return [re2, unescape(glob), !!hasMagic, uflag];
|
|
30146
|
-
}
|
|
30147
|
-
};
|
|
30148
|
-
_a = AST;
|
|
30149
|
-
});
|
|
30150
|
-
|
|
30151
|
-
// node_modules/minimatch/dist/esm/escape.js
|
|
30152
|
-
var escape = (s, { windowsPathsNoEscape = false, magicalBraces = false } = {}) => {
|
|
30153
|
-
if (magicalBraces) {
|
|
30154
|
-
return windowsPathsNoEscape ? s.replace(/[?*()[\]{}]/g, "[$&]") : s.replace(/[?*()[\]\\{}]/g, "\\$&");
|
|
30155
|
-
}
|
|
30156
|
-
return windowsPathsNoEscape ? s.replace(/[?*()[\]]/g, "[$&]") : s.replace(/[?*()[\]\\]/g, "\\$&");
|
|
30157
|
-
};
|
|
30158
|
-
|
|
30159
|
-
// node_modules/minimatch/dist/esm/index.js
|
|
30160
|
-
class Minimatch {
|
|
30161
|
-
options;
|
|
30162
|
-
set;
|
|
30163
|
-
pattern;
|
|
30164
|
-
windowsPathsNoEscape;
|
|
30165
|
-
nonegate;
|
|
30166
|
-
negate;
|
|
30167
|
-
comment;
|
|
30168
|
-
empty;
|
|
30169
|
-
preserveMultipleSlashes;
|
|
30170
|
-
partial;
|
|
30171
|
-
globSet;
|
|
30172
|
-
globParts;
|
|
30173
|
-
nocase;
|
|
30174
|
-
isWindows;
|
|
30175
|
-
platform;
|
|
30176
|
-
windowsNoMagicRoot;
|
|
30177
|
-
maxGlobstarRecursion;
|
|
30178
|
-
regexp;
|
|
30179
|
-
constructor(pattern, options2 = {}) {
|
|
30180
|
-
assertValidPattern(pattern);
|
|
30181
|
-
options2 = options2 || {};
|
|
30182
|
-
this.options = options2;
|
|
30183
|
-
this.maxGlobstarRecursion = options2.maxGlobstarRecursion ?? 200;
|
|
30184
|
-
this.pattern = pattern;
|
|
30185
|
-
this.platform = options2.platform || defaultPlatform;
|
|
30186
|
-
this.isWindows = this.platform === "win32";
|
|
30187
|
-
const awe = "allowWindow" + "sEscape";
|
|
30188
|
-
this.windowsPathsNoEscape = !!options2.windowsPathsNoEscape || options2[awe] === false;
|
|
30189
|
-
if (this.windowsPathsNoEscape) {
|
|
30190
|
-
this.pattern = this.pattern.replace(/\\/g, "/");
|
|
30191
|
-
}
|
|
30192
|
-
this.preserveMultipleSlashes = !!options2.preserveMultipleSlashes;
|
|
30193
|
-
this.regexp = null;
|
|
30194
|
-
this.negate = false;
|
|
30195
|
-
this.nonegate = !!options2.nonegate;
|
|
30196
|
-
this.comment = false;
|
|
30197
|
-
this.empty = false;
|
|
30198
|
-
this.partial = !!options2.partial;
|
|
30199
|
-
this.nocase = !!this.options.nocase;
|
|
30200
|
-
this.windowsNoMagicRoot = options2.windowsNoMagicRoot !== undefined ? options2.windowsNoMagicRoot : !!(this.isWindows && this.nocase);
|
|
30201
|
-
this.globSet = [];
|
|
30202
|
-
this.globParts = [];
|
|
30203
|
-
this.set = [];
|
|
30204
|
-
this.make();
|
|
30205
|
-
}
|
|
30206
|
-
hasMagic() {
|
|
30207
|
-
if (this.options.magicalBraces && this.set.length > 1) {
|
|
30208
|
-
return true;
|
|
30209
|
-
}
|
|
30210
|
-
for (const pattern of this.set) {
|
|
30211
|
-
for (const part of pattern) {
|
|
30212
|
-
if (typeof part !== "string")
|
|
30213
|
-
return true;
|
|
30214
|
-
}
|
|
30215
|
-
}
|
|
30216
|
-
return false;
|
|
30217
|
-
}
|
|
30218
|
-
debug(..._3) {}
|
|
30219
|
-
make() {
|
|
30220
|
-
const pattern = this.pattern;
|
|
30221
|
-
const options2 = this.options;
|
|
30222
|
-
if (!options2.nocomment && pattern.charAt(0) === "#") {
|
|
30223
|
-
this.comment = true;
|
|
30224
|
-
return;
|
|
30225
|
-
}
|
|
30226
|
-
if (!pattern) {
|
|
30227
|
-
this.empty = true;
|
|
30228
|
-
return;
|
|
30229
|
-
}
|
|
30230
|
-
this.parseNegate();
|
|
30231
|
-
this.globSet = [...new Set(this.braceExpand())];
|
|
30232
|
-
if (options2.debug) {
|
|
30233
|
-
this.debug = (...args) => console.error(...args);
|
|
30234
|
-
}
|
|
30235
|
-
this.debug(this.pattern, this.globSet);
|
|
30236
|
-
const rawGlobParts = this.globSet.map((s) => this.slashSplit(s));
|
|
30237
|
-
this.globParts = this.preprocess(rawGlobParts);
|
|
30238
|
-
this.debug(this.pattern, this.globParts);
|
|
30239
|
-
let set = this.globParts.map((s, _3, __) => {
|
|
30240
|
-
if (this.isWindows && this.windowsNoMagicRoot) {
|
|
30241
|
-
const isUNC = s[0] === "" && s[1] === "" && (s[2] === "?" || !globMagic.test(s[2])) && !globMagic.test(s[3]);
|
|
30242
|
-
const isDrive = /^[a-z]:/i.test(s[0]);
|
|
30243
|
-
if (isUNC) {
|
|
30244
|
-
return [
|
|
30245
|
-
...s.slice(0, 4),
|
|
30246
|
-
...s.slice(4).map((ss) => this.parse(ss))
|
|
30247
|
-
];
|
|
30248
|
-
} else if (isDrive) {
|
|
30249
|
-
return [s[0], ...s.slice(1).map((ss) => this.parse(ss))];
|
|
30250
|
-
}
|
|
30251
|
-
}
|
|
30252
|
-
return s.map((ss) => this.parse(ss));
|
|
30253
|
-
});
|
|
30254
|
-
this.debug(this.pattern, set);
|
|
30255
|
-
this.set = set.filter((s) => s.indexOf(false) === -1);
|
|
30256
|
-
if (this.isWindows) {
|
|
30257
|
-
for (let i = 0;i < this.set.length; i++) {
|
|
30258
|
-
const p = this.set[i];
|
|
30259
|
-
if (p[0] === "" && p[1] === "" && this.globParts[i][2] === "?" && typeof p[3] === "string" && /^[a-z]:$/i.test(p[3])) {
|
|
30260
|
-
p[2] = "?";
|
|
30261
|
-
}
|
|
30262
|
-
}
|
|
30263
|
-
}
|
|
30264
|
-
this.debug(this.pattern, this.set);
|
|
30265
|
-
}
|
|
30266
|
-
preprocess(globParts) {
|
|
30267
|
-
if (this.options.noglobstar) {
|
|
30268
|
-
for (const partset of globParts) {
|
|
30269
|
-
for (let j2 = 0;j2 < partset.length; j2++) {
|
|
30270
|
-
if (partset[j2] === "**") {
|
|
30271
|
-
partset[j2] = "*";
|
|
30272
|
-
}
|
|
30273
|
-
}
|
|
30274
|
-
}
|
|
30275
|
-
}
|
|
30276
|
-
const { optimizationLevel = 1 } = this.options;
|
|
30277
|
-
if (optimizationLevel >= 2) {
|
|
30278
|
-
globParts = this.firstPhasePreProcess(globParts);
|
|
30279
|
-
globParts = this.secondPhasePreProcess(globParts);
|
|
30280
|
-
} else if (optimizationLevel >= 1) {
|
|
30281
|
-
globParts = this.levelOneOptimize(globParts);
|
|
30282
|
-
} else {
|
|
30283
|
-
globParts = this.adjascentGlobstarOptimize(globParts);
|
|
30284
|
-
}
|
|
30285
|
-
return globParts;
|
|
30286
|
-
}
|
|
30287
|
-
adjascentGlobstarOptimize(globParts) {
|
|
30288
|
-
return globParts.map((parts) => {
|
|
30289
|
-
let gs = -1;
|
|
30290
|
-
while ((gs = parts.indexOf("**", gs + 1)) !== -1) {
|
|
30291
|
-
let i = gs;
|
|
30292
|
-
while (parts[i + 1] === "**") {
|
|
30293
|
-
i++;
|
|
30294
|
-
}
|
|
30295
|
-
if (i !== gs) {
|
|
30296
|
-
parts.splice(gs, i - gs);
|
|
30297
|
-
}
|
|
30298
|
-
}
|
|
30299
|
-
return parts;
|
|
30300
|
-
});
|
|
30301
|
-
}
|
|
30302
|
-
levelOneOptimize(globParts) {
|
|
30303
|
-
return globParts.map((parts) => {
|
|
30304
|
-
parts = parts.reduce((set, part) => {
|
|
30305
|
-
const prev = set[set.length - 1];
|
|
30306
|
-
if (part === "**" && prev === "**") {
|
|
30307
|
-
return set;
|
|
30308
|
-
}
|
|
30309
|
-
if (part === "..") {
|
|
30310
|
-
if (prev && prev !== ".." && prev !== "." && prev !== "**") {
|
|
30311
|
-
set.pop();
|
|
30312
|
-
return set;
|
|
30313
|
-
}
|
|
30314
|
-
}
|
|
30315
|
-
set.push(part);
|
|
30316
|
-
return set;
|
|
30317
|
-
}, []);
|
|
30318
|
-
return parts.length === 0 ? [""] : parts;
|
|
30319
|
-
});
|
|
30320
|
-
}
|
|
30321
|
-
levelTwoFileOptimize(parts) {
|
|
30322
|
-
if (!Array.isArray(parts)) {
|
|
30323
|
-
parts = this.slashSplit(parts);
|
|
30324
|
-
}
|
|
30325
|
-
let didSomething = false;
|
|
30326
|
-
do {
|
|
30327
|
-
didSomething = false;
|
|
30328
|
-
if (!this.preserveMultipleSlashes) {
|
|
30329
|
-
for (let i = 1;i < parts.length - 1; i++) {
|
|
30330
|
-
const p = parts[i];
|
|
30331
|
-
if (i === 1 && p === "" && parts[0] === "")
|
|
30332
|
-
continue;
|
|
30333
|
-
if (p === "." || p === "") {
|
|
30334
|
-
didSomething = true;
|
|
30335
|
-
parts.splice(i, 1);
|
|
30336
|
-
i--;
|
|
30337
|
-
}
|
|
30338
|
-
}
|
|
30339
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
30340
|
-
didSomething = true;
|
|
30341
|
-
parts.pop();
|
|
30342
|
-
}
|
|
30343
|
-
}
|
|
30344
|
-
let dd = 0;
|
|
30345
|
-
while ((dd = parts.indexOf("..", dd + 1)) !== -1) {
|
|
30346
|
-
const p = parts[dd - 1];
|
|
30347
|
-
if (p && p !== "." && p !== ".." && p !== "**" && !(this.isWindows && /^[a-z]:$/i.test(p))) {
|
|
30348
|
-
didSomething = true;
|
|
30349
|
-
parts.splice(dd - 1, 2);
|
|
30350
|
-
dd -= 2;
|
|
30351
|
-
}
|
|
30352
|
-
}
|
|
30353
|
-
} while (didSomething);
|
|
30354
|
-
return parts.length === 0 ? [""] : parts;
|
|
30355
|
-
}
|
|
30356
|
-
firstPhasePreProcess(globParts) {
|
|
30357
|
-
let didSomething = false;
|
|
30358
|
-
do {
|
|
30359
|
-
didSomething = false;
|
|
30360
|
-
for (let parts of globParts) {
|
|
30361
|
-
let gs = -1;
|
|
30362
|
-
while ((gs = parts.indexOf("**", gs + 1)) !== -1) {
|
|
30363
|
-
let gss = gs;
|
|
30364
|
-
while (parts[gss + 1] === "**") {
|
|
30365
|
-
gss++;
|
|
30366
|
-
}
|
|
30367
|
-
if (gss > gs) {
|
|
30368
|
-
parts.splice(gs + 1, gss - gs);
|
|
30369
|
-
}
|
|
30370
|
-
let next = parts[gs + 1];
|
|
30371
|
-
const p = parts[gs + 2];
|
|
30372
|
-
const p2 = parts[gs + 3];
|
|
30373
|
-
if (next !== "..")
|
|
30374
|
-
continue;
|
|
30375
|
-
if (!p || p === "." || p === ".." || !p2 || p2 === "." || p2 === "..") {
|
|
30376
|
-
continue;
|
|
30377
|
-
}
|
|
30378
|
-
didSomething = true;
|
|
30379
|
-
parts.splice(gs, 1);
|
|
30380
|
-
const other = parts.slice(0);
|
|
30381
|
-
other[gs] = "**";
|
|
30382
|
-
globParts.push(other);
|
|
30383
|
-
gs--;
|
|
30384
|
-
}
|
|
30385
|
-
if (!this.preserveMultipleSlashes) {
|
|
30386
|
-
for (let i = 1;i < parts.length - 1; i++) {
|
|
30387
|
-
const p = parts[i];
|
|
30388
|
-
if (i === 1 && p === "" && parts[0] === "")
|
|
30389
|
-
continue;
|
|
30390
|
-
if (p === "." || p === "") {
|
|
30391
|
-
didSomething = true;
|
|
30392
|
-
parts.splice(i, 1);
|
|
30393
|
-
i--;
|
|
30394
|
-
}
|
|
30395
|
-
}
|
|
30396
|
-
if (parts[0] === "." && parts.length === 2 && (parts[1] === "." || parts[1] === "")) {
|
|
30397
|
-
didSomething = true;
|
|
30398
|
-
parts.pop();
|
|
30399
|
-
}
|
|
30400
|
-
}
|
|
30401
|
-
let dd = 0;
|
|
30402
|
-
while ((dd = parts.indexOf("..", dd + 1)) !== -1) {
|
|
30403
|
-
const p = parts[dd - 1];
|
|
30404
|
-
if (p && p !== "." && p !== ".." && p !== "**") {
|
|
30405
|
-
didSomething = true;
|
|
30406
|
-
const needDot = dd === 1 && parts[dd + 1] === "**";
|
|
30407
|
-
const splin = needDot ? ["."] : [];
|
|
30408
|
-
parts.splice(dd - 1, 2, ...splin);
|
|
30409
|
-
if (parts.length === 0)
|
|
30410
|
-
parts.push("");
|
|
30411
|
-
dd -= 2;
|
|
30412
|
-
}
|
|
30413
|
-
}
|
|
30414
|
-
}
|
|
30415
|
-
} while (didSomething);
|
|
30416
|
-
return globParts;
|
|
30417
|
-
}
|
|
30418
|
-
secondPhasePreProcess(globParts) {
|
|
30419
|
-
for (let i = 0;i < globParts.length - 1; i++) {
|
|
30420
|
-
for (let j2 = i + 1;j2 < globParts.length; j2++) {
|
|
30421
|
-
const matched = this.partsMatch(globParts[i], globParts[j2], !this.preserveMultipleSlashes);
|
|
30422
|
-
if (matched) {
|
|
30423
|
-
globParts[i] = [];
|
|
30424
|
-
globParts[j2] = matched;
|
|
30425
|
-
break;
|
|
30426
|
-
}
|
|
30427
|
-
}
|
|
30428
|
-
}
|
|
30429
|
-
return globParts.filter((gs) => gs.length);
|
|
30430
|
-
}
|
|
30431
|
-
partsMatch(a3, b3, emptyGSMatch = false) {
|
|
30432
|
-
let ai = 0;
|
|
30433
|
-
let bi = 0;
|
|
30434
|
-
let result = [];
|
|
30435
|
-
let which = "";
|
|
30436
|
-
while (ai < a3.length && bi < b3.length) {
|
|
30437
|
-
if (a3[ai] === b3[bi]) {
|
|
30438
|
-
result.push(which === "b" ? b3[bi] : a3[ai]);
|
|
30439
|
-
ai++;
|
|
30440
|
-
bi++;
|
|
30441
|
-
} else if (emptyGSMatch && a3[ai] === "**" && b3[bi] === a3[ai + 1]) {
|
|
30442
|
-
result.push(a3[ai]);
|
|
30443
|
-
ai++;
|
|
30444
|
-
} else if (emptyGSMatch && b3[bi] === "**" && a3[ai] === b3[bi + 1]) {
|
|
30445
|
-
result.push(b3[bi]);
|
|
30446
|
-
bi++;
|
|
30447
|
-
} else if (a3[ai] === "*" && b3[bi] && (this.options.dot || !b3[bi].startsWith(".")) && b3[bi] !== "**") {
|
|
30448
|
-
if (which === "b")
|
|
30449
|
-
return false;
|
|
30450
|
-
which = "a";
|
|
30451
|
-
result.push(a3[ai]);
|
|
30452
|
-
ai++;
|
|
30453
|
-
bi++;
|
|
30454
|
-
} else if (b3[bi] === "*" && a3[ai] && (this.options.dot || !a3[ai].startsWith(".")) && a3[ai] !== "**") {
|
|
30455
|
-
if (which === "a")
|
|
30456
|
-
return false;
|
|
30457
|
-
which = "b";
|
|
30458
|
-
result.push(b3[bi]);
|
|
30459
|
-
ai++;
|
|
30460
|
-
bi++;
|
|
30461
|
-
} else {
|
|
30462
|
-
return false;
|
|
30463
|
-
}
|
|
30464
|
-
}
|
|
30465
|
-
return a3.length === b3.length && result;
|
|
30466
|
-
}
|
|
30467
|
-
parseNegate() {
|
|
30468
|
-
if (this.nonegate)
|
|
30469
|
-
return;
|
|
30470
|
-
const pattern = this.pattern;
|
|
30471
|
-
let negate = false;
|
|
30472
|
-
let negateOffset = 0;
|
|
30473
|
-
for (let i = 0;i < pattern.length && pattern.charAt(i) === "!"; i++) {
|
|
30474
|
-
negate = !negate;
|
|
30475
|
-
negateOffset++;
|
|
30476
|
-
}
|
|
30477
|
-
if (negateOffset)
|
|
30478
|
-
this.pattern = pattern.slice(negateOffset);
|
|
30479
|
-
this.negate = negate;
|
|
30480
|
-
}
|
|
30481
|
-
matchOne(file, pattern, partial = false) {
|
|
30482
|
-
let fileStartIndex = 0;
|
|
30483
|
-
let patternStartIndex = 0;
|
|
30484
|
-
if (this.isWindows) {
|
|
30485
|
-
const fileDrive = typeof file[0] === "string" && /^[a-z]:$/i.test(file[0]);
|
|
30486
|
-
const fileUNC = !fileDrive && file[0] === "" && file[1] === "" && file[2] === "?" && /^[a-z]:$/i.test(file[3]);
|
|
30487
|
-
const patternDrive = typeof pattern[0] === "string" && /^[a-z]:$/i.test(pattern[0]);
|
|
30488
|
-
const patternUNC = !patternDrive && pattern[0] === "" && pattern[1] === "" && pattern[2] === "?" && typeof pattern[3] === "string" && /^[a-z]:$/i.test(pattern[3]);
|
|
30489
|
-
const fdi = fileUNC ? 3 : fileDrive ? 0 : undefined;
|
|
30490
|
-
const pdi = patternUNC ? 3 : patternDrive ? 0 : undefined;
|
|
30491
|
-
if (typeof fdi === "number" && typeof pdi === "number") {
|
|
30492
|
-
const [fd, pd] = [
|
|
30493
|
-
file[fdi],
|
|
30494
|
-
pattern[pdi]
|
|
30495
|
-
];
|
|
30496
|
-
if (fd.toLowerCase() === pd.toLowerCase()) {
|
|
30497
|
-
pattern[pdi] = fd;
|
|
30498
|
-
patternStartIndex = pdi;
|
|
30499
|
-
fileStartIndex = fdi;
|
|
30500
|
-
}
|
|
30501
|
-
}
|
|
30502
|
-
}
|
|
30503
|
-
const { optimizationLevel = 1 } = this.options;
|
|
30504
|
-
if (optimizationLevel >= 2) {
|
|
30505
|
-
file = this.levelTwoFileOptimize(file);
|
|
30506
|
-
}
|
|
30507
|
-
if (pattern.includes(GLOBSTAR)) {
|
|
30508
|
-
return this.#matchGlobstar(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
30509
|
-
}
|
|
30510
|
-
return this.#matchOne(file, pattern, partial, fileStartIndex, patternStartIndex);
|
|
30511
|
-
}
|
|
30512
|
-
#matchGlobstar(file, pattern, partial, fileIndex, patternIndex) {
|
|
30513
|
-
const firstgs = pattern.indexOf(GLOBSTAR, patternIndex);
|
|
30514
|
-
const lastgs = pattern.lastIndexOf(GLOBSTAR);
|
|
30515
|
-
const [head2, body, tail] = partial ? [
|
|
30516
|
-
pattern.slice(patternIndex, firstgs),
|
|
30517
|
-
pattern.slice(firstgs + 1),
|
|
30518
|
-
[]
|
|
30519
|
-
] : [
|
|
30520
|
-
pattern.slice(patternIndex, firstgs),
|
|
30521
|
-
pattern.slice(firstgs + 1, lastgs),
|
|
30522
|
-
pattern.slice(lastgs + 1)
|
|
30523
|
-
];
|
|
30524
|
-
if (head2.length) {
|
|
30525
|
-
const fileHead = file.slice(fileIndex, fileIndex + head2.length);
|
|
30526
|
-
if (!this.#matchOne(fileHead, head2, partial, 0, 0)) {
|
|
30527
|
-
return false;
|
|
30528
|
-
}
|
|
30529
|
-
fileIndex += head2.length;
|
|
30530
|
-
patternIndex += head2.length;
|
|
30531
|
-
}
|
|
30532
|
-
let fileTailMatch = 0;
|
|
30533
|
-
if (tail.length) {
|
|
30534
|
-
if (tail.length + fileIndex > file.length)
|
|
30535
|
-
return false;
|
|
30536
|
-
let tailStart = file.length - tail.length;
|
|
30537
|
-
if (this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
30538
|
-
fileTailMatch = tail.length;
|
|
30539
|
-
} else {
|
|
30540
|
-
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) {
|
|
30541
|
-
return false;
|
|
30542
|
-
}
|
|
30543
|
-
tailStart--;
|
|
30544
|
-
if (!this.#matchOne(file, tail, partial, tailStart, 0)) {
|
|
30545
|
-
return false;
|
|
30546
|
-
}
|
|
30547
|
-
fileTailMatch = tail.length + 1;
|
|
30548
|
-
}
|
|
30549
|
-
}
|
|
30550
|
-
if (!body.length) {
|
|
30551
|
-
let sawSome = !!fileTailMatch;
|
|
30552
|
-
for (let i2 = fileIndex;i2 < file.length - fileTailMatch; i2++) {
|
|
30553
|
-
const f3 = String(file[i2]);
|
|
30554
|
-
sawSome = true;
|
|
30555
|
-
if (f3 === "." || f3 === ".." || !this.options.dot && f3.startsWith(".")) {
|
|
30556
|
-
return false;
|
|
30557
|
-
}
|
|
30558
|
-
}
|
|
30559
|
-
return partial || sawSome;
|
|
30560
|
-
}
|
|
30561
|
-
const bodySegments = [[[], 0]];
|
|
30562
|
-
let currentBody = bodySegments[0];
|
|
30563
|
-
let nonGsParts = 0;
|
|
30564
|
-
const nonGsPartsSums = [0];
|
|
30565
|
-
for (const b3 of body) {
|
|
30566
|
-
if (b3 === GLOBSTAR) {
|
|
30567
|
-
nonGsPartsSums.push(nonGsParts);
|
|
30568
|
-
currentBody = [[], 0];
|
|
30569
|
-
bodySegments.push(currentBody);
|
|
30570
|
-
} else {
|
|
30571
|
-
currentBody[0].push(b3);
|
|
30572
|
-
nonGsParts++;
|
|
30573
|
-
}
|
|
30574
|
-
}
|
|
30575
|
-
let i = bodySegments.length - 1;
|
|
30576
|
-
const fileLength = file.length - fileTailMatch;
|
|
30577
|
-
for (const b3 of bodySegments) {
|
|
30578
|
-
b3[1] = fileLength - (nonGsPartsSums[i--] + b3[0].length);
|
|
30579
|
-
}
|
|
30580
|
-
return !!this.#matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
30581
|
-
}
|
|
30582
|
-
#matchGlobStarBodySections(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
30583
|
-
const bs = bodySegments[bodyIndex];
|
|
30584
|
-
if (!bs) {
|
|
30585
|
-
for (let i = fileIndex;i < file.length; i++) {
|
|
30586
|
-
sawTail = true;
|
|
30587
|
-
const f3 = file[i];
|
|
30588
|
-
if (f3 === "." || f3 === ".." || !this.options.dot && f3.startsWith(".")) {
|
|
30589
|
-
return false;
|
|
30590
|
-
}
|
|
30591
|
-
}
|
|
30592
|
-
return sawTail;
|
|
30593
|
-
}
|
|
30594
|
-
const [body, after] = bs;
|
|
30595
|
-
while (fileIndex <= after) {
|
|
30596
|
-
const m2 = this.#matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0);
|
|
30597
|
-
if (m2 && globStarDepth < this.maxGlobstarRecursion) {
|
|
30598
|
-
const sub = this.#matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
30599
|
-
if (sub !== false) {
|
|
30600
|
-
return sub;
|
|
30601
|
-
}
|
|
30602
|
-
}
|
|
30603
|
-
const f3 = file[fileIndex];
|
|
30604
|
-
if (f3 === "." || f3 === ".." || !this.options.dot && f3.startsWith(".")) {
|
|
30605
|
-
return false;
|
|
30606
|
-
}
|
|
30607
|
-
fileIndex++;
|
|
30608
|
-
}
|
|
30609
|
-
return partial || null;
|
|
30610
|
-
}
|
|
30611
|
-
#matchOne(file, pattern, partial, fileIndex, patternIndex) {
|
|
30612
|
-
let fi;
|
|
30613
|
-
let pi;
|
|
30614
|
-
let pl;
|
|
30615
|
-
let fl;
|
|
30616
|
-
for (fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length;fi < fl && pi < pl; fi++, pi++) {
|
|
30617
|
-
this.debug("matchOne loop");
|
|
30618
|
-
let p = pattern[pi];
|
|
30619
|
-
let f3 = file[fi];
|
|
30620
|
-
this.debug(pattern, p, f3);
|
|
30621
|
-
if (p === false || p === GLOBSTAR) {
|
|
30622
|
-
return false;
|
|
30623
|
-
}
|
|
30624
|
-
let hit;
|
|
30625
|
-
if (typeof p === "string") {
|
|
30626
|
-
hit = f3 === p;
|
|
30627
|
-
this.debug("string match", p, f3, hit);
|
|
30628
|
-
} else {
|
|
30629
|
-
hit = p.test(f3);
|
|
30630
|
-
this.debug("pattern match", p, f3, hit);
|
|
30631
|
-
}
|
|
30632
|
-
if (!hit)
|
|
30633
|
-
return false;
|
|
30634
|
-
}
|
|
30635
|
-
if (fi === fl && pi === pl) {
|
|
30636
|
-
return true;
|
|
30637
|
-
} else if (fi === fl) {
|
|
30638
|
-
return partial;
|
|
30639
|
-
} else if (pi === pl) {
|
|
30640
|
-
return fi === fl - 1 && file[fi] === "";
|
|
30641
|
-
} else {
|
|
30642
|
-
throw new Error("wtf?");
|
|
30643
|
-
}
|
|
30644
|
-
}
|
|
30645
|
-
braceExpand() {
|
|
30646
|
-
return braceExpand(this.pattern, this.options);
|
|
30647
|
-
}
|
|
30648
|
-
parse(pattern) {
|
|
30649
|
-
assertValidPattern(pattern);
|
|
30650
|
-
const options2 = this.options;
|
|
30651
|
-
if (pattern === "**")
|
|
30652
|
-
return GLOBSTAR;
|
|
30653
|
-
if (pattern === "")
|
|
30654
|
-
return "";
|
|
30655
|
-
let m2;
|
|
30656
|
-
let fastTest = null;
|
|
30657
|
-
if (m2 = pattern.match(starRE)) {
|
|
30658
|
-
fastTest = options2.dot ? starTestDot : starTest;
|
|
30659
|
-
} else if (m2 = pattern.match(starDotExtRE)) {
|
|
30660
|
-
fastTest = (options2.nocase ? options2.dot ? starDotExtTestNocaseDot : starDotExtTestNocase : options2.dot ? starDotExtTestDot : starDotExtTest)(m2[1]);
|
|
30661
|
-
} else if (m2 = pattern.match(qmarksRE)) {
|
|
30662
|
-
fastTest = (options2.nocase ? options2.dot ? qmarksTestNocaseDot : qmarksTestNocase : options2.dot ? qmarksTestDot : qmarksTest)(m2);
|
|
30663
|
-
} else if (m2 = pattern.match(starDotStarRE)) {
|
|
30664
|
-
fastTest = options2.dot ? starDotStarTestDot : starDotStarTest;
|
|
30665
|
-
} else if (m2 = pattern.match(dotStarRE)) {
|
|
30666
|
-
fastTest = dotStarTest;
|
|
30667
|
-
}
|
|
30668
|
-
const re2 = AST.fromGlob(pattern, this.options).toMMPattern();
|
|
30669
|
-
if (fastTest && typeof re2 === "object") {
|
|
30670
|
-
Reflect.defineProperty(re2, "test", { value: fastTest });
|
|
30671
|
-
}
|
|
30672
|
-
return re2;
|
|
30673
|
-
}
|
|
30674
|
-
makeRe() {
|
|
30675
|
-
if (this.regexp || this.regexp === false)
|
|
30676
|
-
return this.regexp;
|
|
30677
|
-
const set = this.set;
|
|
30678
|
-
if (!set.length) {
|
|
30679
|
-
this.regexp = false;
|
|
30680
|
-
return this.regexp;
|
|
30681
|
-
}
|
|
30682
|
-
const options2 = this.options;
|
|
30683
|
-
const twoStar = options2.noglobstar ? star2 : options2.dot ? twoStarDot : twoStarNoDot;
|
|
30684
|
-
const flags = new Set(options2.nocase ? ["i"] : []);
|
|
30685
|
-
let re2 = set.map((pattern) => {
|
|
30686
|
-
const pp = pattern.map((p) => {
|
|
30687
|
-
if (p instanceof RegExp) {
|
|
30688
|
-
for (const f3 of p.flags.split(""))
|
|
30689
|
-
flags.add(f3);
|
|
30690
|
-
}
|
|
30691
|
-
return typeof p === "string" ? regExpEscape2(p) : p === GLOBSTAR ? GLOBSTAR : p._src;
|
|
30692
|
-
});
|
|
30693
|
-
pp.forEach((p, i) => {
|
|
30694
|
-
const next = pp[i + 1];
|
|
30695
|
-
const prev = pp[i - 1];
|
|
30696
|
-
if (p !== GLOBSTAR || prev === GLOBSTAR) {
|
|
30697
|
-
return;
|
|
30698
|
-
}
|
|
30699
|
-
if (prev === undefined) {
|
|
30700
|
-
if (next !== undefined && next !== GLOBSTAR) {
|
|
30701
|
-
pp[i + 1] = "(?:\\/|" + twoStar + "\\/)?" + next;
|
|
30702
|
-
} else {
|
|
30703
|
-
pp[i] = twoStar;
|
|
30704
|
-
}
|
|
30705
|
-
} else if (next === undefined) {
|
|
30706
|
-
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + ")?";
|
|
30707
|
-
} else if (next !== GLOBSTAR) {
|
|
30708
|
-
pp[i - 1] = prev + "(?:\\/|\\/" + twoStar + "\\/)" + next;
|
|
30709
|
-
pp[i + 1] = GLOBSTAR;
|
|
30710
|
-
}
|
|
30711
|
-
});
|
|
30712
|
-
const filtered = pp.filter((p) => p !== GLOBSTAR);
|
|
30713
|
-
if (this.partial && filtered.length >= 1) {
|
|
30714
|
-
const prefixes = [];
|
|
30715
|
-
for (let i = 1;i <= filtered.length; i++) {
|
|
30716
|
-
prefixes.push(filtered.slice(0, i).join("/"));
|
|
30717
|
-
}
|
|
30718
|
-
return "(?:" + prefixes.join("|") + ")";
|
|
30719
|
-
}
|
|
30720
|
-
return filtered.join("/");
|
|
30721
|
-
}).join("|");
|
|
30722
|
-
const [open, close] = set.length > 1 ? ["(?:", ")"] : ["", ""];
|
|
30723
|
-
re2 = "^" + open + re2 + close + "$";
|
|
30724
|
-
if (this.partial) {
|
|
30725
|
-
re2 = "^(?:\\/|" + open + re2.slice(1, -1) + close + ")$";
|
|
30726
|
-
}
|
|
30727
|
-
if (this.negate)
|
|
30728
|
-
re2 = "^(?!" + re2 + ").+$";
|
|
30729
|
-
try {
|
|
30730
|
-
this.regexp = new RegExp(re2, [...flags].join(""));
|
|
30731
|
-
} catch {
|
|
30732
|
-
this.regexp = false;
|
|
30733
|
-
}
|
|
30734
|
-
return this.regexp;
|
|
30735
|
-
}
|
|
30736
|
-
slashSplit(p) {
|
|
30737
|
-
if (this.preserveMultipleSlashes) {
|
|
30738
|
-
return p.split("/");
|
|
30739
|
-
} else if (this.isWindows && /^\/\/[^/]+/.test(p)) {
|
|
30740
|
-
return ["", ...p.split(/\/+/)];
|
|
30741
|
-
} else {
|
|
30742
|
-
return p.split(/\/+/);
|
|
30743
|
-
}
|
|
30744
|
-
}
|
|
30745
|
-
match(f3, partial = this.partial) {
|
|
30746
|
-
this.debug("match", f3, this.pattern);
|
|
30747
|
-
if (this.comment) {
|
|
30748
|
-
return false;
|
|
30749
|
-
}
|
|
30750
|
-
if (this.empty) {
|
|
30751
|
-
return f3 === "";
|
|
30752
|
-
}
|
|
30753
|
-
if (f3 === "/" && partial) {
|
|
30754
|
-
return true;
|
|
30755
|
-
}
|
|
30756
|
-
const options2 = this.options;
|
|
30757
|
-
if (this.isWindows) {
|
|
30758
|
-
f3 = f3.split("\\").join("/");
|
|
30759
|
-
}
|
|
30760
|
-
const ff = this.slashSplit(f3);
|
|
30761
|
-
this.debug(this.pattern, "split", ff);
|
|
30762
|
-
const set = this.set;
|
|
30763
|
-
this.debug(this.pattern, "set", set);
|
|
30764
|
-
let filename = ff[ff.length - 1];
|
|
30765
|
-
if (!filename) {
|
|
30766
|
-
for (let i = ff.length - 2;!filename && i >= 0; i--) {
|
|
30767
|
-
filename = ff[i];
|
|
30768
|
-
}
|
|
30769
|
-
}
|
|
30770
|
-
for (const pattern of set) {
|
|
30771
|
-
let file = ff;
|
|
30772
|
-
if (options2.matchBase && pattern.length === 1) {
|
|
30773
|
-
file = [filename];
|
|
30774
|
-
}
|
|
30775
|
-
const hit = this.matchOne(file, pattern, partial);
|
|
30776
|
-
if (hit) {
|
|
30777
|
-
if (options2.flipNegate) {
|
|
30778
|
-
return true;
|
|
30779
|
-
}
|
|
30780
|
-
return !this.negate;
|
|
30781
|
-
}
|
|
30782
|
-
}
|
|
30783
|
-
if (options2.flipNegate) {
|
|
30784
|
-
return false;
|
|
30785
|
-
}
|
|
30786
|
-
return this.negate;
|
|
30787
|
-
}
|
|
30788
|
-
static defaults(def) {
|
|
30789
|
-
return minimatch.defaults(def).Minimatch;
|
|
30790
|
-
}
|
|
30791
|
-
}
|
|
30792
|
-
var minimatch = (p, pattern, options2 = {}) => {
|
|
30793
|
-
assertValidPattern(pattern);
|
|
30794
|
-
if (!options2.nocomment && pattern.charAt(0) === "#") {
|
|
30795
|
-
return false;
|
|
30796
|
-
}
|
|
30797
|
-
return new Minimatch(pattern, options2).match(p);
|
|
30798
|
-
}, starDotExtRE, starDotExtTest = (ext) => (f3) => !f3.startsWith(".") && f3.endsWith(ext), starDotExtTestDot = (ext) => (f3) => f3.endsWith(ext), starDotExtTestNocase = (ext) => {
|
|
30799
|
-
ext = ext.toLowerCase();
|
|
30800
|
-
return (f3) => !f3.startsWith(".") && f3.toLowerCase().endsWith(ext);
|
|
30801
|
-
}, starDotExtTestNocaseDot = (ext) => {
|
|
30802
|
-
ext = ext.toLowerCase();
|
|
30803
|
-
return (f3) => f3.toLowerCase().endsWith(ext);
|
|
30804
|
-
}, starDotStarRE, starDotStarTest = (f3) => !f3.startsWith(".") && f3.includes("."), starDotStarTestDot = (f3) => f3 !== "." && f3 !== ".." && f3.includes("."), dotStarRE, dotStarTest = (f3) => f3 !== "." && f3 !== ".." && f3.startsWith("."), starRE, starTest = (f3) => f3.length !== 0 && !f3.startsWith("."), starTestDot = (f3) => f3.length !== 0 && f3 !== "." && f3 !== "..", qmarksRE, qmarksTestNocase = ([$0, ext = ""]) => {
|
|
30805
|
-
const noext = qmarksTestNoExt([$0]);
|
|
30806
|
-
if (!ext)
|
|
30807
|
-
return noext;
|
|
30808
|
-
ext = ext.toLowerCase();
|
|
30809
|
-
return (f3) => noext(f3) && f3.toLowerCase().endsWith(ext);
|
|
30810
|
-
}, qmarksTestNocaseDot = ([$0, ext = ""]) => {
|
|
30811
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
30812
|
-
if (!ext)
|
|
30813
|
-
return noext;
|
|
30814
|
-
ext = ext.toLowerCase();
|
|
30815
|
-
return (f3) => noext(f3) && f3.toLowerCase().endsWith(ext);
|
|
30816
|
-
}, qmarksTestDot = ([$0, ext = ""]) => {
|
|
30817
|
-
const noext = qmarksTestNoExtDot([$0]);
|
|
30818
|
-
return !ext ? noext : (f3) => noext(f3) && f3.endsWith(ext);
|
|
30819
|
-
}, qmarksTest = ([$0, ext = ""]) => {
|
|
30820
|
-
const noext = qmarksTestNoExt([$0]);
|
|
30821
|
-
return !ext ? noext : (f3) => noext(f3) && f3.endsWith(ext);
|
|
30822
|
-
}, qmarksTestNoExt = ([$0]) => {
|
|
30823
|
-
const len = $0.length;
|
|
30824
|
-
return (f3) => f3.length === len && !f3.startsWith(".");
|
|
30825
|
-
}, qmarksTestNoExtDot = ([$0]) => {
|
|
30826
|
-
const len = $0.length;
|
|
30827
|
-
return (f3) => f3.length === len && f3 !== "." && f3 !== "..";
|
|
30828
|
-
}, defaultPlatform, path2, sep2, GLOBSTAR, qmark2 = "[^/]", star2, twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?", twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?", filter = (pattern, options2 = {}) => (p) => minimatch(p, pattern, options2), ext = (a3, b3 = {}) => Object.assign({}, a3, b3), defaults = (def) => {
|
|
30829
|
-
if (!def || typeof def !== "object" || !Object.keys(def).length) {
|
|
30830
|
-
return minimatch;
|
|
30831
|
-
}
|
|
30832
|
-
const orig = minimatch;
|
|
30833
|
-
const m2 = (p, pattern, options2 = {}) => orig(p, pattern, ext(def, options2));
|
|
30834
|
-
return Object.assign(m2, {
|
|
30835
|
-
Minimatch: class Minimatch extends orig.Minimatch {
|
|
30836
|
-
constructor(pattern, options2 = {}) {
|
|
30837
|
-
super(pattern, ext(def, options2));
|
|
30838
|
-
}
|
|
30839
|
-
static defaults(options2) {
|
|
30840
|
-
return orig.defaults(ext(def, options2)).Minimatch;
|
|
30841
|
-
}
|
|
30842
|
-
},
|
|
30843
|
-
AST: class AST2 extends orig.AST {
|
|
30844
|
-
constructor(type, parent, options2 = {}) {
|
|
30845
|
-
super(type, parent, ext(def, options2));
|
|
30846
|
-
}
|
|
30847
|
-
static fromGlob(pattern, options2 = {}) {
|
|
30848
|
-
return orig.AST.fromGlob(pattern, ext(def, options2));
|
|
30849
|
-
}
|
|
30850
|
-
},
|
|
30851
|
-
unescape: (s, options2 = {}) => orig.unescape(s, ext(def, options2)),
|
|
30852
|
-
escape: (s, options2 = {}) => orig.escape(s, ext(def, options2)),
|
|
30853
|
-
filter: (pattern, options2 = {}) => orig.filter(pattern, ext(def, options2)),
|
|
30854
|
-
defaults: (options2) => orig.defaults(ext(def, options2)),
|
|
30855
|
-
makeRe: (pattern, options2 = {}) => orig.makeRe(pattern, ext(def, options2)),
|
|
30856
|
-
braceExpand: (pattern, options2 = {}) => orig.braceExpand(pattern, ext(def, options2)),
|
|
30857
|
-
match: (list, pattern, options2 = {}) => orig.match(list, pattern, ext(def, options2)),
|
|
30858
|
-
sep: orig.sep,
|
|
30859
|
-
GLOBSTAR
|
|
30860
|
-
});
|
|
30861
|
-
}, braceExpand = (pattern, options2 = {}) => {
|
|
30862
|
-
assertValidPattern(pattern);
|
|
30863
|
-
if (options2.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
|
|
30864
|
-
return [pattern];
|
|
30865
|
-
}
|
|
30866
|
-
return expand(pattern, { max: options2.braceExpandMax });
|
|
30867
|
-
}, makeRe = (pattern, options2 = {}) => new Minimatch(pattern, options2).makeRe(), match = (list, pattern, options2 = {}) => {
|
|
30868
|
-
const mm = new Minimatch(pattern, options2);
|
|
30869
|
-
list = list.filter((f3) => mm.match(f3));
|
|
30870
|
-
if (mm.options.nonull && !list.length) {
|
|
30871
|
-
list.push(pattern);
|
|
30872
|
-
}
|
|
30873
|
-
return list;
|
|
30874
|
-
}, globMagic, regExpEscape2 = (s) => s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
30875
|
-
var init_esm2 = __esm(() => {
|
|
30876
|
-
init_esm();
|
|
30877
|
-
init_assert_valid_pattern();
|
|
30878
|
-
init_ast();
|
|
30879
|
-
init_ast();
|
|
30880
|
-
starDotExtRE = /^\*+([^+@!?*[(]*)$/;
|
|
30881
|
-
starDotStarRE = /^\*+\.\*+$/;
|
|
30882
|
-
dotStarRE = /^\.\*+$/;
|
|
30883
|
-
starRE = /^\*+$/;
|
|
30884
|
-
qmarksRE = /^\?+([^+@!?*[(]*)?$/;
|
|
30885
|
-
defaultPlatform = typeof process === "object" && process ? typeof process.env === "object" && process.env && process.env.__MINIMATCH_TESTING_PLATFORM__ || process.platform : "posix";
|
|
30886
|
-
path2 = {
|
|
30887
|
-
win32: { sep: "\\" },
|
|
30888
|
-
posix: { sep: "/" }
|
|
30889
|
-
};
|
|
30890
|
-
sep2 = defaultPlatform === "win32" ? path2.win32.sep : path2.posix.sep;
|
|
30891
|
-
minimatch.sep = sep2;
|
|
30892
|
-
GLOBSTAR = Symbol("globstar **");
|
|
30893
|
-
minimatch.GLOBSTAR = GLOBSTAR;
|
|
30894
|
-
star2 = qmark2 + "*?";
|
|
30895
|
-
minimatch.filter = filter;
|
|
30896
|
-
minimatch.defaults = defaults;
|
|
30897
|
-
minimatch.braceExpand = braceExpand;
|
|
30898
|
-
minimatch.makeRe = makeRe;
|
|
30899
|
-
minimatch.match = match;
|
|
30900
|
-
globMagic = /[?*]|[+@!]\(.*?\)|\[|\]/;
|
|
30901
|
-
minimatch.AST = AST;
|
|
30902
|
-
minimatch.Minimatch = Minimatch;
|
|
30903
|
-
minimatch.escape = escape;
|
|
30904
|
-
minimatch.unescape = unescape;
|
|
30905
|
-
});
|
|
30906
|
-
|
|
30907
29247
|
// src/domains/installation/merger/file-scanner.ts
|
|
30908
29248
|
import { relative as relative3 } from "node:path";
|
|
30909
29249
|
import { join as join11 } from "node:path";
|
|
30910
29250
|
|
|
30911
29251
|
class FileScanner {
|
|
30912
|
-
|
|
29252
|
+
includeMatchers = [];
|
|
30913
29253
|
neverCopyChecker;
|
|
30914
29254
|
constructor(neverCopyPatterns) {
|
|
30915
29255
|
this.neverCopyChecker = import_ignore.default().add(neverCopyPatterns);
|
|
30916
29256
|
}
|
|
30917
29257
|
setIncludePatterns(patterns) {
|
|
30918
|
-
this.
|
|
29258
|
+
this.includeMatchers = patterns.map((pattern) => {
|
|
29259
|
+
const globPattern = pattern.includes("*") ? pattern : `${pattern}/**`;
|
|
29260
|
+
return { pattern, matcher: import_picomatch2.default(globPattern, { dot: true }) };
|
|
29261
|
+
});
|
|
30919
29262
|
}
|
|
30920
29263
|
addIgnorePatterns(patterns) {
|
|
30921
29264
|
this.neverCopyChecker.add(patterns);
|
|
@@ -30935,15 +29278,14 @@ class FileScanner {
|
|
|
30935
29278
|
logger.warning(`Skipping symbolic link: ${normalizedRelativePath}`);
|
|
30936
29279
|
continue;
|
|
30937
29280
|
}
|
|
30938
|
-
if (this.
|
|
30939
|
-
const shouldInclude = this.
|
|
30940
|
-
const globPattern = pattern.includes("*") ? pattern : `${pattern}/**`;
|
|
29281
|
+
if (this.includeMatchers.length > 0) {
|
|
29282
|
+
const shouldInclude = this.includeMatchers.some(({ pattern, matcher }) => {
|
|
30941
29283
|
if (!stats.isDirectory()) {
|
|
30942
|
-
return
|
|
29284
|
+
return matcher(normalizedRelativePath);
|
|
30943
29285
|
}
|
|
30944
29286
|
const normalizedPattern = pattern.endsWith("/") ? pattern.slice(0, -1) : pattern;
|
|
30945
29287
|
const normalizedPath = normalizedRelativePath.endsWith("/") ? normalizedRelativePath.slice(0, -1) : normalizedRelativePath;
|
|
30946
|
-
return normalizedPattern.startsWith(`${normalizedPath}/`) || normalizedPattern === normalizedPath ||
|
|
29288
|
+
return normalizedPattern.startsWith(`${normalizedPath}/`) || normalizedPattern === normalizedPath || matcher(normalizedRelativePath);
|
|
30947
29289
|
});
|
|
30948
29290
|
if (!shouldInclude) {
|
|
30949
29291
|
continue;
|
|
@@ -30959,12 +29301,12 @@ class FileScanner {
|
|
|
30959
29301
|
return files;
|
|
30960
29302
|
}
|
|
30961
29303
|
}
|
|
30962
|
-
var import_fs_extra8, import_ignore;
|
|
29304
|
+
var import_fs_extra8, import_ignore, import_picomatch2;
|
|
30963
29305
|
var init_file_scanner = __esm(() => {
|
|
30964
29306
|
init_logger();
|
|
30965
|
-
init_esm2();
|
|
30966
29307
|
import_fs_extra8 = __toESM(require_lib(), 1);
|
|
30967
29308
|
import_ignore = __toESM(require_ignore(), 1);
|
|
29309
|
+
import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
30968
29310
|
});
|
|
30969
29311
|
|
|
30970
29312
|
// src/shared/safe-prompts.ts
|
|
@@ -31924,8 +30266,8 @@ class SettingsProcessor {
|
|
|
31924
30266
|
const pluginRootMatch = command.match(/CLAUDE_PLUGIN_ROOT[^/]*\/([\w.\-/\\]+)/);
|
|
31925
30267
|
if (pluginRootMatch)
|
|
31926
30268
|
return pluginRootMatch[1].replace(/\\/g, "/");
|
|
31927
|
-
const
|
|
31928
|
-
return
|
|
30269
|
+
const match = command.match(/\.claude[/\\]([\w.\-/\\]+)/);
|
|
30270
|
+
return match ? match[1].replace(/\\/g, "/") : null;
|
|
31929
30271
|
}
|
|
31930
30272
|
async trackInstalledSettings(settings) {
|
|
31931
30273
|
if (!this.tracker)
|
|
@@ -32105,8 +30447,8 @@ class SettingsProcessor {
|
|
|
32105
30447
|
timeout: 5000,
|
|
32106
30448
|
stdio: ["ignore", "pipe", "ignore"]
|
|
32107
30449
|
});
|
|
32108
|
-
const
|
|
32109
|
-
this.cachedVersion =
|
|
30450
|
+
const match = output2.match(/(\d+\.\d+\.\d+)/);
|
|
30451
|
+
this.cachedVersion = match ? match[1] : null;
|
|
32110
30452
|
} catch {
|
|
32111
30453
|
this.cachedVersion = null;
|
|
32112
30454
|
}
|
|
@@ -32700,8 +31042,8 @@ var require_section_matter = __commonJS((exports, module) => {
|
|
|
32700
31042
|
options2 = { parse: options2 };
|
|
32701
31043
|
}
|
|
32702
31044
|
var file = toObject(input);
|
|
32703
|
-
var
|
|
32704
|
-
var opts = extend({},
|
|
31045
|
+
var defaults = { section_delimiter: "---", parse: identity2 };
|
|
31046
|
+
var opts = extend({}, defaults, options2);
|
|
32705
31047
|
var delim = opts.section_delimiter;
|
|
32706
31048
|
var lines = file.content.split(/\r?\n/);
|
|
32707
31049
|
var sections = null;
|
|
@@ -33039,34 +31381,34 @@ var require_schema = __commonJS((exports, module) => {
|
|
|
33039
31381
|
}
|
|
33040
31382
|
Schema.DEFAULT = null;
|
|
33041
31383
|
Schema.create = function createSchema() {
|
|
33042
|
-
var schemas,
|
|
31384
|
+
var schemas, types2;
|
|
33043
31385
|
switch (arguments.length) {
|
|
33044
31386
|
case 1:
|
|
33045
31387
|
schemas = Schema.DEFAULT;
|
|
33046
|
-
|
|
31388
|
+
types2 = arguments[0];
|
|
33047
31389
|
break;
|
|
33048
31390
|
case 2:
|
|
33049
31391
|
schemas = arguments[0];
|
|
33050
|
-
|
|
31392
|
+
types2 = arguments[1];
|
|
33051
31393
|
break;
|
|
33052
31394
|
default:
|
|
33053
31395
|
throw new YAMLException("Wrong number of arguments for Schema.create function");
|
|
33054
31396
|
}
|
|
33055
31397
|
schemas = common.toArray(schemas);
|
|
33056
|
-
|
|
31398
|
+
types2 = common.toArray(types2);
|
|
33057
31399
|
if (!schemas.every(function(schema) {
|
|
33058
31400
|
return schema instanceof Schema;
|
|
33059
31401
|
})) {
|
|
33060
31402
|
throw new YAMLException("Specified list of super schemas (or a single Schema object) contains a non-Schema object.");
|
|
33061
31403
|
}
|
|
33062
|
-
if (!
|
|
31404
|
+
if (!types2.every(function(type) {
|
|
33063
31405
|
return type instanceof Type;
|
|
33064
31406
|
})) {
|
|
33065
31407
|
throw new YAMLException("Specified list of YAML types (or a single Type object) contains a non-Type object.");
|
|
33066
31408
|
}
|
|
33067
31409
|
return new Schema({
|
|
33068
31410
|
include: schemas,
|
|
33069
|
-
explicit:
|
|
31411
|
+
explicit: types2
|
|
33070
31412
|
});
|
|
33071
31413
|
};
|
|
33072
31414
|
module.exports = Schema;
|
|
@@ -33466,33 +31808,33 @@ var require_timestamp = __commonJS((exports, module) => {
|
|
|
33466
31808
|
return false;
|
|
33467
31809
|
}
|
|
33468
31810
|
function constructYamlTimestamp(data) {
|
|
33469
|
-
var
|
|
33470
|
-
|
|
33471
|
-
if (
|
|
33472
|
-
|
|
33473
|
-
if (
|
|
31811
|
+
var match, year, month, day, hour, minute, second, fraction = 0, delta = null, tz_hour, tz_minute, date;
|
|
31812
|
+
match = YAML_DATE_REGEXP.exec(data);
|
|
31813
|
+
if (match === null)
|
|
31814
|
+
match = YAML_TIMESTAMP_REGEXP.exec(data);
|
|
31815
|
+
if (match === null)
|
|
33474
31816
|
throw new Error("Date resolve error");
|
|
33475
|
-
year = +
|
|
33476
|
-
month = +
|
|
33477
|
-
day = +
|
|
33478
|
-
if (!
|
|
31817
|
+
year = +match[1];
|
|
31818
|
+
month = +match[2] - 1;
|
|
31819
|
+
day = +match[3];
|
|
31820
|
+
if (!match[4]) {
|
|
33479
31821
|
return new Date(Date.UTC(year, month, day));
|
|
33480
31822
|
}
|
|
33481
|
-
hour = +
|
|
33482
|
-
minute = +
|
|
33483
|
-
second = +
|
|
33484
|
-
if (
|
|
33485
|
-
fraction =
|
|
31823
|
+
hour = +match[4];
|
|
31824
|
+
minute = +match[5];
|
|
31825
|
+
second = +match[6];
|
|
31826
|
+
if (match[7]) {
|
|
31827
|
+
fraction = match[7].slice(0, 3);
|
|
33486
31828
|
while (fraction.length < 3) {
|
|
33487
31829
|
fraction += "0";
|
|
33488
31830
|
}
|
|
33489
31831
|
fraction = +fraction;
|
|
33490
31832
|
}
|
|
33491
|
-
if (
|
|
33492
|
-
tz_hour = +
|
|
33493
|
-
tz_minute = +(
|
|
31833
|
+
if (match[9]) {
|
|
31834
|
+
tz_hour = +match[10];
|
|
31835
|
+
tz_minute = +(match[11] || 0);
|
|
33494
31836
|
delta = (tz_hour * 60 + tz_minute) * 60000;
|
|
33495
|
-
if (
|
|
31837
|
+
if (match[9] === "-")
|
|
33496
31838
|
delta = -delta;
|
|
33497
31839
|
}
|
|
33498
31840
|
date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction));
|
|
@@ -34009,19 +32351,19 @@ var require_loader = __commonJS((exports, module) => {
|
|
|
34009
32351
|
}
|
|
34010
32352
|
var directiveHandlers = {
|
|
34011
32353
|
YAML: function handleYamlDirective(state, name, args) {
|
|
34012
|
-
var
|
|
32354
|
+
var match, major, minor;
|
|
34013
32355
|
if (state.version !== null) {
|
|
34014
32356
|
throwError(state, "duplication of %YAML directive");
|
|
34015
32357
|
}
|
|
34016
32358
|
if (args.length !== 1) {
|
|
34017
32359
|
throwError(state, "YAML directive accepts exactly one argument");
|
|
34018
32360
|
}
|
|
34019
|
-
|
|
34020
|
-
if (
|
|
32361
|
+
match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]);
|
|
32362
|
+
if (match === null) {
|
|
34021
32363
|
throwError(state, "ill-formed argument of the YAML directive");
|
|
34022
32364
|
}
|
|
34023
|
-
major = parseInt(
|
|
34024
|
-
minor = parseInt(
|
|
32365
|
+
major = parseInt(match[1], 10);
|
|
32366
|
+
minor = parseInt(match[2], 10);
|
|
34025
32367
|
if (major !== 1) {
|
|
34026
32368
|
throwError(state, "unacceptable YAML version of the document");
|
|
34027
32369
|
}
|
|
@@ -35288,9 +33630,9 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
35288
33630
|
var prevMoreIndented = string[0] === `
|
|
35289
33631
|
` || string[0] === " ";
|
|
35290
33632
|
var moreIndented;
|
|
35291
|
-
var
|
|
35292
|
-
while (
|
|
35293
|
-
var prefix =
|
|
33633
|
+
var match;
|
|
33634
|
+
while (match = lineRe.exec(string)) {
|
|
33635
|
+
var prefix = match[1], line = match[2];
|
|
35294
33636
|
moreIndented = line[0] === " ";
|
|
35295
33637
|
result += prefix + (!prevMoreIndented && !moreIndented && line !== "" ? `
|
|
35296
33638
|
` : "") + foldLine(line, width);
|
|
@@ -35302,11 +33644,11 @@ var require_dumper = __commonJS((exports, module) => {
|
|
|
35302
33644
|
if (line === "" || line[0] === " ")
|
|
35303
33645
|
return line;
|
|
35304
33646
|
var breakRe = / [^ ]/g;
|
|
35305
|
-
var
|
|
33647
|
+
var match;
|
|
35306
33648
|
var start = 0, end, curr = 0, next = 0;
|
|
35307
33649
|
var result = "";
|
|
35308
|
-
while (
|
|
35309
|
-
next =
|
|
33650
|
+
while (match = breakRe.exec(line)) {
|
|
33651
|
+
next = match.index;
|
|
35310
33652
|
if (next - start > width) {
|
|
35311
33653
|
end = curr > start ? curr : next;
|
|
35312
33654
|
result += `
|
|
@@ -35760,7 +34102,7 @@ var require_engine = __commonJS((exports, module) => {
|
|
|
35760
34102
|
var require_stringify = __commonJS((exports, module) => {
|
|
35761
34103
|
var typeOf = require_kind_of();
|
|
35762
34104
|
var getEngine = require_engine();
|
|
35763
|
-
var
|
|
34105
|
+
var defaults = require_defaults();
|
|
35764
34106
|
module.exports = function(file, data, options2) {
|
|
35765
34107
|
if (data == null && options2 == null) {
|
|
35766
34108
|
switch (typeOf(file)) {
|
|
@@ -35776,7 +34118,7 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
35776
34118
|
}
|
|
35777
34119
|
}
|
|
35778
34120
|
const str2 = file.content;
|
|
35779
|
-
const opts =
|
|
34121
|
+
const opts = defaults(options2);
|
|
35780
34122
|
if (data == null) {
|
|
35781
34123
|
if (!opts.data)
|
|
35782
34124
|
return file;
|
|
@@ -35811,20 +34153,20 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
35811
34153
|
|
|
35812
34154
|
// node_modules/gray-matter/lib/excerpt.js
|
|
35813
34155
|
var require_excerpt = __commonJS((exports, module) => {
|
|
35814
|
-
var
|
|
34156
|
+
var defaults = require_defaults();
|
|
35815
34157
|
module.exports = function(file, options2) {
|
|
35816
|
-
const opts =
|
|
34158
|
+
const opts = defaults(options2);
|
|
35817
34159
|
if (file.data == null) {
|
|
35818
34160
|
file.data = {};
|
|
35819
34161
|
}
|
|
35820
34162
|
if (typeof opts.excerpt === "function") {
|
|
35821
34163
|
return opts.excerpt(file, opts);
|
|
35822
34164
|
}
|
|
35823
|
-
const
|
|
35824
|
-
if (
|
|
34165
|
+
const sep2 = file.data.excerpt_separator || opts.excerpt_separator;
|
|
34166
|
+
if (sep2 == null && (opts.excerpt === false || opts.excerpt == null)) {
|
|
35825
34167
|
return file;
|
|
35826
34168
|
}
|
|
35827
|
-
const delimiter = typeof opts.excerpt === "string" ? opts.excerpt :
|
|
34169
|
+
const delimiter = typeof opts.excerpt === "string" ? opts.excerpt : sep2 || opts.delimiters[0];
|
|
35828
34170
|
const idx = file.content.indexOf(delimiter);
|
|
35829
34171
|
if (idx !== -1) {
|
|
35830
34172
|
file.excerpt = file.content.slice(0, idx);
|
|
@@ -35867,9 +34209,9 @@ var require_to_file = __commonJS((exports, module) => {
|
|
|
35867
34209
|
// node_modules/gray-matter/lib/parse.js
|
|
35868
34210
|
var require_parse3 = __commonJS((exports, module) => {
|
|
35869
34211
|
var getEngine = require_engine();
|
|
35870
|
-
var
|
|
34212
|
+
var defaults = require_defaults();
|
|
35871
34213
|
module.exports = function(language, str2, options2) {
|
|
35872
|
-
const opts =
|
|
34214
|
+
const opts = defaults(options2);
|
|
35873
34215
|
const engine = getEngine(language, opts);
|
|
35874
34216
|
if (typeof engine.parse !== "function") {
|
|
35875
34217
|
throw new TypeError('expected "' + language + '.parse" to be a function');
|
|
@@ -35882,7 +34224,7 @@ var require_parse3 = __commonJS((exports, module) => {
|
|
|
35882
34224
|
var require_gray_matter = __commonJS((exports, module) => {
|
|
35883
34225
|
var fs = __require("fs");
|
|
35884
34226
|
var sections = require_section_matter();
|
|
35885
|
-
var
|
|
34227
|
+
var defaults = require_defaults();
|
|
35886
34228
|
var stringify = require_stringify();
|
|
35887
34229
|
var excerpt = require_excerpt();
|
|
35888
34230
|
var engines = require_engines();
|
|
@@ -35906,7 +34248,7 @@ var require_gray_matter = __commonJS((exports, module) => {
|
|
|
35906
34248
|
return parseMatter(file, options2);
|
|
35907
34249
|
}
|
|
35908
34250
|
function parseMatter(file, options2) {
|
|
35909
|
-
const opts =
|
|
34251
|
+
const opts = defaults(options2);
|
|
35910
34252
|
const open = opts.delimiters[0];
|
|
35911
34253
|
const close = `
|
|
35912
34254
|
` + opts.delimiters[1];
|
|
@@ -35973,10 +34315,10 @@ var require_gray_matter = __commonJS((exports, module) => {
|
|
|
35973
34315
|
return file;
|
|
35974
34316
|
};
|
|
35975
34317
|
matter.test = function(str2, options2) {
|
|
35976
|
-
return utils.startsWith(str2,
|
|
34318
|
+
return utils.startsWith(str2, defaults(options2).delimiters[0]);
|
|
35977
34319
|
};
|
|
35978
34320
|
matter.language = function(str2, options2) {
|
|
35979
|
-
const opts =
|
|
34321
|
+
const opts = defaults(options2);
|
|
35980
34322
|
const open = opts.delimiters[0];
|
|
35981
34323
|
if (matter.test(str2)) {
|
|
35982
34324
|
str2 = str2.slice(open.length);
|
|
@@ -36052,9 +34394,9 @@ async function readWorkflowSlashNames(workflowsDir) {
|
|
|
36052
34394
|
if (!entry.isFile() && !entry.isSymbolicLink())
|
|
36053
34395
|
continue;
|
|
36054
34396
|
const lowered = entry.name.toLowerCase();
|
|
36055
|
-
const
|
|
36056
|
-
if (
|
|
36057
|
-
names.add(basename(lowered,
|
|
34397
|
+
const ext = WORKFLOW_ENTRY_EXTENSIONS.find((e2) => lowered.endsWith(e2));
|
|
34398
|
+
if (ext) {
|
|
34399
|
+
names.add(basename(lowered, ext));
|
|
36058
34400
|
}
|
|
36059
34401
|
}
|
|
36060
34402
|
} catch (error) {
|
|
@@ -36508,8 +34850,8 @@ class FileScanner2 {
|
|
|
36508
34850
|
const resolvedTarget = resolve2(targetPath);
|
|
36509
34851
|
return resolvedTarget.startsWith(resolvedBase);
|
|
36510
34852
|
}
|
|
36511
|
-
static toPosixPath(
|
|
36512
|
-
return
|
|
34853
|
+
static toPosixPath(path2) {
|
|
34854
|
+
return path2.replace(/\\/g, "/");
|
|
36513
34855
|
}
|
|
36514
34856
|
}
|
|
36515
34857
|
var import_fs_extra14;
|
|
@@ -36550,8 +34892,8 @@ function transformCommandContent(content) {
|
|
|
36550
34892
|
return { transformed, changes };
|
|
36551
34893
|
}
|
|
36552
34894
|
function shouldTransformFile(filename) {
|
|
36553
|
-
const
|
|
36554
|
-
return TRANSFORMABLE_EXTENSIONS.has(
|
|
34895
|
+
const ext = filename.toLowerCase().slice(filename.lastIndexOf("."));
|
|
34896
|
+
return TRANSFORMABLE_EXTENSIONS.has(ext);
|
|
36555
34897
|
}
|
|
36556
34898
|
async function transformCommandReferences(directory, options2 = {}) {
|
|
36557
34899
|
let filesTransformed = 0;
|
|
@@ -36619,35 +34961,35 @@ var init_content_transformer = __esm(() => {
|
|
|
36619
34961
|
});
|
|
36620
34962
|
|
|
36621
34963
|
// src/services/transformers/commands-prefix/prefix-utils.ts
|
|
36622
|
-
function stripWindowsDrivePrefix(
|
|
36623
|
-
if (
|
|
36624
|
-
return
|
|
34964
|
+
function stripWindowsDrivePrefix(path2) {
|
|
34965
|
+
if (path2.length >= 2 && /[a-zA-Z]/.test(path2[0]) && path2[1] === ":") {
|
|
34966
|
+
return path2.slice(2);
|
|
36625
34967
|
}
|
|
36626
|
-
if (
|
|
36627
|
-
const remainder =
|
|
34968
|
+
if (path2.startsWith("\\\\?\\")) {
|
|
34969
|
+
const remainder = path2.slice(4);
|
|
36628
34970
|
if (remainder.length >= 2 && /[a-zA-Z]/.test(remainder[0]) && remainder[1] === ":") {
|
|
36629
34971
|
return remainder.slice(2);
|
|
36630
34972
|
}
|
|
36631
34973
|
}
|
|
36632
|
-
return
|
|
34974
|
+
return path2;
|
|
36633
34975
|
}
|
|
36634
|
-
function validatePath(
|
|
36635
|
-
if (!
|
|
34976
|
+
function validatePath(path2, paramName) {
|
|
34977
|
+
if (!path2 || typeof path2 !== "string") {
|
|
36636
34978
|
throw new Error(`${paramName} must be a non-empty string`);
|
|
36637
34979
|
}
|
|
36638
|
-
if (
|
|
34980
|
+
if (path2.length > 1000) {
|
|
36639
34981
|
throw new Error(`${paramName} path too long (max 1000 chars)`);
|
|
36640
34982
|
}
|
|
36641
|
-
if (/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(
|
|
36642
|
-
throw new Error(`${paramName} contains path traversal: ${
|
|
34983
|
+
if (/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(path2) || path2.startsWith("~")) {
|
|
34984
|
+
throw new Error(`${paramName} contains path traversal: ${path2}`);
|
|
36643
34985
|
}
|
|
36644
|
-
const sanitizedPath = stripWindowsDrivePrefix(
|
|
34986
|
+
const sanitizedPath = stripWindowsDrivePrefix(path2);
|
|
36645
34987
|
if (/[<>:"|?*]/.test(sanitizedPath)) {
|
|
36646
|
-
logger.debug(`Path validation failed (invalid character) for ${paramName}: ${
|
|
36647
|
-
throw new Error(`${paramName} contains invalid characters: ${
|
|
34988
|
+
logger.debug(`Path validation failed (invalid character) for ${paramName}: ${path2}`);
|
|
34989
|
+
throw new Error(`${paramName} contains invalid characters: ${path2}`);
|
|
36648
34990
|
}
|
|
36649
|
-
for (let i = 0;i <
|
|
36650
|
-
const code =
|
|
34991
|
+
for (let i = 0;i < path2.length; i++) {
|
|
34992
|
+
const code = path2.charCodeAt(i);
|
|
36651
34993
|
if (code < 32 || code === 127) {
|
|
36652
34994
|
throw new Error(`${paramName} contains control characters`);
|
|
36653
34995
|
}
|
|
@@ -37113,11 +35455,11 @@ class OwnershipDisplay {
|
|
|
37113
35455
|
OwnershipDisplay.displaySummary(summary, "Preview Summary");
|
|
37114
35456
|
f2.warn(import_picocolors13.default.yellow("No changes were made. Run without --dry-run to apply changes."));
|
|
37115
35457
|
}
|
|
37116
|
-
static displayFile(
|
|
35458
|
+
static displayFile(path2, ownership, action, reason) {
|
|
37117
35459
|
const ownershipStr = OwnershipDisplay.formatOwnership(ownership);
|
|
37118
35460
|
const actionStr = OwnershipDisplay.formatAction(action);
|
|
37119
35461
|
const reasonStr = reason ? import_picocolors13.default.gray(` - ${reason}`) : "";
|
|
37120
|
-
console.log(` ${actionStr} ${
|
|
35462
|
+
console.log(` ${actionStr} ${path2} [${ownershipStr}]${reasonStr}`);
|
|
37121
35463
|
}
|
|
37122
35464
|
static displayForceWarning() {
|
|
37123
35465
|
f2.warn(`${import_picocolors13.default.yellow(import_picocolors13.default.bold("FORCE MODE ENABLED"))}
|
|
@@ -37250,8 +35592,8 @@ async function handleMerge(ctx) {
|
|
|
37250
35592
|
const deletionResult = await handleDeletions(sourceMetadata, ctx.claudeDir, ctx.kitType);
|
|
37251
35593
|
if (deletionResult.deletedPaths.length > 0) {
|
|
37252
35594
|
logger.info(`Removed ${deletionResult.deletedPaths.length} deprecated file(s)`);
|
|
37253
|
-
for (const
|
|
37254
|
-
logger.verbose(` - ${
|
|
35595
|
+
for (const path2 of deletionResult.deletedPaths) {
|
|
35596
|
+
logger.verbose(` - ${path2}`);
|
|
37255
35597
|
}
|
|
37256
35598
|
}
|
|
37257
35599
|
if (deletionResult.preservedPaths.length > 0) {
|
|
@@ -38059,26 +36401,26 @@ var init_migration_executor = __esm(() => {
|
|
|
38059
36401
|
});
|
|
38060
36402
|
|
|
38061
36403
|
// src/domains/skills/migrator/migration-validator.ts
|
|
38062
|
-
function validateMigrationPath(
|
|
38063
|
-
if (!
|
|
36404
|
+
function validateMigrationPath(path2, paramName) {
|
|
36405
|
+
if (!path2 || typeof path2 !== "string") {
|
|
38064
36406
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
38065
36407
|
}
|
|
38066
|
-
if (
|
|
36408
|
+
if (path2.length > 1000) {
|
|
38067
36409
|
throw new SkillsMigrationError(`${paramName} path too long (max 1000 characters)`);
|
|
38068
36410
|
}
|
|
38069
|
-
const isWindowsAbsolutePath = /^[A-Za-z]:[/\\]/.test(
|
|
38070
|
-
const hasDangerousTilde =
|
|
38071
|
-
if (/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(
|
|
38072
|
-
throw new SkillsMigrationError(`${paramName} contains potentially dangerous path traversal: ${
|
|
36411
|
+
const isWindowsAbsolutePath = /^[A-Za-z]:[/\\]/.test(path2);
|
|
36412
|
+
const hasDangerousTilde = path2.includes("~") && !isWindowsAbsolutePath;
|
|
36413
|
+
if (/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(path2) || hasDangerousTilde) {
|
|
36414
|
+
throw new SkillsMigrationError(`${paramName} contains potentially dangerous path traversal: ${path2}`);
|
|
38073
36415
|
}
|
|
38074
|
-
const pathWithoutDrive =
|
|
36416
|
+
const pathWithoutDrive = path2.replace(/^[A-Za-z]:/, "");
|
|
38075
36417
|
if (/[<>:"|?*]/.test(pathWithoutDrive)) {
|
|
38076
|
-
throw new SkillsMigrationError(`${paramName} contains invalid characters: ${
|
|
36418
|
+
throw new SkillsMigrationError(`${paramName} contains invalid characters: ${path2}`);
|
|
38077
36419
|
}
|
|
38078
|
-
for (let i = 0;i <
|
|
38079
|
-
const charCode =
|
|
36420
|
+
for (let i = 0;i < path2.length; i++) {
|
|
36421
|
+
const charCode = path2.charCodeAt(i);
|
|
38080
36422
|
if (charCode < 32 || charCode === 127) {
|
|
38081
|
-
throw new SkillsMigrationError(`${paramName} contains control characters: ${
|
|
36423
|
+
throw new SkillsMigrationError(`${paramName} contains control characters: ${path2}`);
|
|
38082
36424
|
}
|
|
38083
36425
|
}
|
|
38084
36426
|
}
|
|
@@ -38089,14 +36431,14 @@ var init_migration_validator = __esm(() => {
|
|
|
38089
36431
|
// src/domains/skills/skills-backup-manager.ts
|
|
38090
36432
|
import { copyFile as copyFile3, mkdir as mkdir5, readdir as readdir13, rm as rm2, stat as stat6 } from "node:fs/promises";
|
|
38091
36433
|
import { basename as basename2, join as join29, normalize as normalize3 } from "node:path";
|
|
38092
|
-
function validatePath2(
|
|
38093
|
-
if (!
|
|
36434
|
+
function validatePath2(path2, paramName) {
|
|
36435
|
+
if (!path2 || typeof path2 !== "string") {
|
|
38094
36436
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
38095
36437
|
}
|
|
38096
|
-
if (
|
|
38097
|
-
const normalized = normalize3(
|
|
36438
|
+
if (path2.includes("..")) {
|
|
36439
|
+
const normalized = normalize3(path2);
|
|
38098
36440
|
if (normalized.startsWith("..")) {
|
|
38099
|
-
throw new SkillsMigrationError(`${paramName} contains invalid path traversal: ${
|
|
36441
|
+
throw new SkillsMigrationError(`${paramName} contains invalid path traversal: ${path2}`);
|
|
38100
36442
|
}
|
|
38101
36443
|
}
|
|
38102
36444
|
}
|
|
@@ -38384,14 +36726,14 @@ var init_comparison_engine = __esm(() => {
|
|
|
38384
36726
|
// src/domains/skills/customization/scan-reporter.ts
|
|
38385
36727
|
import { readdir as readdir15 } from "node:fs/promises";
|
|
38386
36728
|
import { join as join31, normalize as normalize4 } from "node:path";
|
|
38387
|
-
function validatePath3(
|
|
38388
|
-
if (!
|
|
36729
|
+
function validatePath3(path2, paramName) {
|
|
36730
|
+
if (!path2 || typeof path2 !== "string") {
|
|
38389
36731
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
38390
36732
|
}
|
|
38391
|
-
if (
|
|
38392
|
-
const normalized = normalize4(
|
|
36733
|
+
if (path2.includes("..")) {
|
|
36734
|
+
const normalized = normalize4(path2);
|
|
38393
36735
|
if (normalized.startsWith("..")) {
|
|
38394
|
-
throw new SkillsMigrationError(`${paramName} contains invalid path traversal: ${
|
|
36736
|
+
throw new SkillsMigrationError(`${paramName} contains invalid path traversal: ${path2}`);
|
|
38395
36737
|
}
|
|
38396
36738
|
}
|
|
38397
36739
|
}
|
|
@@ -38694,8 +37036,8 @@ function transformOpenCodeContent(content) {
|
|
|
38694
37036
|
return { transformed, changes };
|
|
38695
37037
|
}
|
|
38696
37038
|
function shouldTransformFile2(filename) {
|
|
38697
|
-
const
|
|
38698
|
-
return TRANSFORMABLE_EXTENSIONS2.has(
|
|
37039
|
+
const ext = extname(filename).toLowerCase();
|
|
37040
|
+
return TRANSFORMABLE_EXTENSIONS2.has(ext);
|
|
38699
37041
|
}
|
|
38700
37042
|
async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
38701
37043
|
let filesTransformed = 0;
|
|
@@ -38973,9 +37315,9 @@ async function getPackageVersion(packageName) {
|
|
|
38973
37315
|
new RegExp(`${escapeRegex(packageName)}@([0-9]+\\.[0-9]+\\.[0-9]+(?:-[\\w.-]+)?)`)
|
|
38974
37316
|
];
|
|
38975
37317
|
for (const pattern of patterns) {
|
|
38976
|
-
const
|
|
38977
|
-
if (
|
|
38978
|
-
return
|
|
37318
|
+
const match = stdout.match(pattern);
|
|
37319
|
+
if (match?.[1]) {
|
|
37320
|
+
return match[1].trim();
|
|
38979
37321
|
}
|
|
38980
37322
|
}
|
|
38981
37323
|
return null;
|
|
@@ -40113,14 +38455,14 @@ var init_installer = __esm(() => {
|
|
|
40113
38455
|
import { existsSync as existsSync13, readdirSync as readdirSync2, statSync } from "node:fs";
|
|
40114
38456
|
import { homedir as homedir7 } from "node:os";
|
|
40115
38457
|
import { join as join45 } from "node:path";
|
|
40116
|
-
function hasInstallSignal(
|
|
40117
|
-
if (!
|
|
38458
|
+
function hasInstallSignal(path2) {
|
|
38459
|
+
if (!path2 || !existsSync13(path2)) {
|
|
40118
38460
|
return false;
|
|
40119
38461
|
}
|
|
40120
38462
|
try {
|
|
40121
|
-
const stat7 = statSync(
|
|
38463
|
+
const stat7 = statSync(path2);
|
|
40122
38464
|
if (stat7.isDirectory()) {
|
|
40123
|
-
return readdirSync2(
|
|
38465
|
+
return readdirSync2(path2).length > 0;
|
|
40124
38466
|
}
|
|
40125
38467
|
if (stat7.isFile()) {
|
|
40126
38468
|
return true;
|
|
@@ -40131,7 +38473,7 @@ function hasInstallSignal(path3) {
|
|
|
40131
38473
|
}
|
|
40132
38474
|
}
|
|
40133
38475
|
function hasAnyInstallSignal(paths) {
|
|
40134
|
-
return paths.some((
|
|
38476
|
+
return paths.some((path2) => hasInstallSignal(path2));
|
|
40135
38477
|
}
|
|
40136
38478
|
var home2, cwd, providers;
|
|
40137
38479
|
var init_provider_registry = __esm(() => {
|
|
@@ -41342,7 +39684,7 @@ async function withRegistryLock(operation) {
|
|
|
41342
39684
|
await release();
|
|
41343
39685
|
}
|
|
41344
39686
|
}
|
|
41345
|
-
async function addPortableInstallation(item, type, provider, global3,
|
|
39687
|
+
async function addPortableInstallation(item, type, provider, global3, path2, sourcePath, options2) {
|
|
41346
39688
|
await withRegistryLock(async () => {
|
|
41347
39689
|
const registry = await readPortableRegistry();
|
|
41348
39690
|
registry.installations = registry.installations.filter((i) => !(i.item === item && i.type === type && i.provider === provider && i.global === global3));
|
|
@@ -41351,7 +39693,7 @@ async function addPortableInstallation(item, type, provider, global3, path3, sou
|
|
|
41351
39693
|
type,
|
|
41352
39694
|
provider,
|
|
41353
39695
|
global: global3,
|
|
41354
|
-
path:
|
|
39696
|
+
path: path2,
|
|
41355
39697
|
installedAt: new Date().toISOString(),
|
|
41356
39698
|
sourcePath,
|
|
41357
39699
|
cliVersion: getCliVersion2(),
|
|
@@ -41461,9 +39803,9 @@ var init_portable_registry = __esm(() => {
|
|
|
41461
39803
|
// src/commands/portable/portable-manifest.ts
|
|
41462
39804
|
import { existsSync as existsSync15 } from "node:fs";
|
|
41463
39805
|
import { readFile as readFile19 } from "node:fs/promises";
|
|
41464
|
-
import
|
|
39806
|
+
import path2 from "node:path";
|
|
41465
39807
|
async function loadPortableManifest(kitPath) {
|
|
41466
|
-
const manifestPath =
|
|
39808
|
+
const manifestPath = path2.join(kitPath, "portable-manifest.json");
|
|
41467
39809
|
try {
|
|
41468
39810
|
if (!existsSync15(manifestPath)) {
|
|
41469
39811
|
logger.verbose("No portable-manifest.json found — no evolution tracking");
|
|
@@ -41525,7 +39867,7 @@ var init_portable_manifest = __esm(() => {
|
|
|
41525
39867
|
init_zod();
|
|
41526
39868
|
init_logger();
|
|
41527
39869
|
import_semver3 = __toESM(require_semver2(), 1);
|
|
41528
|
-
safeRelativePath = exports_external.string().min(1).refine((p) => !p.includes("..") && !
|
|
39870
|
+
safeRelativePath = exports_external.string().min(1).refine((p) => !p.includes("..") && !path2.isAbsolute(p), {
|
|
41529
39871
|
message: "Path must be relative without traversal"
|
|
41530
39872
|
});
|
|
41531
39873
|
RenameEntrySchema = exports_external.object({
|
|
@@ -41556,16 +39898,16 @@ var init_portable_manifest = __esm(() => {
|
|
|
41556
39898
|
});
|
|
41557
39899
|
|
|
41558
39900
|
// src/commands/portable/reconciler.ts
|
|
41559
|
-
import
|
|
39901
|
+
import path3 from "node:path";
|
|
41560
39902
|
function normalizePortablePath(value) {
|
|
41561
39903
|
const asPosix = value.replace(/\\/g, "/");
|
|
41562
|
-
const normalized =
|
|
39904
|
+
const normalized = path3.posix.normalize(asPosix);
|
|
41563
39905
|
if (normalized === ".")
|
|
41564
39906
|
return "";
|
|
41565
39907
|
return normalized.replace(/^\.\/+/, "");
|
|
41566
39908
|
}
|
|
41567
39909
|
function isAbsoluteLike(value) {
|
|
41568
|
-
return
|
|
39910
|
+
return path3.isAbsolute(value) || /^[a-zA-Z]:[\\/]/.test(value) || /^\\\\/.test(value);
|
|
41569
39911
|
}
|
|
41570
39912
|
function hasDotDotSegment(value) {
|
|
41571
39913
|
return value.replace(/\\/g, "/").split("/").some((segment) => segment === "..");
|
|
@@ -42607,8 +40949,8 @@ var init_fm_to_yaml = __esm(() => {
|
|
|
42607
40949
|
|
|
42608
40950
|
// src/commands/portable/converters/md-strip.ts
|
|
42609
40951
|
import { homedir as homedir9 } from "node:os";
|
|
42610
|
-
function normalizeProjectPath(
|
|
42611
|
-
const normalized =
|
|
40952
|
+
function normalizeProjectPath(path4) {
|
|
40953
|
+
const normalized = path4.replace(/\\/g, "/").replace(/^\.\//, "");
|
|
42612
40954
|
const home4 = homedir9().replace(/\\/g, "/");
|
|
42613
40955
|
return normalized.startsWith(home4) ? normalized.replace(home4, "~") : normalized;
|
|
42614
40956
|
}
|
|
@@ -42657,9 +40999,9 @@ function truncateAtCleanBoundary(content, limit) {
|
|
|
42657
40999
|
}
|
|
42658
41000
|
const sectionRegex = /^(#{2,3})\s+(.+)$/gm;
|
|
42659
41001
|
const sectionStarts = [];
|
|
42660
|
-
for (const
|
|
42661
|
-
if (
|
|
42662
|
-
sectionStarts.push({ index:
|
|
41002
|
+
for (const match of content.matchAll(sectionRegex)) {
|
|
41003
|
+
if (match.index !== undefined) {
|
|
41004
|
+
sectionStarts.push({ index: match.index, title: match[2].trim() });
|
|
42663
41005
|
}
|
|
42664
41006
|
}
|
|
42665
41007
|
if (sectionStarts.length === 0) {
|
|
@@ -42720,9 +41062,9 @@ function stripClaudeRefs(content, options2) {
|
|
|
42720
41062
|
return { content, warnings, removedSections: [] };
|
|
42721
41063
|
}
|
|
42722
41064
|
const codeBlockRanges = [];
|
|
42723
|
-
for (const
|
|
42724
|
-
if (
|
|
42725
|
-
codeBlockRanges.push([
|
|
41065
|
+
for (const match of content.matchAll(/```[\s\S]*?```/g)) {
|
|
41066
|
+
if (match.index !== undefined) {
|
|
41067
|
+
codeBlockRanges.push([match.index, match.index + match[0].length]);
|
|
42726
41068
|
}
|
|
42727
41069
|
}
|
|
42728
41070
|
const isInCodeBlock = (pos) => {
|
|
@@ -42991,7 +41333,7 @@ var init_converters = __esm(() => {
|
|
|
42991
41333
|
import { existsSync as existsSync16 } from "node:fs";
|
|
42992
41334
|
import { mkdir as mkdir10, readFile as readFile20, unlink as unlink3, writeFile as writeFile13 } from "node:fs/promises";
|
|
42993
41335
|
import { homedir as homedir10 } from "node:os";
|
|
42994
|
-
import { basename as basename3, dirname as dirname10, join as join48, resolve as resolve5, sep as
|
|
41336
|
+
import { basename as basename3, dirname as dirname10, join as join48, resolve as resolve5, sep as sep2 } from "node:path";
|
|
42995
41337
|
function isSamePath(path1, path22) {
|
|
42996
41338
|
try {
|
|
42997
41339
|
return resolve5(path1) === resolve5(path22);
|
|
@@ -43019,13 +41361,13 @@ function getErrorMessage(error, targetPath) {
|
|
|
43019
41361
|
function isErrnoCode2(error, code) {
|
|
43020
41362
|
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
43021
41363
|
}
|
|
43022
|
-
function isWindowsAbsolutePath(
|
|
43023
|
-
return /^[a-zA-Z]:[\\/]/.test(
|
|
41364
|
+
function isWindowsAbsolutePath(path4) {
|
|
41365
|
+
return /^[a-zA-Z]:[\\/]/.test(path4) || /^\\\\/.test(path4);
|
|
43024
41366
|
}
|
|
43025
41367
|
function isPathWithinBoundary(targetPath, boundaryPath) {
|
|
43026
41368
|
const resolvedTarget = resolve5(targetPath);
|
|
43027
41369
|
const resolvedBoundary = resolve5(boundaryPath);
|
|
43028
|
-
return resolvedTarget === resolvedBoundary || resolvedTarget.startsWith(`${resolvedBoundary}${
|
|
41370
|
+
return resolvedTarget === resolvedBoundary || resolvedTarget.startsWith(`${resolvedBoundary}${sep2}`);
|
|
43029
41371
|
}
|
|
43030
41372
|
function getProjectBoundary(options2) {
|
|
43031
41373
|
return options2.projectRoot ?? process.cwd();
|
|
@@ -43162,7 +41504,7 @@ var init_internal = __esm(() => {
|
|
|
43162
41504
|
|
|
43163
41505
|
// src/domains/installers/shared/writers/install-one-file.ts
|
|
43164
41506
|
import { writeFile as writeFile14 } from "node:fs/promises";
|
|
43165
|
-
import { dirname as dirname11, join as join49, resolve as resolve6, sep as
|
|
41507
|
+
import { dirname as dirname11, join as join49, resolve as resolve6, sep as sep3 } from "node:path";
|
|
43166
41508
|
async function installOneFile(item, provider, kind, options2) {
|
|
43167
41509
|
const config = providers[provider];
|
|
43168
41510
|
const typeKey = getProviderPathKey(kind);
|
|
@@ -43214,14 +41556,14 @@ async function installOneFile(item, provider, kind, options2) {
|
|
|
43214
41556
|
let resolvedFilename = result.filename;
|
|
43215
41557
|
if (pathConfig.nestedCommands === false && resolvedFilename.includes("/")) {
|
|
43216
41558
|
const extIdx = resolvedFilename.lastIndexOf(".");
|
|
43217
|
-
const
|
|
41559
|
+
const ext = extIdx >= 0 ? resolvedFilename.substring(extIdx) : "";
|
|
43218
41560
|
const nameWithoutExt = extIdx >= 0 ? resolvedFilename.substring(0, extIdx) : resolvedFilename;
|
|
43219
|
-
resolvedFilename = `${nameWithoutExt.replace(/\//g, "-")}${
|
|
41561
|
+
resolvedFilename = `${nameWithoutExt.replace(/\//g, "-")}${ext}`;
|
|
43220
41562
|
}
|
|
43221
41563
|
targetPath = pathConfig.writeStrategy === "single-file" ? basePath : join49(basePath, resolvedFilename);
|
|
43222
41564
|
const resolvedTarget = resolve6(targetPath);
|
|
43223
41565
|
const resolvedBase = pathConfig.writeStrategy === "single-file" ? resolve6(dirname11(basePath)) : resolve6(basePath);
|
|
43224
|
-
if (!resolvedTarget.startsWith(resolvedBase +
|
|
41566
|
+
if (!resolvedTarget.startsWith(resolvedBase + sep3) && resolvedTarget !== resolvedBase) {
|
|
43225
41567
|
return {
|
|
43226
41568
|
provider,
|
|
43227
41569
|
providerDisplayName: config.displayName,
|
|
@@ -43826,8 +42168,8 @@ async function ensureDir3(filePath) {
|
|
|
43826
42168
|
function isErrnoCode3(error, code) {
|
|
43827
42169
|
return typeof error === "object" && error !== null && "code" in error && error.code === code;
|
|
43828
42170
|
}
|
|
43829
|
-
function normalizePathForComparison(
|
|
43830
|
-
const normalized = resolve7(
|
|
42171
|
+
function normalizePathForComparison(path4) {
|
|
42172
|
+
const normalized = resolve7(path4);
|
|
43831
42173
|
return process.platform === "win32" ? normalized.toLowerCase() : normalized;
|
|
43832
42174
|
}
|
|
43833
42175
|
function isPathWithinBoundary2(targetPath, boundaryPath) {
|
|
@@ -43839,11 +42181,11 @@ function isPathWithinBoundary2(targetPath, boundaryPath) {
|
|
|
43839
42181
|
const rel = relative10(normalizedBoundary, normalizedTarget);
|
|
43840
42182
|
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
43841
42183
|
}
|
|
43842
|
-
async function resolveRealPathSafe(
|
|
42184
|
+
async function resolveRealPathSafe(path4) {
|
|
43843
42185
|
try {
|
|
43844
|
-
return await realpath(
|
|
42186
|
+
return await realpath(path4);
|
|
43845
42187
|
} catch {
|
|
43846
|
-
return resolve7(
|
|
42188
|
+
return resolve7(path4);
|
|
43847
42189
|
}
|
|
43848
42190
|
}
|
|
43849
42191
|
async function isCanonicalPathWithinBoundary(targetPath, boundaryPath) {
|
|
@@ -43869,9 +42211,9 @@ function extractManagedAgentEntries(existing) {
|
|
|
43869
42211
|
const endPattern = `# --- ${LEGACY_SENTINEL_PATTERN}-end ---`;
|
|
43870
42212
|
const blockRegex = new RegExp(`^${startPattern}\\s*\\r?\\n[\\s\\S]*?^${endPattern}\\s*(?:\\r?\\n)?`, "gm");
|
|
43871
42213
|
const sentinelLineRegex = new RegExp(`^# --- ${LEGACY_SENTINEL_PATTERN}-(start|end) ---$`);
|
|
43872
|
-
let
|
|
43873
|
-
while (
|
|
43874
|
-
const blockContent =
|
|
42214
|
+
let match = blockRegex.exec(existing);
|
|
42215
|
+
while (match) {
|
|
42216
|
+
const blockContent = match[0].split(/\r?\n/).filter((line) => {
|
|
43875
42217
|
const trimmed = line.trim();
|
|
43876
42218
|
return !sentinelLineRegex.test(trimmed);
|
|
43877
42219
|
}).join(`
|
|
@@ -43898,7 +42240,7 @@ function extractManagedAgentEntries(existing) {
|
|
|
43898
42240
|
}
|
|
43899
42241
|
}
|
|
43900
42242
|
commitEntry();
|
|
43901
|
-
|
|
42243
|
+
match = blockRegex.exec(existing);
|
|
43902
42244
|
}
|
|
43903
42245
|
return entries;
|
|
43904
42246
|
}
|
|
@@ -43909,9 +42251,9 @@ function stripRanges(content, ranges) {
|
|
|
43909
42251
|
const sorted = [...ranges].sort((a3, b3) => a3.start - b3.start);
|
|
43910
42252
|
let cursor = 0;
|
|
43911
42253
|
let result = "";
|
|
43912
|
-
for (const
|
|
43913
|
-
result += content.slice(cursor,
|
|
43914
|
-
cursor =
|
|
42254
|
+
for (const range of sorted) {
|
|
42255
|
+
result += content.slice(cursor, range.start);
|
|
42256
|
+
cursor = range.end;
|
|
43915
42257
|
}
|
|
43916
42258
|
result += content.slice(cursor);
|
|
43917
42259
|
return result;
|
|
@@ -43927,14 +42269,14 @@ function analyzeConfigToml(existing) {
|
|
|
43927
42269
|
const endCount = [...existing.matchAll(endLineRegex)].length;
|
|
43928
42270
|
const blockRegex = new RegExp(`^${startPattern}\\s*\\r?\\n[\\s\\S]*?^${endPattern}\\s*(?:\\r?\\n)?`, "gm");
|
|
43929
42271
|
const candidateRanges = [];
|
|
43930
|
-
let
|
|
43931
|
-
while (
|
|
42272
|
+
let match = blockRegex.exec(existing);
|
|
42273
|
+
while (match) {
|
|
43932
42274
|
candidateRanges.push({
|
|
43933
|
-
start:
|
|
43934
|
-
end:
|
|
43935
|
-
content:
|
|
42275
|
+
start: match.index,
|
|
42276
|
+
end: match.index + match[0].length,
|
|
42277
|
+
content: match[0]
|
|
43936
42278
|
});
|
|
43937
|
-
|
|
42279
|
+
match = blockRegex.exec(existing);
|
|
43938
42280
|
}
|
|
43939
42281
|
const candidateCount = candidateRanges.length;
|
|
43940
42282
|
const unmatchedStart = Math.max(0, startCount - candidateCount);
|
|
@@ -43948,7 +42290,7 @@ function analyzeConfigToml(existing) {
|
|
|
43948
42290
|
error: "Malformed managed agent sentinels in config.toml (unmatched start/end markers). Please clean up sentinels manually."
|
|
43949
42291
|
};
|
|
43950
42292
|
}
|
|
43951
|
-
const managedRanges = candidateRanges.filter((
|
|
42293
|
+
const managedRanges = candidateRanges.filter((range) => isManagedAgentBlock(range.content));
|
|
43952
42294
|
if (managedRanges.length > 1) {
|
|
43953
42295
|
warnings.push(`Found ${managedRanges.length} managed agent blocks in config.toml; collapsing into one managed block`);
|
|
43954
42296
|
}
|
|
@@ -43963,13 +42305,13 @@ function analyzeConfigToml(existing) {
|
|
|
43963
42305
|
function extractUnmanagedAgentSlugs(content) {
|
|
43964
42306
|
const slugs = new Set;
|
|
43965
42307
|
const regex2 = /^\[agents\.(?:"([^"]+)"|([^\]\r\n]+))\]\s*$/gm;
|
|
43966
|
-
let
|
|
43967
|
-
while (
|
|
43968
|
-
const slug = (
|
|
42308
|
+
let match = regex2.exec(content);
|
|
42309
|
+
while (match) {
|
|
42310
|
+
const slug = (match[1] || match[2] || "").trim();
|
|
43969
42311
|
if (slug.length > 0) {
|
|
43970
42312
|
slugs.add(slug);
|
|
43971
42313
|
}
|
|
43972
|
-
|
|
42314
|
+
match = regex2.exec(content);
|
|
43973
42315
|
}
|
|
43974
42316
|
return slugs;
|
|
43975
42317
|
}
|
|
@@ -44656,12 +42998,12 @@ var init_reconcile_registry_backfill = __esm(() => {
|
|
|
44656
42998
|
});
|
|
44657
42999
|
|
|
44658
43000
|
// src/commands/portable/hook-migration-compatibility.ts
|
|
44659
|
-
import
|
|
43001
|
+
import path4 from "node:path";
|
|
44660
43002
|
function normalizeHookAssetPath(value) {
|
|
44661
43003
|
return value.replace(/\\/g, "/").replace(/^["']|["']$/g, "").replace(/[),;]+$/, "").replace(/^\.\//, "").replace(/^\$HOME\/\.claude\/hooks\//, "").replace(/^\$HOME\/\.codex\/hooks\//, "").replace(/^~\/\.claude\/hooks\//, "").replace(/^~\/\.codex\/hooks\//, "").replace(/^\.claude\/hooks\//, "").replace(/^\.codex\/hooks\//, "").replace(/^hooks\//, "").replace(/^\.\//, "").replace(/^\/+/, "");
|
|
44662
43004
|
}
|
|
44663
43005
|
function hookAssetBasename(value) {
|
|
44664
|
-
return
|
|
43006
|
+
return path4.posix.basename(normalizeHookAssetPath(value));
|
|
44665
43007
|
}
|
|
44666
43008
|
function isExcludedHookAsset(value) {
|
|
44667
43009
|
return CODEX_EXCLUDED_HOOK_BASENAMES.has(hookAssetBasename(value));
|
|
@@ -44672,16 +43014,16 @@ function isCodexSupportedHookEvent(event) {
|
|
|
44672
43014
|
function extractHookReferencesFromCommand(command) {
|
|
44673
43015
|
const refs = new Set;
|
|
44674
43016
|
const hookDirPattern = /(?:\$HOME\/|~\/)?\.(?:claude|codex)\/hooks\/([^"'\s;&|><)]+)/g;
|
|
44675
|
-
for (const
|
|
44676
|
-
const ref = normalizeHookAssetPath(
|
|
44677
|
-
if (ref && HOOK_REF_EXTENSIONS.has(
|
|
43017
|
+
for (const match of command.matchAll(hookDirPattern)) {
|
|
43018
|
+
const ref = normalizeHookAssetPath(match[1] ?? "");
|
|
43019
|
+
if (ref && HOOK_REF_EXTENSIONS.has(path4.posix.extname(ref).toLowerCase()))
|
|
44678
43020
|
refs.add(ref);
|
|
44679
43021
|
}
|
|
44680
43022
|
for (const rawToken of command.split(/\s+/)) {
|
|
44681
43023
|
const token = normalizeHookAssetPath(rawToken);
|
|
44682
43024
|
if (!token || refs.has(token))
|
|
44683
43025
|
continue;
|
|
44684
|
-
if (HOOK_REF_EXTENSIONS.has(
|
|
43026
|
+
if (HOOK_REF_EXTENSIONS.has(path4.posix.extname(token).toLowerCase()))
|
|
44685
43027
|
refs.add(token);
|
|
44686
43028
|
}
|
|
44687
43029
|
return [...refs];
|
|
@@ -44900,9 +43242,9 @@ async function detectCodexCapabilities() {
|
|
|
44900
43242
|
if (rawStdout !== null) {
|
|
44901
43243
|
const raw = rawStdout.trim();
|
|
44902
43244
|
const version3 = raw.replace(/^(codex\s+)?v?/i, "").trim();
|
|
44903
|
-
const
|
|
44904
|
-
if (
|
|
44905
|
-
return
|
|
43245
|
+
const match = findCapabilitiesForVersion(version3);
|
|
43246
|
+
if (match)
|
|
43247
|
+
return match;
|
|
44906
43248
|
logger.warning(`[!] Codex version ${version3} not found in capability table; using most-restrictive baseline. Set CK_CODEX_COMPAT=optimistic to use newest known capabilities instead.`);
|
|
44907
43249
|
return FALLBACK_CAPABILITIES;
|
|
44908
43250
|
}
|
|
@@ -45146,17 +43488,17 @@ var init_claude_to_codex_hooks = () => {};
|
|
|
45146
43488
|
import { existsSync as existsSync21 } from "node:fs";
|
|
45147
43489
|
import { mkdir as mkdir13, realpath as realpath2 } from "node:fs/promises";
|
|
45148
43490
|
import { homedir as homedir13 } from "node:os";
|
|
45149
|
-
import { dirname as dirname14, join as join53, resolve as resolve9, sep as
|
|
43491
|
+
import { dirname as dirname14, join as join53, resolve as resolve9, sep as sep4 } from "node:path";
|
|
45150
43492
|
function isPathWithinBoundary3(targetPath, boundaryPath) {
|
|
45151
43493
|
const resolvedTarget = resolve9(targetPath);
|
|
45152
43494
|
const resolvedBoundary = resolve9(boundaryPath);
|
|
45153
|
-
return resolvedTarget === resolvedBoundary || resolvedTarget.startsWith(`${resolvedBoundary}${
|
|
43495
|
+
return resolvedTarget === resolvedBoundary || resolvedTarget.startsWith(`${resolvedBoundary}${sep4}`);
|
|
45154
43496
|
}
|
|
45155
|
-
async function resolveRealPathSafe2(
|
|
43497
|
+
async function resolveRealPathSafe2(path5) {
|
|
45156
43498
|
try {
|
|
45157
|
-
return await realpath2(
|
|
43499
|
+
return await realpath2(path5);
|
|
45158
43500
|
} catch {
|
|
45159
|
-
return resolve9(
|
|
43501
|
+
return resolve9(path5);
|
|
45160
43502
|
}
|
|
45161
43503
|
}
|
|
45162
43504
|
async function isCanonicalPathWithinBoundary2(targetPath, boundaryPath) {
|
|
@@ -45268,8 +43610,8 @@ async function _ensureFeatureFlagLocked(configTomlPath) {
|
|
|
45268
43610
|
return { status: hadManagedBlock ? "updated" : "written", configPath: configTomlPath };
|
|
45269
43611
|
}
|
|
45270
43612
|
function findFeaturesSectionStart(content) {
|
|
45271
|
-
const
|
|
45272
|
-
return
|
|
43613
|
+
const match = /^[ \t]*\[features\][ \t]*(?:#[^\r\n]*)?$/m.exec(content);
|
|
43614
|
+
return match ? match.index : -1;
|
|
45273
43615
|
}
|
|
45274
43616
|
function ensureFlagInFeaturesSection(content, headerStartIdx) {
|
|
45275
43617
|
const headerLineEnd = content.indexOf(`
|
|
@@ -46207,8 +44549,8 @@ async function computeCodexTargetStates(global3) {
|
|
|
46207
44549
|
const registry = await readPortableRegistry();
|
|
46208
44550
|
const relevant = registry.installations.filter((e2) => e2.provider === "codex" && e2.global === global3 && e2.type !== "skill");
|
|
46209
44551
|
return buildTargetStates(relevant, {
|
|
46210
|
-
onReadFailure: (
|
|
46211
|
-
logger.debug(`[init/codex] Target read failed: ${
|
|
44552
|
+
onReadFailure: (path5, error) => {
|
|
44553
|
+
logger.debug(`[init/codex] Target read failed: ${path5} (${String(error)})`);
|
|
46212
44554
|
}
|
|
46213
44555
|
});
|
|
46214
44556
|
}
|
|
@@ -46231,7 +44573,7 @@ var init_reconcile_helpers = __esm(() => {
|
|
|
46231
44573
|
import { existsSync as existsSync25 } from "node:fs";
|
|
46232
44574
|
import { readFile as readFile26, readdir as readdir18 } from "node:fs/promises";
|
|
46233
44575
|
import { homedir as homedir15 } from "node:os";
|
|
46234
|
-
import { extname as extname4, join as join58, relative as relative11, sep as
|
|
44576
|
+
import { extname as extname4, join as join58, relative as relative11, sep as sep5 } from "node:path";
|
|
46235
44577
|
function getConfigSourcePath() {
|
|
46236
44578
|
return findExistingProjectConfigPath(process.cwd()) ?? getGlobalConfigSourcePath();
|
|
46237
44579
|
}
|
|
@@ -46245,26 +44587,26 @@ function getHooksSourcePath() {
|
|
|
46245
44587
|
return findExistingProjectLayoutPath(process.cwd(), "hooks") ?? join58(homedir15(), ".claude", "hooks");
|
|
46246
44588
|
}
|
|
46247
44589
|
async function discoverConfig(sourcePath) {
|
|
46248
|
-
const
|
|
46249
|
-
if (!existsSync25(
|
|
44590
|
+
const path5 = sourcePath ?? getConfigSourcePath();
|
|
44591
|
+
if (!existsSync25(path5)) {
|
|
46250
44592
|
return null;
|
|
46251
44593
|
}
|
|
46252
|
-
const content = await readFile26(
|
|
44594
|
+
const content = await readFile26(path5, "utf-8");
|
|
46253
44595
|
return {
|
|
46254
44596
|
name: "CLAUDE",
|
|
46255
44597
|
description: "Project configuration",
|
|
46256
44598
|
type: "config",
|
|
46257
|
-
sourcePath:
|
|
44599
|
+
sourcePath: path5,
|
|
46258
44600
|
frontmatter: {},
|
|
46259
44601
|
body: content
|
|
46260
44602
|
};
|
|
46261
44603
|
}
|
|
46262
44604
|
async function discoverRules(sourcePath) {
|
|
46263
|
-
const
|
|
46264
|
-
if (!existsSync25(
|
|
44605
|
+
const path5 = sourcePath ?? getRulesSourcePath();
|
|
44606
|
+
if (!existsSync25(path5)) {
|
|
46265
44607
|
return [];
|
|
46266
44608
|
}
|
|
46267
|
-
return discoverPortableFiles(
|
|
44609
|
+
return discoverPortableFiles(path5, path5, {
|
|
46268
44610
|
type: "rules",
|
|
46269
44611
|
includeExtensions: new Set([".md"]),
|
|
46270
44612
|
stripExtension: true,
|
|
@@ -46272,13 +44614,13 @@ async function discoverRules(sourcePath) {
|
|
|
46272
44614
|
});
|
|
46273
44615
|
}
|
|
46274
44616
|
async function discoverHooks(sourcePath) {
|
|
46275
|
-
const
|
|
46276
|
-
if (!existsSync25(
|
|
44617
|
+
const path5 = sourcePath ?? getHooksSourcePath();
|
|
44618
|
+
if (!existsSync25(path5)) {
|
|
46277
44619
|
return { items: [], skippedShellHooks: [] };
|
|
46278
44620
|
}
|
|
46279
44621
|
let entries;
|
|
46280
44622
|
try {
|
|
46281
|
-
entries = await readdir18(
|
|
44623
|
+
entries = await readdir18(path5, { withFileTypes: true, encoding: "utf8" });
|
|
46282
44624
|
} catch {
|
|
46283
44625
|
return { items: [], skippedShellHooks: [] };
|
|
46284
44626
|
}
|
|
@@ -46287,14 +44629,14 @@ async function discoverHooks(sourcePath) {
|
|
|
46287
44629
|
for (const entry of entries) {
|
|
46288
44630
|
if (!entry.isFile() || entry.name.startsWith("."))
|
|
46289
44631
|
continue;
|
|
46290
|
-
const
|
|
46291
|
-
if (SHELL_HOOK_EXTENSIONS.has(
|
|
44632
|
+
const ext = extname4(entry.name).toLowerCase();
|
|
44633
|
+
if (SHELL_HOOK_EXTENSIONS.has(ext)) {
|
|
46292
44634
|
skippedShellHooks.push(entry.name);
|
|
46293
44635
|
continue;
|
|
46294
44636
|
}
|
|
46295
|
-
if (!HOOK_EXTENSIONS.has(
|
|
44637
|
+
if (!HOOK_EXTENSIONS.has(ext))
|
|
46296
44638
|
continue;
|
|
46297
|
-
const fullPath = join58(
|
|
44639
|
+
const fullPath = join58(path5, entry.name);
|
|
46298
44640
|
try {
|
|
46299
44641
|
const content = await readFile26(fullPath, "utf-8");
|
|
46300
44642
|
items.push({
|
|
@@ -46603,10 +44945,10 @@ import { existsSync as existsSync26 } from "node:fs";
|
|
|
46603
44945
|
import { mkdir as mkdir14, readFile as readFile28, writeFile as writeFile18 } from "node:fs/promises";
|
|
46604
44946
|
import { homedir as homedir18 } from "node:os";
|
|
46605
44947
|
import { join as join61 } from "node:path";
|
|
46606
|
-
function getNestedValue(obj,
|
|
44948
|
+
function getNestedValue(obj, path5) {
|
|
46607
44949
|
if (!obj || typeof obj !== "object")
|
|
46608
44950
|
return;
|
|
46609
|
-
const keys =
|
|
44951
|
+
const keys = path5.split(".");
|
|
46610
44952
|
let current = obj;
|
|
46611
44953
|
for (const key of keys) {
|
|
46612
44954
|
if (current === null || current === undefined)
|
|
@@ -46617,8 +44959,8 @@ function getNestedValue(obj, path6) {
|
|
|
46617
44959
|
}
|
|
46618
44960
|
return current;
|
|
46619
44961
|
}
|
|
46620
|
-
function setNestedValue(obj,
|
|
46621
|
-
const keys =
|
|
44962
|
+
function setNestedValue(obj, path5, value) {
|
|
44963
|
+
const keys = path5.split(".");
|
|
46622
44964
|
if (keys.some((k2) => DANGEROUS_KEYS.includes(k2))) {
|
|
46623
44965
|
throw new Error("Invalid field path: dangerous key detected");
|
|
46624
44966
|
}
|
|
@@ -46701,22 +45043,22 @@ class TakumiConfigManager {
|
|
|
46701
45043
|
}
|
|
46702
45044
|
static computeSources(mergedConfig, globalConfig, projectConfig, prefix = "") {
|
|
46703
45045
|
const sources = {};
|
|
46704
|
-
const processValue = (key, value,
|
|
45046
|
+
const processValue = (key, value, path5) => {
|
|
46705
45047
|
if (key === "$schema")
|
|
46706
45048
|
return;
|
|
46707
45049
|
if (value !== null && typeof value === "object" && !Array.isArray(value)) {
|
|
46708
45050
|
for (const [nestedKey, nestedVal] of Object.entries(value)) {
|
|
46709
|
-
processValue(nestedKey, nestedVal,
|
|
45051
|
+
processValue(nestedKey, nestedVal, path5 ? `${path5}.${nestedKey}` : nestedKey);
|
|
46710
45052
|
}
|
|
46711
45053
|
} else {
|
|
46712
|
-
const projectVal = projectConfig ? getNestedValue(projectConfig,
|
|
46713
|
-
const globalVal = globalConfig ? getNestedValue(globalConfig,
|
|
45054
|
+
const projectVal = projectConfig ? getNestedValue(projectConfig, path5) : undefined;
|
|
45055
|
+
const globalVal = globalConfig ? getNestedValue(globalConfig, path5) : undefined;
|
|
46714
45056
|
if (projectConfig && projectVal !== undefined && valuesEqual(value, projectVal)) {
|
|
46715
|
-
sources[
|
|
45057
|
+
sources[path5] = "project";
|
|
46716
45058
|
} else if (globalConfig && globalVal !== undefined && valuesEqual(value, globalVal)) {
|
|
46717
|
-
sources[
|
|
45059
|
+
sources[path5] = "global";
|
|
46718
45060
|
} else {
|
|
46719
|
-
sources[
|
|
45061
|
+
sources[path5] = "default";
|
|
46720
45062
|
}
|
|
46721
45063
|
}
|
|
46722
45064
|
};
|
|
@@ -46971,12 +45313,12 @@ function getCodexSkillsTargetDir(global3, projectRoot) {
|
|
|
46971
45313
|
if (!cfg) {
|
|
46972
45314
|
throw new Error("[codex] skills configuration missing from provider registry");
|
|
46973
45315
|
}
|
|
46974
|
-
const
|
|
46975
|
-
if (!
|
|
45316
|
+
const path5 = global3 ? cfg.globalPath : cfg.projectPath;
|
|
45317
|
+
if (!path5) {
|
|
46976
45318
|
throw new Error(`[codex] no ${global3 ? "global" : "project"}-level skills path configured`);
|
|
46977
45319
|
}
|
|
46978
45320
|
const projectBase = projectRoot ?? process.cwd();
|
|
46979
|
-
const resolved = global3 ? resolve14(
|
|
45321
|
+
const resolved = global3 ? resolve14(path5) : resolve14(projectBase, path5);
|
|
46980
45322
|
const boundary = global3 ? homedir19() : projectBase;
|
|
46981
45323
|
if (!isPathWithinBoundary3(resolved, boundary)) {
|
|
46982
45324
|
throw new Error(`[codex] resolved skills path "${resolved}" escapes boundary "${boundary}"`);
|
|
@@ -47045,17 +45387,17 @@ function resolveConfigSource(extractDir) {
|
|
|
47045
45387
|
return findExistingProjectConfigPath(extractDir);
|
|
47046
45388
|
}
|
|
47047
45389
|
function hasAnyCodexSource(sources) {
|
|
47048
|
-
return Object.values(sources).some((
|
|
45390
|
+
return Object.values(sources).some((path5) => path5 !== null);
|
|
47049
45391
|
}
|
|
47050
45392
|
var init_source_resolver = __esm(() => {
|
|
47051
45393
|
init_kit_layout();
|
|
47052
45394
|
});
|
|
47053
45395
|
|
|
47054
45396
|
// src/domains/installers/codex/manifest-helpers.ts
|
|
47055
|
-
import { join as join64, relative as relative13, sep as
|
|
45397
|
+
import { join as join64, relative as relative13, sep as sep6 } from "node:path";
|
|
47056
45398
|
async function collectCodexInstalledFiles(results, codexRoot) {
|
|
47057
45399
|
const out = [];
|
|
47058
|
-
const toPosix = (p) => p.split(
|
|
45400
|
+
const toPosix = (p) => p.split(sep6).join("/");
|
|
47059
45401
|
for (const r2 of results) {
|
|
47060
45402
|
if (!r2.success || r2.skipped || !r2.path)
|
|
47061
45403
|
continue;
|
|
@@ -47146,13 +45488,13 @@ async function wipeCodexTargets(global3, projectRoot) {
|
|
|
47146
45488
|
].filter((p) => Boolean(p));
|
|
47147
45489
|
const projectBase = projectRoot ?? process.cwd();
|
|
47148
45490
|
const targetPaths = rawPaths.map((p) => global3 ? p : join65(projectBase, p));
|
|
47149
|
-
for (const
|
|
47150
|
-
if (existsSync28(
|
|
45491
|
+
for (const path5 of targetPaths) {
|
|
45492
|
+
if (existsSync28(path5)) {
|
|
47151
45493
|
try {
|
|
47152
|
-
await rm5(
|
|
47153
|
-
logger.debug(`[init/codex] wiped ${
|
|
45494
|
+
await rm5(path5, { recursive: true, force: true });
|
|
45495
|
+
logger.debug(`[init/codex] wiped ${path5}`);
|
|
47154
45496
|
} catch (error) {
|
|
47155
|
-
logger.warning(`[init/codex] failed to wipe ${
|
|
45497
|
+
logger.warning(`[init/codex] failed to wipe ${path5}: ${String(error)}`);
|
|
47156
45498
|
}
|
|
47157
45499
|
}
|
|
47158
45500
|
}
|
|
@@ -47353,12 +45695,12 @@ var require_umd = __commonJS((exports, module) => {
|
|
|
47353
45695
|
if (typeof version3 !== "string") {
|
|
47354
45696
|
throw new TypeError("Invalid argument expected string");
|
|
47355
45697
|
}
|
|
47356
|
-
const
|
|
47357
|
-
if (!
|
|
45698
|
+
const match = version3.match(semver5);
|
|
45699
|
+
if (!match) {
|
|
47358
45700
|
throw new Error(`Invalid argument not valid semver ('${version3}' received)`);
|
|
47359
45701
|
}
|
|
47360
|
-
|
|
47361
|
-
return
|
|
45702
|
+
match.shift();
|
|
45703
|
+
return match;
|
|
47362
45704
|
};
|
|
47363
45705
|
const isWildcard = (s) => s === "*" || s === "x" || s === "X";
|
|
47364
45706
|
const tryParse = (v2) => {
|
|
@@ -47421,22 +45763,22 @@ var require_umd = __commonJS((exports, module) => {
|
|
|
47421
45763
|
throw new Error(`Invalid operator, expected one of ${allowedOperators.join("|")}`);
|
|
47422
45764
|
}
|
|
47423
45765
|
};
|
|
47424
|
-
const satisfies = (version3,
|
|
47425
|
-
|
|
47426
|
-
if (
|
|
47427
|
-
return
|
|
47428
|
-
} else if (
|
|
47429
|
-
const [a3, b3] =
|
|
45766
|
+
const satisfies = (version3, range) => {
|
|
45767
|
+
range = range.replace(/([><=]+)\s+/g, "$1");
|
|
45768
|
+
if (range.includes("||")) {
|
|
45769
|
+
return range.split("||").some((r5) => satisfies(version3, r5));
|
|
45770
|
+
} else if (range.includes(" - ")) {
|
|
45771
|
+
const [a3, b3] = range.split(" - ", 2);
|
|
47430
45772
|
return satisfies(version3, `>=${a3} <=${b3}`);
|
|
47431
|
-
} else if (
|
|
47432
|
-
return
|
|
45773
|
+
} else if (range.includes(" ")) {
|
|
45774
|
+
return range.trim().replace(/\s{2,}/g, " ").split(" ").every((r5) => satisfies(version3, r5));
|
|
47433
45775
|
}
|
|
47434
|
-
const m2 =
|
|
45776
|
+
const m2 = range.match(/^([<>=~^]+)/);
|
|
47435
45777
|
const op = m2 ? m2[1] : "=";
|
|
47436
45778
|
if (op !== "^" && op !== "~")
|
|
47437
|
-
return compare(version3,
|
|
45779
|
+
return compare(version3, range, op);
|
|
47438
45780
|
const [v1, v2, v3, , vp] = validateAndParse(version3);
|
|
47439
|
-
const [r1, r2, r3, , rp] = validateAndParse(
|
|
45781
|
+
const [r1, r2, r3, , rp] = validateAndParse(range);
|
|
47440
45782
|
const v4 = [v1, v2, v3];
|
|
47441
45783
|
const r4 = [r1, r2 !== null && r2 !== undefined ? r2 : "x", r3 !== null && r3 !== undefined ? r3 : "x"];
|
|
47442
45784
|
if (rp) {
|
|
@@ -48140,14 +46482,14 @@ class VersionFormatter {
|
|
|
48140
46482
|
}
|
|
48141
46483
|
static parseVersion(version3) {
|
|
48142
46484
|
const normalized = VersionFormatter.normalize(version3);
|
|
48143
|
-
const
|
|
48144
|
-
if (!
|
|
46485
|
+
const match = normalized.match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/);
|
|
46486
|
+
if (!match)
|
|
48145
46487
|
return null;
|
|
48146
46488
|
return {
|
|
48147
|
-
major: Number.parseInt(
|
|
48148
|
-
minor: Number.parseInt(
|
|
48149
|
-
patch: Number.parseInt(
|
|
48150
|
-
prerelease:
|
|
46489
|
+
major: Number.parseInt(match[1], 10),
|
|
46490
|
+
minor: Number.parseInt(match[2], 10),
|
|
46491
|
+
patch: Number.parseInt(match[3], 10),
|
|
46492
|
+
prerelease: match[4]
|
|
48151
46493
|
};
|
|
48152
46494
|
}
|
|
48153
46495
|
static isPrerelease(version3) {
|
|
@@ -49221,18 +47563,18 @@ async function readCachedConfig() {
|
|
|
49221
47563
|
}
|
|
49222
47564
|
}
|
|
49223
47565
|
async function writeCachedConfig(config) {
|
|
49224
|
-
const
|
|
47566
|
+
const path5 = getCachePath();
|
|
49225
47567
|
const dir = join69(getConfigDir(), "auth");
|
|
49226
47568
|
await fs.mkdir(dir, { recursive: true, mode: 448 });
|
|
49227
47569
|
const body = { ...config, cachedAt: Date.now() };
|
|
49228
|
-
const fh = await fs.open(
|
|
47570
|
+
const fh = await fs.open(path5, "w", 384);
|
|
49229
47571
|
try {
|
|
49230
47572
|
await fh.writeFile(JSON.stringify(body, null, 2), "utf8");
|
|
49231
47573
|
} finally {
|
|
49232
47574
|
await fh.close();
|
|
49233
47575
|
}
|
|
49234
47576
|
try {
|
|
49235
|
-
await fs.chmod(
|
|
47577
|
+
await fs.chmod(path5, 384);
|
|
49236
47578
|
} catch (err) {
|
|
49237
47579
|
logger.verbose(`config-cache: chmod 600 skipped (${err instanceof Error ? err.message : String(err)})`);
|
|
49238
47580
|
}
|
|
@@ -49256,12 +47598,12 @@ import { promises as fs2 } from "node:fs";
|
|
|
49256
47598
|
async function ensureParentDir() {
|
|
49257
47599
|
await fs2.mkdir(getAuthDir(), { recursive: true, mode: 448 });
|
|
49258
47600
|
}
|
|
49259
|
-
async function chmodSafe(
|
|
47601
|
+
async function chmodSafe(path5, mode) {
|
|
49260
47602
|
try {
|
|
49261
|
-
await fs2.chmod(
|
|
47603
|
+
await fs2.chmod(path5, mode);
|
|
49262
47604
|
} catch (err) {
|
|
49263
47605
|
const message = err instanceof Error ? err.message : String(err);
|
|
49264
|
-
logger.verbose(`token-store: chmod ${mode.toString(8)} on ${
|
|
47606
|
+
logger.verbose(`token-store: chmod ${mode.toString(8)} on ${path5} skipped (${message})`);
|
|
49265
47607
|
}
|
|
49266
47608
|
}
|
|
49267
47609
|
async function readToken() {
|
|
@@ -49278,8 +47620,8 @@ async function readToken() {
|
|
|
49278
47620
|
}
|
|
49279
47621
|
async function writeToken(session) {
|
|
49280
47622
|
await ensureParentDir();
|
|
49281
|
-
const
|
|
49282
|
-
const tmpPath = `${
|
|
47623
|
+
const path5 = getTokenPath();
|
|
47624
|
+
const tmpPath = `${path5}.tmp.${process.pid}.${++writeCounter}`;
|
|
49283
47625
|
const fh = await fs2.open(tmpPath, "w", 384);
|
|
49284
47626
|
try {
|
|
49285
47627
|
await fh.writeFile(JSON.stringify(session, null, 2), "utf8");
|
|
@@ -49288,7 +47630,7 @@ async function writeToken(session) {
|
|
|
49288
47630
|
}
|
|
49289
47631
|
await chmodSafe(tmpPath, 384);
|
|
49290
47632
|
try {
|
|
49291
|
-
await fs2.rename(tmpPath,
|
|
47633
|
+
await fs2.rename(tmpPath, path5);
|
|
49292
47634
|
} catch (err) {
|
|
49293
47635
|
await fs2.rm(tmpPath, { force: true }).catch(() => {
|
|
49294
47636
|
return;
|
|
@@ -49297,9 +47639,9 @@ async function writeToken(session) {
|
|
|
49297
47639
|
}
|
|
49298
47640
|
}
|
|
49299
47641
|
async function clearToken() {
|
|
49300
|
-
const
|
|
47642
|
+
const path5 = getTokenPath();
|
|
49301
47643
|
try {
|
|
49302
|
-
await fs2.rm(
|
|
47644
|
+
await fs2.rm(path5, { force: true });
|
|
49303
47645
|
} catch (err) {
|
|
49304
47646
|
if (err?.code === "ENOENT")
|
|
49305
47647
|
return;
|
|
@@ -49482,8 +47824,8 @@ async function defaultBrowserId() {
|
|
|
49482
47824
|
throw new Error("macOS only");
|
|
49483
47825
|
}
|
|
49484
47826
|
const { stdout } = await execFileAsync3("defaults", ["read", "com.apple.LaunchServices/com.apple.launchservices.secure", "LSHandlers"]);
|
|
49485
|
-
const
|
|
49486
|
-
const browserId =
|
|
47827
|
+
const match = /LSHandlerRoleAll = "(?!-)(?<id>[^"]+?)";\s+?LSHandlerURLScheme = (?:http|https);/.exec(stdout);
|
|
47828
|
+
const browserId = match?.groups.id ?? "com.apple.Safari";
|
|
49487
47829
|
if (browserId === "com.apple.safari") {
|
|
49488
47830
|
return "com.apple.Safari";
|
|
49489
47831
|
}
|
|
@@ -49534,11 +47876,11 @@ async function defaultBrowser(_execFileAsync = execFileAsync5) {
|
|
|
49534
47876
|
"/v",
|
|
49535
47877
|
"ProgId"
|
|
49536
47878
|
]);
|
|
49537
|
-
const
|
|
49538
|
-
if (!
|
|
47879
|
+
const match = /ProgId\s*REG_SZ\s*(?<id>\S+)/.exec(stdout);
|
|
47880
|
+
if (!match) {
|
|
49539
47881
|
throw new UnknownBrowserError(`Cannot find Windows browser in stdout: ${JSON.stringify(stdout)}`);
|
|
49540
47882
|
}
|
|
49541
|
-
const { id } =
|
|
47883
|
+
const { id } = match.groups;
|
|
49542
47884
|
const dotIndex = id.lastIndexOf(".");
|
|
49543
47885
|
const hyphenIndex = id.lastIndexOf("-");
|
|
49544
47886
|
const baseIdByDot = dotIndex === -1 ? undefined : id.slice(0, dotIndex);
|
|
@@ -49609,7 +47951,7 @@ __export(exports_open, {
|
|
|
49609
47951
|
});
|
|
49610
47952
|
import process15 from "node:process";
|
|
49611
47953
|
import { Buffer as Buffer2 } from "node:buffer";
|
|
49612
|
-
import
|
|
47954
|
+
import path5 from "node:path";
|
|
49613
47955
|
import { fileURLToPath } from "node:url";
|
|
49614
47956
|
import { promisify as promisify7 } from "node:util";
|
|
49615
47957
|
import childProcess from "node:child_process";
|
|
@@ -49834,8 +48176,8 @@ var init_open = __esm(() => {
|
|
|
49834
48176
|
init_default_browser();
|
|
49835
48177
|
init_is_inside_container();
|
|
49836
48178
|
execFile7 = promisify7(childProcess.execFile);
|
|
49837
|
-
__dirname2 =
|
|
49838
|
-
localXdgOpenPath =
|
|
48179
|
+
__dirname2 = path5.dirname(fileURLToPath(import.meta.url));
|
|
48180
|
+
localXdgOpenPath = path5.join(__dirname2, "xdg-open");
|
|
49839
48181
|
({ platform: platform3, arch } = process15);
|
|
49840
48182
|
apps = {};
|
|
49841
48183
|
defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
|
|
@@ -50608,8 +48950,8 @@ var require_parse4 = __commonJS((exports, module) => {
|
|
|
50608
48950
|
env2 = {};
|
|
50609
48951
|
}
|
|
50610
48952
|
var commented = false;
|
|
50611
|
-
return matches3.map(function(
|
|
50612
|
-
var s =
|
|
48953
|
+
return matches3.map(function(match) {
|
|
48954
|
+
var s = match[0];
|
|
50613
48955
|
if (!s || commented) {
|
|
50614
48956
|
return;
|
|
50615
48957
|
}
|
|
@@ -50685,7 +49027,7 @@ var require_parse4 = __commonJS((exports, module) => {
|
|
|
50685
49027
|
return { op: s };
|
|
50686
49028
|
} else if (hash.test(c2)) {
|
|
50687
49029
|
commented = true;
|
|
50688
|
-
var commentObj = { comment: string.slice(
|
|
49030
|
+
var commentObj = { comment: string.slice(match.index + i2 + 1) };
|
|
50689
49031
|
if (out.length) {
|
|
50690
49032
|
return [out, commentObj];
|
|
50691
49033
|
}
|
|
@@ -53599,12 +51941,12 @@ function samePath(a3, b3) {
|
|
|
53599
51941
|
return CASE_INSENSITIVE_FS ? a3.toLowerCase() === b3.toLowerCase() : a3 === b3;
|
|
53600
51942
|
}
|
|
53601
51943
|
async function readManifest2() {
|
|
53602
|
-
const
|
|
51944
|
+
const path6 = getManifestPath2();
|
|
53603
51945
|
try {
|
|
53604
|
-
const raw = await fs9.readFile(
|
|
51946
|
+
const raw = await fs9.readFile(path6, "utf8");
|
|
53605
51947
|
const parsed = JSON.parse(raw);
|
|
53606
51948
|
if (!parsed || typeof parsed !== "object" || !Array.isArray(parsed.entries)) {
|
|
53607
|
-
logger.warning(`artifact-manifest: malformed manifest at ${
|
|
51949
|
+
logger.warning(`artifact-manifest: malformed manifest at ${path6}, using empty manifest`);
|
|
53608
51950
|
return { entries: [] };
|
|
53609
51951
|
}
|
|
53610
51952
|
return parsed;
|
|
@@ -53612,13 +51954,13 @@ async function readManifest2() {
|
|
|
53612
51954
|
if (err?.code === "ENOENT")
|
|
53613
51955
|
return { entries: [] };
|
|
53614
51956
|
const message = err instanceof Error ? err.message : String(err);
|
|
53615
|
-
logger.warning(`artifact-manifest: failed to read ${
|
|
51957
|
+
logger.warning(`artifact-manifest: failed to read ${path6}: ${message}. Using empty manifest.`);
|
|
53616
51958
|
return { entries: [] };
|
|
53617
51959
|
}
|
|
53618
51960
|
}
|
|
53619
51961
|
async function writeManifest2(manifest) {
|
|
53620
|
-
const
|
|
53621
|
-
const tmpPath = `${
|
|
51962
|
+
const path6 = getManifestPath2();
|
|
51963
|
+
const tmpPath = `${path6}.tmp`;
|
|
53622
51964
|
await fs9.mkdir(getConfigDir(), { recursive: true, mode: 448 });
|
|
53623
51965
|
const fh = await fs9.open(tmpPath, "w", 384);
|
|
53624
51966
|
try {
|
|
@@ -53629,7 +51971,7 @@ async function writeManifest2(manifest) {
|
|
|
53629
51971
|
try {
|
|
53630
51972
|
await fs9.chmod(tmpPath, 384);
|
|
53631
51973
|
} catch {}
|
|
53632
|
-
await fs9.rename(tmpPath,
|
|
51974
|
+
await fs9.rename(tmpPath, path6);
|
|
53633
51975
|
}
|
|
53634
51976
|
function lookupByPath(manifest, absPath) {
|
|
53635
51977
|
return manifest.entries.find((e2) => samePath(e2.localPath, absPath));
|
|
@@ -53825,8 +52167,8 @@ class DisallowedExtensionError extends Error {
|
|
|
53825
52167
|
}
|
|
53826
52168
|
function mimeForPath(relPath) {
|
|
53827
52169
|
const dot = relPath.lastIndexOf(".");
|
|
53828
|
-
const
|
|
53829
|
-
return EXT_TO_MIME[
|
|
52170
|
+
const ext = dot >= 0 ? relPath.slice(dot + 1).toLowerCase() : "";
|
|
52171
|
+
return EXT_TO_MIME[ext] ?? "application/octet-stream";
|
|
53830
52172
|
}
|
|
53831
52173
|
function extOf(relPath) {
|
|
53832
52174
|
const dot = relPath.lastIndexOf(".");
|
|
@@ -54105,9 +52447,9 @@ async function artifactUpload(filePath, opts) {
|
|
|
54105
52447
|
}
|
|
54106
52448
|
}
|
|
54107
52449
|
async function uploadFile(absPath, displayPath, size, token, opts) {
|
|
54108
|
-
const
|
|
54109
|
-
if (!ALLOWED_EXTENSIONS.has(
|
|
54110
|
-
console.error(`Error: unsupported file type ".${
|
|
52450
|
+
const ext = extname5(absPath).toLowerCase().slice(1);
|
|
52451
|
+
if (!ALLOWED_EXTENSIONS.has(ext)) {
|
|
52452
|
+
console.error(`Error: unsupported file type ".${ext}". Allowed: ${[...ALLOWED_EXTENSIONS].map((e2) => `.${e2}`).join(", ")}`);
|
|
54111
52453
|
process.exitCode = 1;
|
|
54112
52454
|
return;
|
|
54113
52455
|
}
|
|
@@ -54766,8 +53108,8 @@ async function handleGet(key, options2) {
|
|
|
54766
53108
|
console.log(value);
|
|
54767
53109
|
}
|
|
54768
53110
|
}
|
|
54769
|
-
function getNestedValue2(obj,
|
|
54770
|
-
return
|
|
53111
|
+
function getNestedValue2(obj, path6) {
|
|
53112
|
+
return path6.split(".").reduce((acc, key) => {
|
|
54771
53113
|
if (acc && typeof acc === "object" && key in acc) {
|
|
54772
53114
|
return acc[key];
|
|
54773
53115
|
}
|
|
@@ -55055,7 +53397,7 @@ function foldAnalytics(aggregates, now) {
|
|
|
55055
53397
|
// src/domains/sessions/adapters/claude.ts
|
|
55056
53398
|
import * as fs15 from "node:fs";
|
|
55057
53399
|
import * as os4 from "node:os";
|
|
55058
|
-
import * as
|
|
53400
|
+
import * as path6 from "node:path";
|
|
55059
53401
|
|
|
55060
53402
|
// src/domains/sessions/transcript-parser.ts
|
|
55061
53403
|
import * as fs14 from "node:fs";
|
|
@@ -55216,7 +53558,7 @@ function sumCodexAgentTokens(jsonlPath) {
|
|
|
55216
53558
|
}
|
|
55217
53559
|
|
|
55218
53560
|
// src/domains/sessions/adapters/claude.ts
|
|
55219
|
-
var CLAUDE_ROOT =
|
|
53561
|
+
var CLAUDE_ROOT = path6.join(os4.homedir(), ".claude", "projects");
|
|
55220
53562
|
var MAX_PARSE_BYTES = 50 * 1024 * 1024;
|
|
55221
53563
|
var HARNESS_TAGS = [
|
|
55222
53564
|
"command-name",
|
|
@@ -55367,7 +53709,7 @@ async function listSessions(rootDir) {
|
|
|
55367
53709
|
return out;
|
|
55368
53710
|
}
|
|
55369
53711
|
for (const proj of projects) {
|
|
55370
|
-
const projDir =
|
|
53712
|
+
const projDir = path6.join(root, proj);
|
|
55371
53713
|
let entries;
|
|
55372
53714
|
try {
|
|
55373
53715
|
entries = fs15.readdirSync(projDir);
|
|
@@ -55377,7 +53719,7 @@ async function listSessions(rootDir) {
|
|
|
55377
53719
|
for (const entry of entries) {
|
|
55378
53720
|
if (!entry.endsWith(".jsonl"))
|
|
55379
53721
|
continue;
|
|
55380
|
-
const full =
|
|
53722
|
+
const full = path6.join(projDir, entry);
|
|
55381
53723
|
let st;
|
|
55382
53724
|
try {
|
|
55383
53725
|
st = fs15.statSync(full);
|
|
@@ -55401,7 +53743,7 @@ async function listSessions(rootDir) {
|
|
|
55401
53743
|
return out;
|
|
55402
53744
|
}
|
|
55403
53745
|
function loadSubagentIndex(parentTranscriptPath, sessionId) {
|
|
55404
|
-
const subDir =
|
|
53746
|
+
const subDir = path6.join(path6.dirname(parentTranscriptPath), sessionId, "subagents");
|
|
55405
53747
|
const byToolUseId = new Map;
|
|
55406
53748
|
const byAgentId = new Map;
|
|
55407
53749
|
let names;
|
|
@@ -55416,9 +53758,9 @@ function loadSubagentIndex(parentTranscriptPath, sessionId) {
|
|
|
55416
53758
|
const agentId = name.replace(/^agent-/, "").replace(/\.meta\.json$/, "");
|
|
55417
53759
|
let meta = {};
|
|
55418
53760
|
try {
|
|
55419
|
-
meta = JSON.parse(fs15.readFileSync(
|
|
53761
|
+
meta = JSON.parse(fs15.readFileSync(path6.join(subDir, name), "utf-8"));
|
|
55420
53762
|
} catch {}
|
|
55421
|
-
const jsonlPath =
|
|
53763
|
+
const jsonlPath = path6.join(subDir, `agent-${agentId}.jsonl`);
|
|
55422
53764
|
const { tokens, model } = sumClaudeAgentTokens(jsonlPath);
|
|
55423
53765
|
const entry = {
|
|
55424
53766
|
agentId,
|
|
@@ -55481,9 +53823,9 @@ function handleTaskUse(state, rec, toolUse, subIdx) {
|
|
|
55481
53823
|
return;
|
|
55482
53824
|
const inp = toolUse.input || {};
|
|
55483
53825
|
const toolUseId = toolUse.id;
|
|
55484
|
-
const
|
|
53826
|
+
const match = toolUseId ? subIdx.byToolUseId.get(toolUseId) : null;
|
|
55485
53827
|
const now = rec.timestamp || new Date().toISOString();
|
|
55486
|
-
if (!
|
|
53828
|
+
if (!match) {
|
|
55487
53829
|
const aid = (toolUseId || `unknown-${turn.agentIds.length}`).replace(/^toolu_/, "");
|
|
55488
53830
|
const agent2 = {
|
|
55489
53831
|
id: aid,
|
|
@@ -55500,24 +53842,24 @@ function handleTaskUse(state, rec, toolUse, subIdx) {
|
|
|
55500
53842
|
turn.agentIds.push(aid);
|
|
55501
53843
|
return;
|
|
55502
53844
|
}
|
|
55503
|
-
const agentId =
|
|
53845
|
+
const agentId = match.agentId;
|
|
55504
53846
|
const agent = {
|
|
55505
53847
|
id: agentId,
|
|
55506
|
-
type:
|
|
55507
|
-
description: inp.description ||
|
|
53848
|
+
type: match.type || inp.subagent_type || "unknown",
|
|
53849
|
+
description: inp.description || match.description || "",
|
|
55508
53850
|
promptPreview: String(inp.prompt || "").slice(0, 120),
|
|
55509
53851
|
turnId: turn.id,
|
|
55510
|
-
startedAt:
|
|
55511
|
-
endedAt:
|
|
53852
|
+
startedAt: match.startedAt || now,
|
|
53853
|
+
endedAt: match.endedAt || now,
|
|
55512
53854
|
status: "done",
|
|
55513
|
-
tokens:
|
|
55514
|
-
model:
|
|
53855
|
+
tokens: match.tokens || emptyTokens(),
|
|
53856
|
+
model: match.model || null
|
|
55515
53857
|
};
|
|
55516
53858
|
state.agents[agentId] = agent;
|
|
55517
53859
|
turn.agentIds.push(agentId);
|
|
55518
|
-
if (
|
|
53860
|
+
if (match.jsonlPath) {
|
|
55519
53861
|
try {
|
|
55520
|
-
state.agentOffsets[agentId] = fs15.statSync(
|
|
53862
|
+
state.agentOffsets[agentId] = fs15.statSync(match.jsonlPath).size;
|
|
55521
53863
|
} catch {
|
|
55522
53864
|
state.agentOffsets[agentId] = 0;
|
|
55523
53865
|
}
|
|
@@ -55576,13 +53918,13 @@ function lastNonStartupTurn(state) {
|
|
|
55576
53918
|
return null;
|
|
55577
53919
|
}
|
|
55578
53920
|
async function parse2(filePath) {
|
|
55579
|
-
const sessionId =
|
|
53921
|
+
const sessionId = path6.basename(filePath, ".jsonl");
|
|
55580
53922
|
try {
|
|
55581
53923
|
const st = fs15.statSync(filePath);
|
|
55582
53924
|
if (st.size > MAX_PARSE_BYTES) {
|
|
55583
53925
|
const mb = (st.size / (1024 * 1024)).toFixed(0);
|
|
55584
53926
|
const cap = MAX_PARSE_BYTES / (1024 * 1024);
|
|
55585
|
-
throw Object.assign(new Error(`Claude transcript ${
|
|
53927
|
+
throw Object.assign(new Error(`Claude transcript ${path6.basename(filePath)} is ${mb}MB (> ${cap}MB cap).`), { code: "TRANSCRIPT_TOO_LARGE" });
|
|
55586
53928
|
}
|
|
55587
53929
|
} catch (e2) {
|
|
55588
53930
|
if (e2.code === "TRANSCRIPT_TOO_LARGE")
|
|
@@ -55762,8 +54104,8 @@ async function parse2(filePath) {
|
|
|
55762
54104
|
function matches(filePath) {
|
|
55763
54105
|
if (!filePath)
|
|
55764
54106
|
return false;
|
|
55765
|
-
const norm =
|
|
55766
|
-
return norm.includes(`${
|
|
54107
|
+
const norm = path6.resolve(filePath);
|
|
54108
|
+
return norm.includes(`${path6.sep}.claude${path6.sep}projects${path6.sep}`) && norm.endsWith(".jsonl");
|
|
55767
54109
|
}
|
|
55768
54110
|
var claudeAdapter = {
|
|
55769
54111
|
name: "claude",
|
|
@@ -55775,15 +54117,15 @@ var claudeAdapter = {
|
|
|
55775
54117
|
// src/domains/sessions/adapters/codex.ts
|
|
55776
54118
|
import * as fs16 from "node:fs";
|
|
55777
54119
|
import * as os5 from "node:os";
|
|
55778
|
-
import * as
|
|
55779
|
-
var CODEX_ROOT =
|
|
54120
|
+
import * as path7 from "node:path";
|
|
54121
|
+
var CODEX_ROOT = path7.join(os5.homedir(), ".codex", "sessions");
|
|
55780
54122
|
function normalizeName(n) {
|
|
55781
54123
|
return String(n || "").toLowerCase().replace(/[^a-z0-9]/g, "");
|
|
55782
54124
|
}
|
|
55783
54125
|
function skillDirs(cwd2) {
|
|
55784
|
-
const dirs = [
|
|
54126
|
+
const dirs = [path7.join(os5.homedir(), ".codex", "skills")];
|
|
55785
54127
|
if (cwd2)
|
|
55786
|
-
dirs.push(
|
|
54128
|
+
dirs.push(path7.join(cwd2, ".codex", "skills"));
|
|
55787
54129
|
return dirs;
|
|
55788
54130
|
}
|
|
55789
54131
|
function loadSkillCatalog(cwd2) {
|
|
@@ -55799,7 +54141,7 @@ function loadSkillCatalog(cwd2) {
|
|
|
55799
54141
|
for (const name of names) {
|
|
55800
54142
|
if (name.startsWith("."))
|
|
55801
54143
|
continue;
|
|
55802
|
-
const entryPath =
|
|
54144
|
+
const entryPath = path7.join(dir, name);
|
|
55803
54145
|
let st;
|
|
55804
54146
|
try {
|
|
55805
54147
|
st = fs16.statSync(entryPath);
|
|
@@ -55808,7 +54150,7 @@ function loadSkillCatalog(cwd2) {
|
|
|
55808
54150
|
}
|
|
55809
54151
|
if (!st.isDirectory())
|
|
55810
54152
|
continue;
|
|
55811
|
-
if (!fs16.existsSync(
|
|
54153
|
+
if (!fs16.existsSync(path7.join(entryPath, "SKILL.md")))
|
|
55812
54154
|
continue;
|
|
55813
54155
|
const key = normalizeName(name);
|
|
55814
54156
|
if (!key || seen.has(key))
|
|
@@ -55857,7 +54199,7 @@ function safeJSON2(line) {
|
|
|
55857
54199
|
}
|
|
55858
54200
|
}
|
|
55859
54201
|
function extractUuidFromName(filePath) {
|
|
55860
|
-
const base =
|
|
54202
|
+
const base = path7.basename(filePath, ".jsonl");
|
|
55861
54203
|
const m2 = base.match(/([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$/);
|
|
55862
54204
|
return m2?.[1] ?? null;
|
|
55863
54205
|
}
|
|
@@ -55869,7 +54211,7 @@ function walkRolloutFiles(dir, depth, maxDepth, out) {
|
|
|
55869
54211
|
return;
|
|
55870
54212
|
}
|
|
55871
54213
|
for (const e2 of entries) {
|
|
55872
|
-
const full =
|
|
54214
|
+
const full = path7.join(dir, e2.name);
|
|
55873
54215
|
if (e2.isDirectory()) {
|
|
55874
54216
|
if (depth < maxDepth)
|
|
55875
54217
|
walkRolloutFiles(full, depth + 1, maxDepth, out);
|
|
@@ -55993,7 +54335,7 @@ async function listSessions2(rootDir) {
|
|
|
55993
54335
|
const summary = readFirstUserPrompt(full);
|
|
55994
54336
|
const idFromName = extractUuidFromName(full);
|
|
55995
54337
|
out.push({
|
|
55996
|
-
id: idFromName || meta.session_id ||
|
|
54338
|
+
id: idFromName || meta.session_id || path7.basename(full, ".jsonl"),
|
|
55997
54339
|
adapterName: "codex",
|
|
55998
54340
|
path: full,
|
|
55999
54341
|
startedAt: meta.timestamp || new Date(st.mtimeMs).toISOString(),
|
|
@@ -56086,7 +54428,7 @@ async function parse3(filePath) {
|
|
|
56086
54428
|
const recs = records;
|
|
56087
54429
|
const sessionMetaRec = recs.find((r2) => r2?.type === "session_meta");
|
|
56088
54430
|
const sessionMeta = sessionMetaRec?.payload || {};
|
|
56089
|
-
const sessionId = extractUuidFromName(filePath) || sessionMeta.session_id ||
|
|
54431
|
+
const sessionId = extractUuidFromName(filePath) || sessionMeta.session_id || path7.basename(filePath, ".jsonl");
|
|
56090
54432
|
const firstTs = sessionMeta.timestamp || recs.find((r2) => r2?.timestamp)?.timestamp || new Date().toISOString();
|
|
56091
54433
|
const skillCatalog = loadSkillCatalog(sessionMeta.cwd || null);
|
|
56092
54434
|
const state = {
|
|
@@ -56257,8 +54599,8 @@ async function parse3(filePath) {
|
|
|
56257
54599
|
function matches2(filePath) {
|
|
56258
54600
|
if (!filePath)
|
|
56259
54601
|
return false;
|
|
56260
|
-
const norm =
|
|
56261
|
-
return norm.includes(`${
|
|
54602
|
+
const norm = path7.resolve(filePath);
|
|
54603
|
+
return norm.includes(`${path7.sep}.codex${path7.sep}sessions${path7.sep}`) && /rollout-.*\.jsonl$/.test(norm);
|
|
56262
54604
|
}
|
|
56263
54605
|
var codexAdapter = {
|
|
56264
54606
|
name: "codex",
|
|
@@ -56548,11 +54890,15 @@ async function route(req, res, version3) {
|
|
|
56548
54890
|
const pathname = url.pathname;
|
|
56549
54891
|
applyCorsHeaders(req, res);
|
|
56550
54892
|
if (req.method === "OPTIONS") {
|
|
56551
|
-
|
|
54893
|
+
const headers = {
|
|
56552
54894
|
"Access-Control-Allow-Methods": "GET, OPTIONS",
|
|
56553
54895
|
"Access-Control-Allow-Headers": "content-type",
|
|
56554
54896
|
"Access-Control-Max-Age": "600"
|
|
56555
|
-
}
|
|
54897
|
+
};
|
|
54898
|
+
if (req.headers["access-control-request-private-network"] === "true") {
|
|
54899
|
+
headers["Access-Control-Allow-Private-Network"] = "true";
|
|
54900
|
+
}
|
|
54901
|
+
res.writeHead(204, headers);
|
|
56556
54902
|
res.end();
|
|
56557
54903
|
return;
|
|
56558
54904
|
}
|
|
@@ -57039,10 +55385,10 @@ async function getCommandPath(command) {
|
|
|
57039
55385
|
const whichCmd = process.platform === "win32" ? "where" : "which";
|
|
57040
55386
|
logger.verbose(`Getting path for command: ${command}`);
|
|
57041
55387
|
const { stdout } = await execAsync2(`${whichCmd} ${command}`);
|
|
57042
|
-
const
|
|
55388
|
+
const path8 = stdout.trim().split(`
|
|
57043
55389
|
`)[0] || null;
|
|
57044
|
-
logger.verbose(`Command path resolved: ${command} -> ${
|
|
57045
|
-
return
|
|
55390
|
+
logger.verbose(`Command path resolved: ${command} -> ${path8}`);
|
|
55391
|
+
return path8;
|
|
57046
55392
|
} catch {
|
|
57047
55393
|
logger.verbose(`Failed to get path for command: ${command}`);
|
|
57048
55394
|
return null;
|
|
@@ -57068,8 +55414,8 @@ async function getCommandVersion(command, versionFlag, versionRegex) {
|
|
|
57068
55414
|
logger.verbose(`Getting version for: ${command} ${versionFlag}`);
|
|
57069
55415
|
const { stdout, stderr } = await execAsync2(`${command} ${versionFlag}`);
|
|
57070
55416
|
const output2 = stdout || stderr;
|
|
57071
|
-
const
|
|
57072
|
-
const version3 =
|
|
55417
|
+
const match = output2.match(versionRegex);
|
|
55418
|
+
const version3 = match?.[1] || null;
|
|
57073
55419
|
logger.verbose(`Version detected: ${command} -> ${version3}`);
|
|
57074
55420
|
return version3;
|
|
57075
55421
|
} catch (error) {
|
|
@@ -57097,7 +55443,7 @@ async function checkDependency(config) {
|
|
|
57097
55443
|
const exists = await commandExists(command);
|
|
57098
55444
|
if (exists) {
|
|
57099
55445
|
logger.verbose(`Found ${config.name} via command: ${command}`);
|
|
57100
|
-
const
|
|
55446
|
+
const path8 = await getCommandPath(command);
|
|
57101
55447
|
const version3 = await getCommandVersion(command, config.versionFlag, config.versionRegex);
|
|
57102
55448
|
let meetsRequirements = true;
|
|
57103
55449
|
let message;
|
|
@@ -57111,7 +55457,7 @@ async function checkDependency(config) {
|
|
|
57111
55457
|
name: config.name,
|
|
57112
55458
|
installed: true,
|
|
57113
55459
|
version: version3 || undefined,
|
|
57114
|
-
path:
|
|
55460
|
+
path: path8 || undefined,
|
|
57115
55461
|
minVersion: config.minVersion,
|
|
57116
55462
|
meetsRequirements,
|
|
57117
55463
|
message
|
|
@@ -57471,13 +55817,13 @@ class SystemChecker {
|
|
|
57471
55817
|
async checkGit() {
|
|
57472
55818
|
try {
|
|
57473
55819
|
const { stdout } = await execAsync5("git --version");
|
|
57474
|
-
const
|
|
55820
|
+
const match = stdout.match(/(\d+\.\d+\.\d+)/);
|
|
57475
55821
|
return {
|
|
57476
55822
|
id: "git-version",
|
|
57477
55823
|
name: "Git",
|
|
57478
55824
|
group: "system",
|
|
57479
55825
|
status: "pass",
|
|
57480
|
-
message:
|
|
55826
|
+
message: match ? `v${match[1]}` : "Installed",
|
|
57481
55827
|
autoFixable: false
|
|
57482
55828
|
};
|
|
57483
55829
|
} catch {
|
|
@@ -57495,8 +55841,8 @@ class SystemChecker {
|
|
|
57495
55841
|
async checkGitHubCli() {
|
|
57496
55842
|
try {
|
|
57497
55843
|
const { stdout } = await execAsync5("gh --version");
|
|
57498
|
-
const
|
|
57499
|
-
const version3 =
|
|
55844
|
+
const match = stdout.match(/(\d+\.\d+\.\d+)/);
|
|
55845
|
+
const version3 = match?.[1];
|
|
57500
55846
|
if (version3 && compareVersions4(version3, MIN_GH_CLI_VERSION) < 0) {
|
|
57501
55847
|
return {
|
|
57502
55848
|
id: "gh-cli-version",
|
|
@@ -58285,8 +56631,8 @@ function checkClaudeMd(setup, projectDir) {
|
|
|
58285
56631
|
results.push(checkClaudeMdFile(projectClaudeMd, "Project CLAUDE.md", "sk-project-claude-md"));
|
|
58286
56632
|
return results;
|
|
58287
56633
|
}
|
|
58288
|
-
function checkClaudeMdFile(
|
|
58289
|
-
if (!existsSync36(
|
|
56634
|
+
function checkClaudeMdFile(path8, name, id) {
|
|
56635
|
+
if (!existsSync36(path8)) {
|
|
58290
56636
|
return {
|
|
58291
56637
|
id,
|
|
58292
56638
|
name,
|
|
@@ -58299,7 +56645,7 @@ function checkClaudeMdFile(path9, name, id) {
|
|
|
58299
56645
|
};
|
|
58300
56646
|
}
|
|
58301
56647
|
try {
|
|
58302
|
-
const stat8 = statSync5(
|
|
56648
|
+
const stat8 = statSync5(path8);
|
|
58303
56649
|
const sizeKB = (stat8.size / 1024).toFixed(1);
|
|
58304
56650
|
if (stat8.size === 0) {
|
|
58305
56651
|
return {
|
|
@@ -58309,7 +56655,7 @@ function checkClaudeMdFile(path9, name, id) {
|
|
|
58309
56655
|
priority: "standard",
|
|
58310
56656
|
status: "warn",
|
|
58311
56657
|
message: "Empty (0 bytes)",
|
|
58312
|
-
details:
|
|
56658
|
+
details: path8,
|
|
58313
56659
|
suggestion: "Add project instructions to CLAUDE.md",
|
|
58314
56660
|
autoFixable: false
|
|
58315
56661
|
};
|
|
@@ -58321,7 +56667,7 @@ function checkClaudeMdFile(path9, name, id) {
|
|
|
58321
56667
|
priority: "standard",
|
|
58322
56668
|
status: "pass",
|
|
58323
56669
|
message: `Found (${sizeKB}KB)`,
|
|
58324
|
-
details:
|
|
56670
|
+
details: path8,
|
|
58325
56671
|
autoFixable: false
|
|
58326
56672
|
};
|
|
58327
56673
|
} catch {
|
|
@@ -58332,7 +56678,7 @@ function checkClaudeMdFile(path9, name, id) {
|
|
|
58332
56678
|
priority: "standard",
|
|
58333
56679
|
status: "warn",
|
|
58334
56680
|
message: "Unreadable",
|
|
58335
|
-
details:
|
|
56681
|
+
details: path8,
|
|
58336
56682
|
suggestion: "Check file permissions",
|
|
58337
56683
|
autoFixable: false
|
|
58338
56684
|
};
|
|
@@ -58554,7 +56900,7 @@ async function checkHooksExist(projectDir) {
|
|
|
58554
56900
|
const checkedFiles = new Set;
|
|
58555
56901
|
if (globalExists) {
|
|
58556
56902
|
const files = await readdir23(globalHooksDir, { withFileTypes: false });
|
|
58557
|
-
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((
|
|
56903
|
+
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
58558
56904
|
hooks.forEach((hook) => {
|
|
58559
56905
|
const fullPath = join82(globalHooksDir, hook);
|
|
58560
56906
|
checkedFiles.add(normalizePath(fullPath));
|
|
@@ -58564,7 +56910,7 @@ async function checkHooksExist(projectDir) {
|
|
|
58564
56910
|
const normalizedProject = normalizePath(projectHooksDir);
|
|
58565
56911
|
if (projectExists && normalizedProject !== normalizedGlobal) {
|
|
58566
56912
|
const files = await readdir23(projectHooksDir, { withFileTypes: false });
|
|
58567
|
-
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((
|
|
56913
|
+
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
58568
56914
|
hooks.forEach((hook) => {
|
|
58569
56915
|
const fullPath = join82(projectHooksDir, hook);
|
|
58570
56916
|
checkedFiles.add(normalizePath(fullPath));
|
|
@@ -58983,14 +57329,14 @@ init_logger();
|
|
|
58983
57329
|
import { execSync as execSync3 } from "node:child_process";
|
|
58984
57330
|
import * as fs18 from "node:fs";
|
|
58985
57331
|
import * as os6 from "node:os";
|
|
58986
|
-
import * as
|
|
57332
|
+
import * as path8 from "node:path";
|
|
58987
57333
|
var VALID_TAG_PATTERN = /^[a-zA-Z0-9._+\-]+$/;
|
|
58988
57334
|
|
|
58989
57335
|
class GitCloneManager {
|
|
58990
57336
|
tempBaseDir;
|
|
58991
57337
|
constructor() {
|
|
58992
57338
|
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
58993
|
-
this.tempBaseDir = process.env.TMPDIR || process.env.TEMP || process.env.TMP || (homeDir ?
|
|
57339
|
+
this.tempBaseDir = process.env.TMPDIR || process.env.TEMP || process.env.TMP || (homeDir ? path8.join(homeDir, ".sunagentkit", "tmp") : null) || path8.join(os6.tmpdir(), ".sunagentkit", "tmp");
|
|
58994
57340
|
}
|
|
58995
57341
|
validateTag(tag) {
|
|
58996
57342
|
if (!VALID_TAG_PATTERN.test(tag)) {
|
|
@@ -59011,7 +57357,7 @@ Error: ${msg}
|
|
|
59011
57357
|
|
|
59012
57358
|
Check disk space and directory permissions.`);
|
|
59013
57359
|
}
|
|
59014
|
-
const tempDir = await fs18.promises.mkdtemp(
|
|
57360
|
+
const tempDir = await fs18.promises.mkdtemp(path8.join(this.tempBaseDir, `sk-git-${kit.repo}-`));
|
|
59015
57361
|
const url = preferSsh ? `git@github.com:${kit.owner}/${kit.repo}.git` : `https://github.com/${kit.owner}/${kit.repo}.git`;
|
|
59016
57362
|
const method = preferSsh ? "ssh" : "https";
|
|
59017
57363
|
logger.verbose("Git clone", { url, tag, tempDir, method });
|
|
@@ -59044,7 +57390,7 @@ Check disk space and directory permissions.`);
|
|
|
59044
57390
|
throw shallowError;
|
|
59045
57391
|
}
|
|
59046
57392
|
}
|
|
59047
|
-
const gitDir =
|
|
57393
|
+
const gitDir = path8.join(tempDir, ".git");
|
|
59048
57394
|
await fs18.promises.rm(gitDir, { recursive: true, force: true });
|
|
59049
57395
|
logger.debug(`Git clone successful: ${tempDir}`);
|
|
59050
57396
|
return {
|
|
@@ -59093,13 +57439,13 @@ Ensure you have access to the repository and your git credentials are configured
|
|
|
59093
57439
|
const homeDir = process.env.HOME || process.env.USERPROFILE;
|
|
59094
57440
|
if (!homeDir)
|
|
59095
57441
|
return false;
|
|
59096
|
-
const sshDir =
|
|
57442
|
+
const sshDir = path8.join(homeDir, ".ssh");
|
|
59097
57443
|
const keyFiles = ["id_rsa", "id_ed25519", "id_ecdsa", "id_rsa.pub", "id_ed25519.pub"];
|
|
59098
57444
|
try {
|
|
59099
57445
|
if (!fs18.existsSync(sshDir))
|
|
59100
57446
|
return false;
|
|
59101
57447
|
for (const keyFile of keyFiles) {
|
|
59102
|
-
if (fs18.existsSync(
|
|
57448
|
+
if (fs18.existsSync(path8.join(sshDir, keyFile))) {
|
|
59103
57449
|
return true;
|
|
59104
57450
|
}
|
|
59105
57451
|
}
|
|
@@ -59348,15 +57694,15 @@ async function checkHomeDirResolution() {
|
|
|
59348
57694
|
const nodeHome = normalize8(homedir25());
|
|
59349
57695
|
const rawEnvHome = getHomeDirectoryFromEnv(platform6());
|
|
59350
57696
|
const envHome = rawEnvHome ? normalize8(rawEnvHome) : "";
|
|
59351
|
-
const
|
|
57697
|
+
const match = nodeHome === envHome && envHome !== "";
|
|
59352
57698
|
return {
|
|
59353
57699
|
id: "home-dir-resolution",
|
|
59354
57700
|
name: "Home Directory",
|
|
59355
57701
|
group: "platform",
|
|
59356
57702
|
priority: "standard",
|
|
59357
|
-
status:
|
|
59358
|
-
message:
|
|
59359
|
-
suggestion: !
|
|
57703
|
+
status: match ? "pass" : "warn",
|
|
57704
|
+
message: match ? nodeHome : `Mismatch: Node=${nodeHome}, Env=${envHome || "not set"}`,
|
|
57705
|
+
suggestion: !match ? "homedir() differs from environment. May cause path issues." : undefined,
|
|
59360
57706
|
autoFixable: false
|
|
59361
57707
|
};
|
|
59362
57708
|
}
|
|
@@ -60021,9 +58367,9 @@ class ReportGenerator {
|
|
|
60021
58367
|
cliVersion: getCliVersion3()
|
|
60022
58368
|
};
|
|
60023
58369
|
}
|
|
60024
|
-
scrubPath(
|
|
58370
|
+
scrubPath(path9) {
|
|
60025
58371
|
const home6 = process.env.HOME || process.env.USERPROFILE || "";
|
|
60026
|
-
return home6 ?
|
|
58372
|
+
return home6 ? path9.replace(home6, "~") : path9;
|
|
60027
58373
|
}
|
|
60028
58374
|
getStatusIcon(status2) {
|
|
60029
58375
|
switch (status2) {
|
|
@@ -60136,9 +58482,9 @@ class DoctorUIRenderer {
|
|
|
60136
58482
|
return message;
|
|
60137
58483
|
}
|
|
60138
58484
|
}
|
|
60139
|
-
shortenPath(
|
|
58485
|
+
shortenPath(path9) {
|
|
60140
58486
|
const home6 = process.env.HOME || process.env.USERPROFILE || "";
|
|
60141
|
-
let shortened = home6 ?
|
|
58487
|
+
let shortened = home6 ? path9.replace(home6, "~") : path9;
|
|
60142
58488
|
const maxLen = 50;
|
|
60143
58489
|
if (shortened.length > maxLen) {
|
|
60144
58490
|
const start2 = shortened.slice(0, 20);
|
|
@@ -60382,9 +58728,9 @@ function writeEnvFile(filePath, entries) {
|
|
|
60382
58728
|
throw err;
|
|
60383
58729
|
}
|
|
60384
58730
|
}
|
|
60385
|
-
function removeQuietly(
|
|
58731
|
+
function removeQuietly(path9) {
|
|
60386
58732
|
try {
|
|
60387
|
-
unlinkSync5(
|
|
58733
|
+
unlinkSync5(path9);
|
|
60388
58734
|
} catch {}
|
|
60389
58735
|
}
|
|
60390
58736
|
|
|
@@ -60567,7 +58913,7 @@ var conventionQualityGate = {
|
|
|
60567
58913
|
|
|
60568
58914
|
// src/domains/hooks/handlers/extension-skill/handler.ts
|
|
60569
58915
|
import fs19 from "node:fs";
|
|
60570
|
-
import
|
|
58916
|
+
import path9 from "node:path";
|
|
60571
58917
|
var CONFIG_KEY2 = "skill-extension-loader";
|
|
60572
58918
|
var SKILLS_ROOT_SEGMENTS = [".claude", "skills"];
|
|
60573
58919
|
var INLINE_CHAR_CAP = 4096;
|
|
@@ -60657,9 +59003,9 @@ function loadExtensions(input, ctx) {
|
|
|
60657
59003
|
const skillDir = baseSkillName(skill);
|
|
60658
59004
|
if (!skillDir)
|
|
60659
59005
|
return NO_OP2;
|
|
60660
|
-
const skillsRoot =
|
|
60661
|
-
const extDir =
|
|
60662
|
-
if (extDir !== skillsRoot && !extDir.startsWith(skillsRoot +
|
|
59006
|
+
const skillsRoot = path9.resolve(cwd2, ...SKILLS_ROOT_SEGMENTS);
|
|
59007
|
+
const extDir = path9.resolve(skillsRoot, skillDir, "extensions");
|
|
59008
|
+
if (extDir !== skillsRoot && !extDir.startsWith(skillsRoot + path9.sep))
|
|
60663
59009
|
return NO_OP2;
|
|
60664
59010
|
let entries;
|
|
60665
59011
|
try {
|
|
@@ -60675,7 +59021,7 @@ function loadExtensions(input, ctx) {
|
|
|
60675
59021
|
continue;
|
|
60676
59022
|
let raw;
|
|
60677
59023
|
try {
|
|
60678
|
-
raw = fs19.readFileSync(
|
|
59024
|
+
raw = fs19.readFileSync(path9.join(extDir, entry.name), "utf8");
|
|
60679
59025
|
} catch {
|
|
60680
59026
|
skipped.push(entry.name);
|
|
60681
59027
|
continue;
|
|
@@ -60723,13 +59069,13 @@ function splitTopLevel(command, operators) {
|
|
|
60723
59069
|
const re2 = new RegExp(`"[^"]*"|'[^']*'|${opAlternation}`, "g");
|
|
60724
59070
|
const segments = [];
|
|
60725
59071
|
let last = 0;
|
|
60726
|
-
let
|
|
60727
|
-
while (
|
|
60728
|
-
if (operators.includes(
|
|
60729
|
-
segments.push(withoutHeredocs.slice(last,
|
|
60730
|
-
last =
|
|
59072
|
+
let match = re2.exec(withoutHeredocs);
|
|
59073
|
+
while (match !== null) {
|
|
59074
|
+
if (operators.includes(match[0])) {
|
|
59075
|
+
segments.push(withoutHeredocs.slice(last, match.index));
|
|
59076
|
+
last = match.index + match[0].length;
|
|
60731
59077
|
}
|
|
60732
|
-
|
|
59078
|
+
match = re2.exec(withoutHeredocs);
|
|
60733
59079
|
}
|
|
60734
59080
|
segments.push(withoutHeredocs.slice(last));
|
|
60735
59081
|
return segments.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
@@ -60889,11 +59235,11 @@ function findGitRoot(startDir) {
|
|
|
60889
59235
|
dir = parent;
|
|
60890
59236
|
}
|
|
60891
59237
|
}
|
|
60892
|
-
function readIgnoreFile(
|
|
60893
|
-
if (!existsSync44(
|
|
59238
|
+
function readIgnoreFile(path10) {
|
|
59239
|
+
if (!existsSync44(path10))
|
|
60894
59240
|
return null;
|
|
60895
59241
|
try {
|
|
60896
|
-
return readFileSync13(
|
|
59242
|
+
return readFileSync13(path10, "utf8").split(/\r?\n/);
|
|
60897
59243
|
} catch {
|
|
60898
59244
|
return null;
|
|
60899
59245
|
}
|
|
@@ -61244,9 +59590,9 @@ function runScoutCheck(toolName, rawToolInput, cwd2) {
|
|
|
61244
59590
|
return { blocked: false };
|
|
61245
59591
|
}
|
|
61246
59592
|
function formatBlockedPathMessage(params) {
|
|
61247
|
-
const { path:
|
|
59593
|
+
const { path: path10, matchedPattern, toolName } = params;
|
|
61248
59594
|
return [
|
|
61249
|
-
`Blocked: ${toolName} would touch "${
|
|
59595
|
+
`Blocked: ${toolName} would touch "${path10}", which matches the ignore pattern "${matchedPattern}".`,
|
|
61250
59596
|
"This path is excluded because it sits in a high-noise, generated, or vendored directory that " + "would burn context without adding signal.",
|
|
61251
59597
|
`If this path genuinely needs to be readable, add a line "!${matchedPattern}" to the project's .claude/.tkmignore file to re-include it.`
|
|
61252
59598
|
].join(`
|
|
@@ -61615,9 +59961,9 @@ import { homedir as homedir26 } from "node:os";
|
|
|
61615
59961
|
import { dirname as dirname25, join as join94, resolve as resolve20 } from "node:path";
|
|
61616
59962
|
var PROVIDER_DIRS = [".claude", ".codex"];
|
|
61617
59963
|
var MAX_WALK = 6;
|
|
61618
|
-
function readManifestRaw(
|
|
59964
|
+
function readManifestRaw(path10) {
|
|
61619
59965
|
try {
|
|
61620
|
-
const raw = readFileSync14(
|
|
59966
|
+
const raw = readFileSync14(path10, "utf8");
|
|
61621
59967
|
return JSON.parse(raw);
|
|
61622
59968
|
} catch {
|
|
61623
59969
|
return null;
|
|
@@ -61633,9 +59979,9 @@ function findManifest(cwd2) {
|
|
|
61633
59979
|
for (const provider of PROVIDER_DIRS) {
|
|
61634
59980
|
const providerRoot = join94(dir, provider);
|
|
61635
59981
|
if (existsSync45(providerRoot)) {
|
|
61636
|
-
const
|
|
61637
|
-
if (
|
|
61638
|
-
return
|
|
59982
|
+
const path10 = findManifestInProviderDir(providerRoot);
|
|
59983
|
+
if (path10)
|
|
59984
|
+
return path10;
|
|
61639
59985
|
}
|
|
61640
59986
|
}
|
|
61641
59987
|
const parent = dirname25(dir);
|
|
@@ -61682,8 +60028,8 @@ init_takumi_constants();
|
|
|
61682
60028
|
// src/domains/hooks/lib/hook-logger.ts
|
|
61683
60029
|
import { appendFileSync } from "node:fs";
|
|
61684
60030
|
var extraLogPath = null;
|
|
61685
|
-
function setHookDebugLog(
|
|
61686
|
-
extraLogPath =
|
|
60031
|
+
function setHookDebugLog(path10) {
|
|
60032
|
+
extraLogPath = path10 && path10.trim().length > 0 ? path10 : null;
|
|
61687
60033
|
}
|
|
61688
60034
|
function formatValue(v2) {
|
|
61689
60035
|
if (v2 === null || v2 === undefined)
|
|
@@ -62622,9 +60968,9 @@ import { join as join99 } from "node:path";
|
|
|
62622
60968
|
// src/domains/hooks/telemetry/lib/retention.ts
|
|
62623
60969
|
import { promises as fs24 } from "node:fs";
|
|
62624
60970
|
import { join as join98 } from "node:path";
|
|
62625
|
-
async function pathExists24(
|
|
60971
|
+
async function pathExists24(path10) {
|
|
62626
60972
|
try {
|
|
62627
|
-
await fs24.access(
|
|
60973
|
+
await fs24.access(path10);
|
|
62628
60974
|
return true;
|
|
62629
60975
|
} catch {
|
|
62630
60976
|
return false;
|
|
@@ -62700,9 +61046,9 @@ async function sweepRetention(args) {
|
|
|
62700
61046
|
|
|
62701
61047
|
// src/domains/hooks/telemetry/otlp/observations-export-state.ts
|
|
62702
61048
|
import { promises as fs25 } from "node:fs";
|
|
62703
|
-
async function exists(
|
|
61049
|
+
async function exists(path10) {
|
|
62704
61050
|
try {
|
|
62705
|
-
await fs25.access(
|
|
61051
|
+
await fs25.access(path10);
|
|
62706
61052
|
return true;
|
|
62707
61053
|
} catch {
|
|
62708
61054
|
return false;
|
|
@@ -63099,21 +61445,21 @@ function lockPath() {
|
|
|
63099
61445
|
return join99(getConfigDir(), "obs-flush.lock");
|
|
63100
61446
|
}
|
|
63101
61447
|
async function acquireSweepLock(now) {
|
|
63102
|
-
const
|
|
61448
|
+
const path10 = lockPath();
|
|
63103
61449
|
try {
|
|
63104
61450
|
await fs27.mkdir(getConfigDir(), { recursive: true });
|
|
63105
61451
|
} catch {
|
|
63106
61452
|
return false;
|
|
63107
61453
|
}
|
|
63108
61454
|
try {
|
|
63109
|
-
openSync6(
|
|
61455
|
+
openSync6(path10, "wx");
|
|
63110
61456
|
return true;
|
|
63111
61457
|
} catch {
|
|
63112
61458
|
try {
|
|
63113
|
-
const stat8 = await fs27.stat(
|
|
61459
|
+
const stat8 = await fs27.stat(path10);
|
|
63114
61460
|
if (now - stat8.mtimeMs > STALE_LOCK_MS) {
|
|
63115
|
-
await fs27.rm(
|
|
63116
|
-
openSync6(
|
|
61461
|
+
await fs27.rm(path10, { force: true });
|
|
61462
|
+
openSync6(path10, "wx");
|
|
63117
61463
|
return true;
|
|
63118
61464
|
}
|
|
63119
61465
|
} catch {}
|
|
@@ -63504,13 +61850,13 @@ function parseUserPrompt(prompt) {
|
|
|
63504
61850
|
if (typeof prompt !== "string" || prompt.length === 0) {
|
|
63505
61851
|
return { skills, subagents };
|
|
63506
61852
|
}
|
|
63507
|
-
for (const
|
|
63508
|
-
const name =
|
|
61853
|
+
for (const match of prompt.matchAll(SLASH_COMMAND_RE)) {
|
|
61854
|
+
const name = match[1];
|
|
63509
61855
|
if (name)
|
|
63510
61856
|
skills.push(name);
|
|
63511
61857
|
}
|
|
63512
|
-
for (const
|
|
63513
|
-
const name =
|
|
61858
|
+
for (const match of prompt.matchAll(SUBAGENT_MENTION_RE)) {
|
|
61859
|
+
const name = match[1]?.toLowerCase();
|
|
63514
61860
|
if (name)
|
|
63515
61861
|
subagents.push(name);
|
|
63516
61862
|
}
|
|
@@ -63810,8 +62156,8 @@ function resolveSuggestedPlan(plansPath, branch, branchPattern) {
|
|
|
63810
62156
|
return "";
|
|
63811
62157
|
let slug = "";
|
|
63812
62158
|
try {
|
|
63813
|
-
const
|
|
63814
|
-
slug =
|
|
62159
|
+
const match = new RegExp(branchPattern).exec(branch);
|
|
62160
|
+
slug = match && (match[1] ?? match[0]) || "";
|
|
63815
62161
|
} catch {
|
|
63816
62162
|
return "";
|
|
63817
62163
|
}
|
|
@@ -64945,7 +63291,7 @@ class Diff {
|
|
|
64945
63291
|
return this.diffWithOptionsObj(oldTokens, newTokens, options2, callback);
|
|
64946
63292
|
}
|
|
64947
63293
|
diffWithOptionsObj(oldTokens, newTokens, options2, callback) {
|
|
64948
|
-
var
|
|
63294
|
+
var _a;
|
|
64949
63295
|
const done = (value) => {
|
|
64950
63296
|
value = this.postProcess(value, options2);
|
|
64951
63297
|
if (callback) {
|
|
@@ -64963,7 +63309,7 @@ class Diff {
|
|
|
64963
63309
|
if (options2.maxEditLength != null) {
|
|
64964
63310
|
maxEditLength = Math.min(maxEditLength, options2.maxEditLength);
|
|
64965
63311
|
}
|
|
64966
|
-
const maxExecutionTime = (
|
|
63312
|
+
const maxExecutionTime = (_a = options2.timeout) !== null && _a !== undefined ? _a : Infinity;
|
|
64967
63313
|
const abortAfterTimestamp = Date.now() + maxExecutionTime;
|
|
64968
63314
|
const bestPath = [{ oldPos: -1, lastComponent: undefined }];
|
|
64969
63315
|
let newPos = this.extractCommon(bestPath[0], newTokens, oldTokens, 0, options2);
|
|
@@ -65028,16 +63374,16 @@ class Diff {
|
|
|
65028
63374
|
}
|
|
65029
63375
|
}
|
|
65030
63376
|
}
|
|
65031
|
-
addToPath(
|
|
65032
|
-
const last =
|
|
63377
|
+
addToPath(path10, added, removed, oldPosInc, options2) {
|
|
63378
|
+
const last = path10.lastComponent;
|
|
65033
63379
|
if (last && !options2.oneChangePerToken && last.added === added && last.removed === removed) {
|
|
65034
63380
|
return {
|
|
65035
|
-
oldPos:
|
|
63381
|
+
oldPos: path10.oldPos + oldPosInc,
|
|
65036
63382
|
lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
|
|
65037
63383
|
};
|
|
65038
63384
|
} else {
|
|
65039
63385
|
return {
|
|
65040
|
-
oldPos:
|
|
63386
|
+
oldPos: path10.oldPos + oldPosInc,
|
|
65041
63387
|
lastComponent: { count: 1, added, removed, previousComponent: last }
|
|
65042
63388
|
};
|
|
65043
63389
|
}
|
|
@@ -65253,8 +63599,8 @@ function leadingWs(string, segmenter2) {
|
|
|
65253
63599
|
if (segmenter2) {
|
|
65254
63600
|
return leadingAndTrailingWs(string, segmenter2)[0];
|
|
65255
63601
|
}
|
|
65256
|
-
const
|
|
65257
|
-
return
|
|
63602
|
+
const match = string.match(/^\s*/);
|
|
63603
|
+
return match ? match[0] : "";
|
|
65258
63604
|
}
|
|
65259
63605
|
function leadingAndTrailingWs(string, segmenter2) {
|
|
65260
63606
|
if (!segmenter2) {
|
|
@@ -65467,7 +63813,7 @@ function isSentenceEndPunct(char) {
|
|
|
65467
63813
|
|
|
65468
63814
|
class SentenceDiff extends Diff {
|
|
65469
63815
|
tokenize(value) {
|
|
65470
|
-
var
|
|
63816
|
+
var _a;
|
|
65471
63817
|
const result = [];
|
|
65472
63818
|
let tokenStartI = 0;
|
|
65473
63819
|
for (let i = 0;i < value.length; i++) {
|
|
@@ -65478,7 +63824,7 @@ class SentenceDiff extends Diff {
|
|
|
65478
63824
|
if (isSentenceEndPunct(value[i]) && value[i + 1].match(/\s/)) {
|
|
65479
63825
|
result.push(value.slice(tokenStartI, i + 1));
|
|
65480
63826
|
i = tokenStartI = i + 1;
|
|
65481
|
-
while ((
|
|
63827
|
+
while ((_a = value[i + 1]) === null || _a === undefined ? undefined : _a.match(/\s/)) {
|
|
65482
63828
|
i++;
|
|
65483
63829
|
}
|
|
65484
63830
|
result.push(value.slice(tokenStartI, i + 1));
|
|
@@ -65587,8 +63933,8 @@ function unixToWin(patch) {
|
|
|
65587
63933
|
return patch.map((p) => unixToWin(p));
|
|
65588
63934
|
}
|
|
65589
63935
|
return Object.assign(Object.assign({}, patch), { hunks: patch.hunks.map((hunk) => Object.assign(Object.assign({}, hunk), { lines: hunk.lines.map((line, i) => {
|
|
65590
|
-
var
|
|
65591
|
-
return line.startsWith("\\") || line.endsWith("\r") || ((
|
|
63936
|
+
var _a;
|
|
63937
|
+
return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === undefined ? undefined : _a.startsWith("\\")) ? line : line + "\r";
|
|
65592
63938
|
}) })) });
|
|
65593
63939
|
}
|
|
65594
63940
|
function winToUnix(patch) {
|
|
@@ -65608,8 +63954,8 @@ function isWin(patch) {
|
|
|
65608
63954
|
patch = [patch];
|
|
65609
63955
|
}
|
|
65610
63956
|
return patch.some((index) => index.hunks.some((hunk) => hunk.lines.some((line) => line.endsWith("\r")))) && patch.every((index) => index.hunks.every((hunk) => hunk.lines.every((line, i) => {
|
|
65611
|
-
var
|
|
65612
|
-
return line.startsWith("\\") || line.endsWith("\r") || ((
|
|
63957
|
+
var _a;
|
|
63958
|
+
return line.startsWith("\\") || line.endsWith("\r") || ((_a = hunk.lines[i + 1]) === null || _a === undefined ? undefined : _a.startsWith("\\"));
|
|
65613
63959
|
})));
|
|
65614
63960
|
}
|
|
65615
63961
|
|
|
@@ -65666,7 +64012,7 @@ function parsePatch(uniDiff) {
|
|
|
65666
64012
|
}
|
|
65667
64013
|
}
|
|
65668
64014
|
function parseHunk() {
|
|
65669
|
-
var
|
|
64015
|
+
var _a;
|
|
65670
64016
|
const chunkHeaderIndex = i, chunkHeaderLine = diffstr[i++], chunkHeader = chunkHeaderLine.split(/@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);
|
|
65671
64017
|
const hunk = {
|
|
65672
64018
|
oldStart: +chunkHeader[1],
|
|
@@ -65682,7 +64028,7 @@ function parsePatch(uniDiff) {
|
|
|
65682
64028
|
hunk.newStart += 1;
|
|
65683
64029
|
}
|
|
65684
64030
|
let addCount = 0, removeCount = 0;
|
|
65685
|
-
for (;i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((
|
|
64031
|
+
for (;i < diffstr.length && (removeCount < hunk.oldLines || addCount < hunk.newLines || ((_a = diffstr[i]) === null || _a === undefined ? undefined : _a.startsWith("\\"))); i++) {
|
|
65686
64032
|
const operation = diffstr[i].length == 0 && i != diffstr.length - 1 ? " " : diffstr[i][0];
|
|
65687
64033
|
if (operation === "+" || operation === "-" || operation === " " || operation === "\\") {
|
|
65688
64034
|
hunk.lines.push(diffstr[i]);
|
|
@@ -66097,12 +64443,12 @@ var EMPTY_RESULT = (status2) => ({
|
|
|
66097
64443
|
deletions: 0,
|
|
66098
64444
|
backupPath: null
|
|
66099
64445
|
});
|
|
66100
|
-
function readCurrent(
|
|
66101
|
-
if (!existsSync49(
|
|
64446
|
+
function readCurrent(path10) {
|
|
64447
|
+
if (!existsSync49(path10))
|
|
66102
64448
|
return { kind: "missing" };
|
|
66103
64449
|
let raw = "";
|
|
66104
64450
|
try {
|
|
66105
|
-
raw = readFileSync18(
|
|
64451
|
+
raw = readFileSync18(path10, "utf8");
|
|
66106
64452
|
const parsed = JSON.parse(raw);
|
|
66107
64453
|
return { kind: "ok", raw, parsed };
|
|
66108
64454
|
} catch {
|
|
@@ -66128,21 +64474,21 @@ function diffStats(diff) {
|
|
|
66128
64474
|
}
|
|
66129
64475
|
return { additions, deletions };
|
|
66130
64476
|
}
|
|
66131
|
-
function atomicWrite2(
|
|
66132
|
-
mkdirSync7(dirname29(
|
|
66133
|
-
const tmp = `${
|
|
64477
|
+
function atomicWrite2(path10, contents, backupPath) {
|
|
64478
|
+
mkdirSync7(dirname29(path10), { recursive: true });
|
|
64479
|
+
const tmp = `${path10}.tmp`;
|
|
66134
64480
|
try {
|
|
66135
64481
|
writeFileSync10(tmp, contents);
|
|
66136
|
-
renameSync3(tmp,
|
|
64482
|
+
renameSync3(tmp, path10);
|
|
66137
64483
|
} catch (err) {
|
|
66138
64484
|
rmSync4(tmp, { force: true });
|
|
66139
64485
|
const trailer = backupPath ? `. Backup preserved at: ${backupPath}` : "";
|
|
66140
|
-
throw new Error(`Failed to write ${
|
|
64486
|
+
throw new Error(`Failed to write ${path10}: ${err instanceof Error ? err.message : String(err)}${trailer}`);
|
|
66141
64487
|
}
|
|
66142
64488
|
}
|
|
66143
|
-
function writeBackup(
|
|
64489
|
+
function writeBackup(path10, raw) {
|
|
66144
64490
|
const timestamp = new Date().toISOString().replace(/[:.]/g, "-").slice(0, 19);
|
|
66145
|
-
const backupPath = `${
|
|
64491
|
+
const backupPath = `${path10}.${timestamp}.bak`;
|
|
66146
64492
|
try {
|
|
66147
64493
|
writeFileSync10(backupPath, raw);
|
|
66148
64494
|
return backupPath;
|
|
@@ -66151,7 +64497,7 @@ function writeBackup(path11, raw) {
|
|
|
66151
64497
|
}
|
|
66152
64498
|
}
|
|
66153
64499
|
async function resolveMissingFile(options2) {
|
|
66154
|
-
const { missingFile, interactive, label, path:
|
|
64500
|
+
const { missingFile, interactive, label, path: path10 } = options2;
|
|
66155
64501
|
if (missingFile === "create")
|
|
66156
64502
|
return "proceed";
|
|
66157
64503
|
if (missingFile === "skip")
|
|
@@ -66159,7 +64505,7 @@ async function resolveMissingFile(options2) {
|
|
|
66159
64505
|
if (!interactive)
|
|
66160
64506
|
return "skip";
|
|
66161
64507
|
const result = await se({
|
|
66162
|
-
message: `${label} does not exist at ${
|
|
64508
|
+
message: `${label} does not exist at ${path10}. Create it?`,
|
|
66163
64509
|
initialValue: false
|
|
66164
64510
|
});
|
|
66165
64511
|
if (lD(result))
|
|
@@ -66167,9 +64513,9 @@ async function resolveMissingFile(options2) {
|
|
|
66167
64513
|
return result ? "proceed" : "skip";
|
|
66168
64514
|
}
|
|
66169
64515
|
async function writeSettingsWithConfirm(options2) {
|
|
66170
|
-
const { path:
|
|
64516
|
+
const { path: path10, transform, yes, dryRun, interactive, useStepUI } = options2;
|
|
66171
64517
|
const diffPrint = useStepUI ? stepLine : undefined;
|
|
66172
|
-
const current = readCurrent(
|
|
64518
|
+
const current = readCurrent(path10);
|
|
66173
64519
|
if (current.kind === "corrupt")
|
|
66174
64520
|
return EMPTY_RESULT("skipped-corrupt");
|
|
66175
64521
|
const fileMissing = current.kind === "missing";
|
|
@@ -66186,7 +64532,7 @@ async function writeSettingsWithConfirm(options2) {
|
|
|
66186
64532
|
if (before === after) {
|
|
66187
64533
|
return EMPTY_RESULT("no-changes");
|
|
66188
64534
|
}
|
|
66189
|
-
const diff = createPatch(
|
|
64535
|
+
const diff = createPatch(path10, before, after, "", "", { context: 3 });
|
|
66190
64536
|
const { additions, deletions } = diffStats(diff);
|
|
66191
64537
|
if (dryRun) {
|
|
66192
64538
|
displayDiff(diff, { color: true, print: diffPrint });
|
|
@@ -66195,15 +64541,15 @@ async function writeSettingsWithConfirm(options2) {
|
|
|
66195
64541
|
if (!yes && interactive) {
|
|
66196
64542
|
displayDiff(diff, { color: true, print: diffPrint });
|
|
66197
64543
|
const accepted = await se({
|
|
66198
|
-
message: `Apply changes to ${
|
|
64544
|
+
message: `Apply changes to ${path10}?`,
|
|
66199
64545
|
initialValue: false
|
|
66200
64546
|
});
|
|
66201
64547
|
if (lD(accepted) || !accepted) {
|
|
66202
64548
|
return { status: "user-declined", diff, additions, deletions, backupPath: null };
|
|
66203
64549
|
}
|
|
66204
64550
|
}
|
|
66205
|
-
const backupPath = fileMissing ? null : writeBackup(
|
|
66206
|
-
atomicWrite2(
|
|
64551
|
+
const backupPath = fileMissing ? null : writeBackup(path10, raw);
|
|
64552
|
+
atomicWrite2(path10, after, backupPath);
|
|
66207
64553
|
return { status: "wrote", diff, additions, deletions, backupPath };
|
|
66208
64554
|
}
|
|
66209
64555
|
|
|
@@ -66416,12 +64762,12 @@ function pruneHooksSection(hooks, agent) {
|
|
|
66416
64762
|
}
|
|
66417
64763
|
return { pruned, removed };
|
|
66418
64764
|
}
|
|
66419
|
-
function writeAtomic(
|
|
66420
|
-
mkdirSync8(dirname30(
|
|
66421
|
-
const tmp = `${
|
|
64765
|
+
function writeAtomic(path10, contents) {
|
|
64766
|
+
mkdirSync8(dirname30(path10), { recursive: true });
|
|
64767
|
+
const tmp = `${path10}.tmp`;
|
|
66422
64768
|
try {
|
|
66423
64769
|
writeFileSync11(tmp, contents);
|
|
66424
|
-
renameSync4(tmp,
|
|
64770
|
+
renameSync4(tmp, path10);
|
|
66425
64771
|
} catch (err) {
|
|
66426
64772
|
rmSync5(tmp, { force: true });
|
|
66427
64773
|
throw err;
|
|
@@ -66879,8 +65225,8 @@ async function probeBinary(candidates) {
|
|
|
66879
65225
|
return null;
|
|
66880
65226
|
}
|
|
66881
65227
|
function extractVersion(stdout) {
|
|
66882
|
-
const
|
|
66883
|
-
return
|
|
65228
|
+
const match = stdout.match(/(\d+\.\d+\.\d+(?:[-+][\w.]+)?)/);
|
|
65229
|
+
return match ? match[1] : undefined;
|
|
66884
65230
|
}
|
|
66885
65231
|
async function detectAgentInstallations(providers2) {
|
|
66886
65232
|
const probes = providers2.filter((p) => (p in BINARY_CANDIDATES)).map(async (provider) => {
|
|
@@ -66963,7 +65309,7 @@ async function selectKit(defaultKit, accessibleKits) {
|
|
|
66963
65309
|
}
|
|
66964
65310
|
return kit;
|
|
66965
65311
|
}
|
|
66966
|
-
async function selectKits(accessibleKits,
|
|
65312
|
+
async function selectKits(accessibleKits, defaults) {
|
|
66967
65313
|
const kits = accessibleKits ?? Object.keys(AVAILABLE_KITS);
|
|
66968
65314
|
const options2 = kits.map((key) => {
|
|
66969
65315
|
const isBase = key === BASE_KIT;
|
|
@@ -66974,7 +65320,7 @@ async function selectKits(accessibleKits, defaults2) {
|
|
|
66974
65320
|
hint: cfg.description
|
|
66975
65321
|
};
|
|
66976
65322
|
});
|
|
66977
|
-
const initialValues =
|
|
65323
|
+
const initialValues = defaults && defaults.length > 0 ? Array.from(new Set([BASE_KIT, ...defaults])).filter((k2) => kits.includes(k2)) : kits;
|
|
66978
65324
|
const selected = await ae({
|
|
66979
65325
|
message: "Select kit(s) to install:",
|
|
66980
65326
|
options: options2,
|
|
@@ -67777,8 +66123,8 @@ class PromptsManager {
|
|
|
67777
66123
|
async selectKit(defaultKit, accessibleKits) {
|
|
67778
66124
|
return selectKit(defaultKit, accessibleKits);
|
|
67779
66125
|
}
|
|
67780
|
-
async selectKits(accessibleKits,
|
|
67781
|
-
return selectKits(accessibleKits,
|
|
66126
|
+
async selectKits(accessibleKits, defaults) {
|
|
66127
|
+
return selectKits(accessibleKits, defaults);
|
|
67782
66128
|
}
|
|
67783
66129
|
async selectVersion(versions, defaultVersion) {
|
|
67784
66130
|
return selectVersion(versions, defaultVersion);
|
|
@@ -68057,7 +66403,7 @@ init_logger();
|
|
|
68057
66403
|
// src/domains/installation/download-extractor.ts
|
|
68058
66404
|
init_auth_client();
|
|
68059
66405
|
import * as fs29 from "node:fs";
|
|
68060
|
-
import * as
|
|
66406
|
+
import * as path10 from "node:path";
|
|
68061
66407
|
|
|
68062
66408
|
// src/domains/github/auth-prompt.ts
|
|
68063
66409
|
init_dist2();
|
|
@@ -68565,13 +66911,13 @@ async function validateExtraction(extractDir) {
|
|
|
68565
66911
|
}
|
|
68566
66912
|
const criticalPaths = [".claude", "CLAUDE.md"];
|
|
68567
66913
|
const missingPaths = [];
|
|
68568
|
-
for (const
|
|
66914
|
+
for (const path10 of criticalPaths) {
|
|
68569
66915
|
try {
|
|
68570
|
-
await access3(join110(extractDir,
|
|
68571
|
-
logger.debug(`Found: ${
|
|
66916
|
+
await access3(join110(extractDir, path10), constants3.F_OK);
|
|
66917
|
+
logger.debug(`Found: ${path10}`);
|
|
68572
66918
|
} catch {
|
|
68573
|
-
logger.warning(`Expected path not found: ${
|
|
68574
|
-
missingPaths.push(
|
|
66919
|
+
logger.warning(`Expected path not found: ${path10}`);
|
|
66920
|
+
missingPaths.push(path10);
|
|
68575
66921
|
}
|
|
68576
66922
|
}
|
|
68577
66923
|
if (missingPaths.length > 0) {
|
|
@@ -71781,20 +70127,20 @@ function normalizeZipEntryName(entryName) {
|
|
|
71781
70127
|
}
|
|
71782
70128
|
return String(entryName);
|
|
71783
70129
|
}
|
|
71784
|
-
function decodeFilePath(
|
|
71785
|
-
if (!
|
|
71786
|
-
return
|
|
70130
|
+
function decodeFilePath(path10) {
|
|
70131
|
+
if (!path10.includes("%")) {
|
|
70132
|
+
return path10;
|
|
71787
70133
|
}
|
|
71788
70134
|
try {
|
|
71789
|
-
if (/%[0-9A-F]{2}/i.test(
|
|
71790
|
-
const decoded = decodeURIComponent(
|
|
71791
|
-
logger.debug(`Decoded path: ${
|
|
70135
|
+
if (/%[0-9A-F]{2}/i.test(path10)) {
|
|
70136
|
+
const decoded = decodeURIComponent(path10);
|
|
70137
|
+
logger.debug(`Decoded path: ${path10} -> ${decoded}`);
|
|
71792
70138
|
return decoded;
|
|
71793
70139
|
}
|
|
71794
|
-
return
|
|
70140
|
+
return path10;
|
|
71795
70141
|
} catch (error) {
|
|
71796
|
-
logger.warning(`Failed to decode path "${
|
|
71797
|
-
return
|
|
70142
|
+
logger.warning(`Failed to decode path "${path10}": ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
70143
|
+
return path10;
|
|
71798
70144
|
}
|
|
71799
70145
|
}
|
|
71800
70146
|
|
|
@@ -71890,12 +70236,12 @@ class TarExtractor {
|
|
|
71890
70236
|
onwarn: (code, message) => {
|
|
71891
70237
|
logger.debug(`tar warning [${code}]: ${message}`);
|
|
71892
70238
|
},
|
|
71893
|
-
filter: (
|
|
70239
|
+
filter: (path10, entry) => {
|
|
71894
70240
|
if ("type" in entry && (entry.type === "SymbolicLink" || entry.type === "Link")) {
|
|
71895
|
-
logger.debug(`Skipping symlink: ${
|
|
70241
|
+
logger.debug(`Skipping symlink: ${path10}`);
|
|
71896
70242
|
return false;
|
|
71897
70243
|
}
|
|
71898
|
-
const decodedPath = decodeFilePath(
|
|
70244
|
+
const decodedPath = decodeFilePath(path10);
|
|
71899
70245
|
const shouldInclude = !shouldExclude(decodedPath);
|
|
71900
70246
|
if (!shouldInclude) {
|
|
71901
70247
|
logger.debug(`Excluding: ${decodedPath}`);
|
|
@@ -72164,7 +70510,7 @@ function buildReleaseAllowlist(layout) {
|
|
|
72164
70510
|
return [...new Set([layout.sourceDir, ...RELEASE_ROOT_ALLOWLIST])];
|
|
72165
70511
|
}
|
|
72166
70512
|
async function ensureLayoutSourceDir(projectRoot, layout, strict) {
|
|
72167
|
-
const sourceDir =
|
|
70513
|
+
const sourceDir = path10.join(projectRoot, layout.sourceDir);
|
|
72168
70514
|
try {
|
|
72169
70515
|
const stat11 = await fs29.promises.stat(sourceDir);
|
|
72170
70516
|
if (!stat11.isDirectory()) {
|
|
@@ -72189,8 +70535,8 @@ async function materializeRuntimeLayoutInPlace(projectRoot, layout) {
|
|
|
72189
70535
|
if (layout.sourceDir === layout.runtimeDir) {
|
|
72190
70536
|
return;
|
|
72191
70537
|
}
|
|
72192
|
-
const sourceDir =
|
|
72193
|
-
const runtimeDir =
|
|
70538
|
+
const sourceDir = path10.join(projectRoot, layout.sourceDir);
|
|
70539
|
+
const runtimeDir = path10.join(projectRoot, layout.runtimeDir);
|
|
72194
70540
|
await fs29.promises.rm(runtimeDir, { recursive: true, force: true });
|
|
72195
70541
|
await fs29.promises.rename(sourceDir, runtimeDir);
|
|
72196
70542
|
}
|
|
@@ -72209,12 +70555,12 @@ async function stageLocalKitPathForRuntimeLayout(kitRoot, layout) {
|
|
|
72209
70555
|
if (!allowlist.includes(entry) || entry === layout.sourceDir) {
|
|
72210
70556
|
continue;
|
|
72211
70557
|
}
|
|
72212
|
-
await fs29.promises.cp(
|
|
70558
|
+
await fs29.promises.cp(path10.join(kitRoot, entry), path10.join(extractDir, entry), {
|
|
72213
70559
|
recursive: true
|
|
72214
70560
|
});
|
|
72215
70561
|
}
|
|
72216
|
-
const runtimeDir =
|
|
72217
|
-
await fs29.promises.mkdir(
|
|
70562
|
+
const runtimeDir = path10.join(extractDir, layout.runtimeDir);
|
|
70563
|
+
await fs29.promises.mkdir(path10.dirname(runtimeDir), { recursive: true });
|
|
72218
70564
|
await fs29.promises.cp(sourceDir, runtimeDir, { recursive: true });
|
|
72219
70565
|
logger.verbose("Staged local kit path with runtime layout", {
|
|
72220
70566
|
kitRoot,
|
|
@@ -72242,14 +70588,14 @@ var MONOREPO_KIT_CONTENT = [
|
|
|
72242
70588
|
];
|
|
72243
70589
|
function resolveRepoRootForKit(kitRoot) {
|
|
72244
70590
|
try {
|
|
72245
|
-
const parent =
|
|
72246
|
-
const parentPackageJson =
|
|
70591
|
+
const parent = path10.dirname(kitRoot);
|
|
70592
|
+
const parentPackageJson = path10.join(parent, "package.json");
|
|
72247
70593
|
if (!fs29.existsSync(parentPackageJson))
|
|
72248
70594
|
return kitRoot;
|
|
72249
70595
|
const pkg = JSON.parse(fs29.readFileSync(parentPackageJson, "utf-8"));
|
|
72250
70596
|
const kitCfg = pkg.takumi;
|
|
72251
70597
|
const sourceDir = kitCfg?.sourceDir;
|
|
72252
|
-
if (typeof sourceDir === "string" &&
|
|
70598
|
+
if (typeof sourceDir === "string" && path10.resolve(parent, sourceDir) === path10.resolve(kitRoot)) {
|
|
72253
70599
|
return parent;
|
|
72254
70600
|
}
|
|
72255
70601
|
} catch {}
|
|
@@ -72259,7 +70605,7 @@ async function stageMonorepoForInstallation(kitRoot) {
|
|
|
72259
70605
|
const downloadManager = new DownloadManager;
|
|
72260
70606
|
const tempDir = await downloadManager.createTempDir();
|
|
72261
70607
|
const extractDir = `${tempDir}/extracted`;
|
|
72262
|
-
const claudeDir =
|
|
70608
|
+
const claudeDir = path10.join(extractDir, ".claude");
|
|
72263
70609
|
await fs29.promises.mkdir(claudeDir, { recursive: true });
|
|
72264
70610
|
const repoRoot = resolveRepoRootForKit(kitRoot);
|
|
72265
70611
|
const kitEntries = await fs29.promises.readdir(kitRoot);
|
|
@@ -72269,15 +70615,15 @@ async function stageMonorepoForInstallation(kitRoot) {
|
|
|
72269
70615
|
continue;
|
|
72270
70616
|
if (skipLegacyManifest && entry === LEGACY_MANIFEST_FILENAME)
|
|
72271
70617
|
continue;
|
|
72272
|
-
const srcPath =
|
|
72273
|
-
await fs29.promises.cp(srcPath,
|
|
70618
|
+
const srcPath = path10.join(kitRoot, entry);
|
|
70619
|
+
await fs29.promises.cp(srcPath, path10.join(claudeDir, entry), { recursive: true });
|
|
72274
70620
|
}
|
|
72275
70621
|
const repoEntries = repoRoot === kitRoot ? kitEntries : await fs29.promises.readdir(repoRoot);
|
|
72276
70622
|
for (const entry of repoEntries) {
|
|
72277
70623
|
if (!RELEASE_ROOT_ALLOWLIST.includes(entry))
|
|
72278
70624
|
continue;
|
|
72279
|
-
const srcPath =
|
|
72280
|
-
await fs29.promises.cp(srcPath,
|
|
70625
|
+
const srcPath = path10.join(repoRoot, entry);
|
|
70626
|
+
await fs29.promises.cp(srcPath, path10.join(extractDir, entry), { recursive: true });
|
|
72281
70627
|
}
|
|
72282
70628
|
logger.verbose("Staged monorepo for installation", {
|
|
72283
70629
|
kitRoot,
|
|
@@ -72296,7 +70642,7 @@ async function normalizeFullRepoExtract(dir, strict) {
|
|
|
72296
70642
|
let removedCount = 0;
|
|
72297
70643
|
for (const entry of entries) {
|
|
72298
70644
|
if (!releaseAllowlist.includes(entry)) {
|
|
72299
|
-
const fullPath =
|
|
70645
|
+
const fullPath = path10.join(dir, entry);
|
|
72300
70646
|
await fs29.promises.rm(fullPath, { recursive: true, force: true });
|
|
72301
70647
|
removedCount++;
|
|
72302
70648
|
}
|
|
@@ -72410,7 +70756,7 @@ Or try: tkm init --use-git`);
|
|
|
72410
70756
|
async function useLocalKitPath(kitPath, isMonorepo) {
|
|
72411
70757
|
logger.verbose("Using local kit path", { kitPath });
|
|
72412
70758
|
output.section("Using local kit");
|
|
72413
|
-
const absolutePath =
|
|
70759
|
+
const absolutePath = path10.resolve(kitPath);
|
|
72414
70760
|
try {
|
|
72415
70761
|
const stat11 = await fs29.promises.stat(absolutePath);
|
|
72416
70762
|
if (!stat11.isDirectory()) {
|
|
@@ -72449,7 +70795,7 @@ Please verify the path exists and is accessible.`);
|
|
|
72449
70795
|
};
|
|
72450
70796
|
}
|
|
72451
70797
|
}
|
|
72452
|
-
const claudeDir =
|
|
70798
|
+
const claudeDir = path10.join(absolutePath, DEFAULT_KIT_LAYOUT.runtimeDir);
|
|
72453
70799
|
try {
|
|
72454
70800
|
const stat11 = await fs29.promises.stat(claudeDir);
|
|
72455
70801
|
if (!stat11.isDirectory()) {
|
|
@@ -72472,10 +70818,10 @@ This may not be a valid Takumi installation. Proceeding anyway...`);
|
|
|
72472
70818
|
var VALID_ARCHIVE_FORMATS = [".zip", ".tar.gz", ".tgz", ".tar"];
|
|
72473
70819
|
function validateArchiveFormat(archivePath) {
|
|
72474
70820
|
const lowerPath = archivePath.toLowerCase();
|
|
72475
|
-
const isValid2 = VALID_ARCHIVE_FORMATS.some((
|
|
70821
|
+
const isValid2 = VALID_ARCHIVE_FORMATS.some((ext) => lowerPath.endsWith(ext));
|
|
72476
70822
|
if (!isValid2) {
|
|
72477
|
-
const
|
|
72478
|
-
throw new Error(`Unsupported archive format: ${
|
|
70823
|
+
const ext = path10.extname(archivePath) || "(no extension)";
|
|
70824
|
+
throw new Error(`Unsupported archive format: ${ext}
|
|
72479
70825
|
|
|
72480
70826
|
` + `Supported formats: ${VALID_ARCHIVE_FORMATS.join(", ")}`);
|
|
72481
70827
|
}
|
|
@@ -72483,7 +70829,7 @@ function validateArchiveFormat(archivePath) {
|
|
|
72483
70829
|
async function extractLocalArchive(archivePath, exclude) {
|
|
72484
70830
|
logger.verbose("Using local archive", { archivePath });
|
|
72485
70831
|
output.section("Extracting local archive");
|
|
72486
|
-
const absolutePath =
|
|
70832
|
+
const absolutePath = path10.resolve(archivePath);
|
|
72487
70833
|
validateArchiveFormat(absolutePath);
|
|
72488
70834
|
try {
|
|
72489
70835
|
const stat11 = await fs29.promises.stat(absolutePath);
|
|
@@ -72617,7 +70963,7 @@ async function downloadViaWorker(release, kit, isNonInteractive2) {
|
|
|
72617
70963
|
const res = await source.fetchAsset(release.tag_name, assetName);
|
|
72618
70964
|
const downloadManager = new DownloadManager;
|
|
72619
70965
|
const tempDir = await downloadManager.createTempDir();
|
|
72620
|
-
const archivePath =
|
|
70966
|
+
const archivePath = path10.join(tempDir, assetName);
|
|
72621
70967
|
const buf = Buffer.from(await res.arrayBuffer());
|
|
72622
70968
|
await fs29.promises.writeFile(archivePath, buf);
|
|
72623
70969
|
const extractDir = `${tempDir}/extracted`;
|
|
@@ -72912,8 +71258,8 @@ async function runPreflightChecks() {
|
|
|
72912
71258
|
};
|
|
72913
71259
|
try {
|
|
72914
71260
|
const { stdout } = await execAsync7("gh --version", { timeout: GH_COMMAND_TIMEOUT_MS });
|
|
72915
|
-
const
|
|
72916
|
-
if (!
|
|
71261
|
+
const match = stdout.match(/(\d+\.\d+\.\d+)/);
|
|
71262
|
+
if (!match) {
|
|
72917
71263
|
logger.debug(`GitHub CLI version not detected from output: ${stdout.trim()}`);
|
|
72918
71264
|
result.ghInstalled = true;
|
|
72919
71265
|
result.errorLines.push("✗ GitHub CLI installed but version could not be detected");
|
|
@@ -72921,7 +71267,7 @@ async function runPreflightChecks() {
|
|
|
72921
71267
|
result.errorLines.push(" Try running: gh --version");
|
|
72922
71268
|
return result;
|
|
72923
71269
|
}
|
|
72924
|
-
result.ghVersion =
|
|
71270
|
+
result.ghVersion = match[1];
|
|
72925
71271
|
result.ghInstalled = true;
|
|
72926
71272
|
logger.debug(`GitHub CLI detected: v${result.ghVersion}`);
|
|
72927
71273
|
} catch (error) {
|
|
@@ -73763,8 +72109,8 @@ import { lstat as lstat7, readFile as readFile40, readlink, realpath as realpath
|
|
|
73763
72109
|
import { isAbsolute as isAbsolute5, join as join120, normalize as normalize9, relative as relative17 } from "node:path";
|
|
73764
72110
|
var MAX_SYNC_FILE_SIZE = 10 * 1024 * 1024;
|
|
73765
72111
|
var MAX_SYMLINK_DEPTH = 20;
|
|
73766
|
-
async function validateSymlinkChain(
|
|
73767
|
-
let current =
|
|
72112
|
+
async function validateSymlinkChain(path11, basePath, maxDepth = MAX_SYMLINK_DEPTH) {
|
|
72113
|
+
let current = path11;
|
|
73768
72114
|
let depth = 0;
|
|
73769
72115
|
while (depth < maxDepth) {
|
|
73770
72116
|
try {
|
|
@@ -73776,7 +72122,7 @@ async function validateSymlinkChain(path12, basePath, maxDepth = MAX_SYMLINK_DEP
|
|
|
73776
72122
|
const normalizedTarget = normalize9(resolvedTarget);
|
|
73777
72123
|
const rel = relative17(basePath, normalizedTarget);
|
|
73778
72124
|
if (rel.startsWith("..") || isAbsolute5(rel)) {
|
|
73779
|
-
throw new Error(`Symlink chain escapes base directory at depth ${depth}: ${
|
|
72125
|
+
throw new Error(`Symlink chain escapes base directory at depth ${depth}: ${path11}`);
|
|
73780
72126
|
}
|
|
73781
72127
|
current = normalizedTarget;
|
|
73782
72128
|
depth++;
|
|
@@ -73788,7 +72134,7 @@ async function validateSymlinkChain(path12, basePath, maxDepth = MAX_SYMLINK_DEP
|
|
|
73788
72134
|
}
|
|
73789
72135
|
}
|
|
73790
72136
|
if (depth >= maxDepth) {
|
|
73791
|
-
throw new Error(`Symlink chain too deep (>${maxDepth}): ${
|
|
72137
|
+
throw new Error(`Symlink chain too deep (>${maxDepth}): ${path11}`);
|
|
73792
72138
|
}
|
|
73793
72139
|
}
|
|
73794
72140
|
async function validateSyncPath(basePath, filePath) {
|
|
@@ -74014,7 +72360,7 @@ class SyncEngine {
|
|
|
74014
72360
|
}
|
|
74015
72361
|
// src/domains/sync/deletion-path-filter.ts
|
|
74016
72362
|
init_path_resolver();
|
|
74017
|
-
var
|
|
72363
|
+
var import_picomatch3 = __toESM(require_picomatch2(), 1);
|
|
74018
72364
|
function filterDeletionPaths(trackedFiles, deletions) {
|
|
74019
72365
|
if (!deletions || deletions.length === 0) {
|
|
74020
72366
|
return trackedFiles;
|
|
@@ -74023,7 +72369,7 @@ function filterDeletionPaths(trackedFiles, deletions) {
|
|
|
74023
72369
|
const globMatchers = [];
|
|
74024
72370
|
for (const pattern of deletions) {
|
|
74025
72371
|
if (PathResolver.isGlobPattern(pattern)) {
|
|
74026
|
-
globMatchers.push(
|
|
72372
|
+
globMatchers.push(import_picomatch3.default(pattern));
|
|
74027
72373
|
} else {
|
|
74028
72374
|
exactPaths.add(pattern);
|
|
74029
72375
|
}
|
|
@@ -74726,7 +73072,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
74726
73072
|
filesChanged += subResult.filesChanged;
|
|
74727
73073
|
replacementsCount += subResult.replacementsCount;
|
|
74728
73074
|
} else if (entry.isFile()) {
|
|
74729
|
-
const shouldTransform = TRANSFORMABLE_FILE_PATTERNS.some((
|
|
73075
|
+
const shouldTransform = TRANSFORMABLE_FILE_PATTERNS.some((ext) => entry.name.toLowerCase().endsWith(ext));
|
|
74730
73076
|
if (!shouldTransform)
|
|
74731
73077
|
continue;
|
|
74732
73078
|
try {
|
|
@@ -74942,9 +73288,9 @@ function transformContent(content) {
|
|
|
74942
73288
|
return { transformed, changes };
|
|
74943
73289
|
}
|
|
74944
73290
|
function shouldTransformFile3(filename) {
|
|
74945
|
-
const
|
|
73291
|
+
const ext = extname7(filename).toLowerCase();
|
|
74946
73292
|
const basename19 = filename.split("/").pop() || filename;
|
|
74947
|
-
return TRANSFORMABLE_EXTENSIONS3.has(
|
|
73293
|
+
return TRANSFORMABLE_EXTENSIONS3.has(ext) || ALWAYS_TRANSFORM_FILES.has(basename19);
|
|
74948
73294
|
}
|
|
74949
73295
|
async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
74950
73296
|
let filesTransformed = 0;
|
|
@@ -75367,8 +73713,8 @@ function parseHeaderAwareTable(content, dir, options2) {
|
|
|
75367
73713
|
function parseFormat1(content, dir, options2) {
|
|
75368
73714
|
const regex2 = /\|\s*(\d+)([a-z]?)\s*\|\s*([^|]+)\s*\|\s*([^|]+)\s*\|\s*\[([^\]]+)\]\(([^)]+)\)/gi;
|
|
75369
73715
|
const phases = [];
|
|
75370
|
-
for (const
|
|
75371
|
-
const [, num4, suffix, name, status2, linkText, linkPath] =
|
|
73716
|
+
for (const match of content.matchAll(regex2)) {
|
|
73717
|
+
const [, num4, suffix, name, status2, linkText, linkPath] = match;
|
|
75372
73718
|
const phaseId = `${num4}${suffix}`;
|
|
75373
73719
|
const anchor = options2?.generateAnchors ? buildAnchor(phaseId, name.trim()) : null;
|
|
75374
73720
|
phases.push({
|
|
@@ -75386,8 +73732,8 @@ function parseFormat1(content, dir, options2) {
|
|
|
75386
73732
|
function parseFormat2(content, dir, options2) {
|
|
75387
73733
|
const regex2 = /\|\s*\[(?:Phase\s*)?(\d+)([a-z]?)\]\(([^)]+)\)\s*\|\s*([^|]+)\s*\|\s*([^|]+)/gi;
|
|
75388
73734
|
const phases = [];
|
|
75389
|
-
for (const
|
|
75390
|
-
const [, num4, suffix, linkPath, name, status2] =
|
|
73735
|
+
for (const match of content.matchAll(regex2)) {
|
|
73736
|
+
const [, num4, suffix, linkPath, name, status2] = match;
|
|
75391
73737
|
const phaseId = `${num4}${suffix}`;
|
|
75392
73738
|
const linkText = `Phase ${phaseId}`;
|
|
75393
73739
|
const anchor = options2?.generateAnchors ? buildAnchor(phaseId, name.trim()) : null;
|
|
@@ -75406,8 +73752,8 @@ function parseFormat2(content, dir, options2) {
|
|
|
75406
73752
|
function parseFormat2b(content, dir, options2) {
|
|
75407
73753
|
const regex2 = /\|\s*(\d+)([a-z]?)\s*\|\s*\[([^\]]+)\]\(([^)]+)\)\s*\|\s*([^|]+)/gi;
|
|
75408
73754
|
const phases = [];
|
|
75409
|
-
for (const
|
|
75410
|
-
const [, num4, suffix, name, linkPath, status2] =
|
|
73755
|
+
for (const match of content.matchAll(regex2)) {
|
|
73756
|
+
const [, num4, suffix, name, linkPath, status2] = match;
|
|
75411
73757
|
const phaseId = `${num4}${suffix}`;
|
|
75412
73758
|
const anchor = options2?.generateAnchors ? buildAnchor(phaseId, name.trim()) : null;
|
|
75413
73759
|
phases.push({
|
|
@@ -75425,22 +73771,22 @@ function parseFormat2b(content, dir, options2) {
|
|
|
75425
73771
|
function parseFormat2c(content, _dir, options2) {
|
|
75426
73772
|
const phases = [];
|
|
75427
73773
|
const regex2 = /\|\s*(\d+)([a-z]?)\s*\|\s*([^|]+)\s*\|\s*([^|]+)\s*\|/gi;
|
|
75428
|
-
for (const
|
|
75429
|
-
const name =
|
|
73774
|
+
for (const match of content.matchAll(regex2)) {
|
|
73775
|
+
const name = match[3].trim();
|
|
75430
73776
|
if (name.includes("---") || name.includes("==="))
|
|
75431
73777
|
continue;
|
|
75432
|
-
if (Number.isNaN(Number.parseInt(
|
|
73778
|
+
if (Number.isNaN(Number.parseInt(match[1], 10)))
|
|
75433
73779
|
continue;
|
|
75434
73780
|
const nameText = name.toLowerCase();
|
|
75435
73781
|
if (["description", "name", "phase", "task"].includes(nameText))
|
|
75436
73782
|
continue;
|
|
75437
|
-
const phaseId = `${
|
|
73783
|
+
const phaseId = `${match[1]}${match[2]}`;
|
|
75438
73784
|
const anchor = options2?.generateAnchors ? buildAnchor(phaseId, name) : null;
|
|
75439
73785
|
phases.push({
|
|
75440
|
-
phase: Number.parseInt(
|
|
73786
|
+
phase: Number.parseInt(match[1], 10),
|
|
75441
73787
|
phaseId,
|
|
75442
73788
|
name,
|
|
75443
|
-
status: normalizeStatus(
|
|
73789
|
+
status: normalizeStatus(match[4]),
|
|
75444
73790
|
file: "",
|
|
75445
73791
|
linkText: name,
|
|
75446
73792
|
anchor
|
|
@@ -75537,8 +73883,8 @@ function parseFormat4(content, planFilePath, options2) {
|
|
|
75537
73883
|
function parseFormat5(content, _dir, options2) {
|
|
75538
73884
|
const phases = [];
|
|
75539
73885
|
const phaseMap = new Map;
|
|
75540
|
-
for (const
|
|
75541
|
-
const [, num4, suffix, name] =
|
|
73886
|
+
for (const match of content.matchAll(/^(\d+)([a-z]?)[).]\s*\*\*([^*]+)\*\*/gim)) {
|
|
73887
|
+
const [, num4, suffix, name] = match;
|
|
75542
73888
|
const phaseId = `${num4}${suffix}`;
|
|
75543
73889
|
const anchor = options2?.generateAnchors ? buildAnchor(phaseId, name.trim()) : null;
|
|
75544
73890
|
phaseMap.set(name.trim().toLowerCase(), {
|
|
@@ -75551,8 +73897,8 @@ function parseFormat5(content, _dir, options2) {
|
|
|
75551
73897
|
anchor
|
|
75552
73898
|
});
|
|
75553
73899
|
}
|
|
75554
|
-
for (const
|
|
75555
|
-
const [, checked, name] =
|
|
73900
|
+
for (const match of content.matchAll(/^-\s*\[(x| )\]\s*([^:\n]+)/gim)) {
|
|
73901
|
+
const [, checked, name] = match;
|
|
75556
73902
|
const entry = phaseMap.get(name.trim().toLowerCase());
|
|
75557
73903
|
if (entry)
|
|
75558
73904
|
entry.status = checked.toLowerCase() === "x" ? "completed" : "pending";
|
|
@@ -75570,8 +73916,8 @@ function parseFormat5(content, _dir, options2) {
|
|
|
75570
73916
|
function parseFormat6(content, dir, options2) {
|
|
75571
73917
|
const regex2 = /^-\s*\[(x| )\]\s*\*\*\[(?:Phase\s*)?(\d+)([a-z]?)[:\s]*([^\]]*)\]\(([^)]+)\)\*\*/gim;
|
|
75572
73918
|
const phases = [];
|
|
75573
|
-
for (const
|
|
75574
|
-
const [, checked, num4, suffix, name, linkPath] =
|
|
73919
|
+
for (const match of content.matchAll(regex2)) {
|
|
73920
|
+
const [, checked, num4, suffix, name, linkPath] = match;
|
|
75575
73921
|
const phaseId = `${num4}${suffix}`;
|
|
75576
73922
|
const phaseName = name.trim() || `Phase ${phaseId}`;
|
|
75577
73923
|
const anchor = options2?.generateAnchors ? buildAnchor(phaseId, phaseName) : null;
|
|
@@ -75656,8 +74002,8 @@ function validatePlanFile(filePath, strict = false) {
|
|
|
75656
74002
|
});
|
|
75657
74003
|
}
|
|
75658
74004
|
lines.forEach((line, i) => {
|
|
75659
|
-
const
|
|
75660
|
-
if (
|
|
74005
|
+
const match = /\[phase-\d+[a-z]?-[^\]]*\.md\]/i.exec(line);
|
|
74006
|
+
if (match) {
|
|
75661
74007
|
issues.push({
|
|
75662
74008
|
line: i + 1,
|
|
75663
74009
|
severity: "warning",
|
|
@@ -75912,8 +74258,8 @@ function addPhase(planFile, name, afterId) {
|
|
|
75912
74258
|
const { data: frontmatter, content: body } = import_gray_matter7.default(raw);
|
|
75913
74259
|
const planDir = dirname38(planFile);
|
|
75914
74260
|
const existingIds = [];
|
|
75915
|
-
for (const
|
|
75916
|
-
existingIds.push(
|
|
74261
|
+
for (const match of body.matchAll(/^\|\s*(\d+[a-z]?)\s*\|/gim)) {
|
|
74262
|
+
existingIds.push(match[1].toLowerCase());
|
|
75917
74263
|
}
|
|
75918
74264
|
let phaseId;
|
|
75919
74265
|
if (afterId) {
|
|
@@ -76632,7 +74978,7 @@ init_safe_prompts();
|
|
|
76632
74978
|
init_safe_spinner();
|
|
76633
74979
|
var import_fs_extra37 = __toESM(require_lib(), 1);
|
|
76634
74980
|
import { readdirSync as readdirSync13, rmSync as rmSync9 } from "node:fs";
|
|
76635
|
-
import { join as join131, resolve as resolve34, sep as
|
|
74981
|
+
import { join as join131, resolve as resolve34, sep as sep9 } from "node:path";
|
|
76636
74982
|
|
|
76637
74983
|
// src/commands/uninstall/analysis-handler.ts
|
|
76638
74984
|
init_metadata_migration();
|
|
@@ -76786,7 +75132,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
76786
75132
|
try {
|
|
76787
75133
|
const resolvedPath = resolve34(filePath);
|
|
76788
75134
|
const resolvedBase = resolve34(baseDir);
|
|
76789
|
-
if (!resolvedPath.startsWith(resolvedBase +
|
|
75135
|
+
if (!resolvedPath.startsWith(resolvedBase + sep9) && resolvedPath !== resolvedBase) {
|
|
76790
75136
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
76791
75137
|
return false;
|
|
76792
75138
|
}
|
|
@@ -76794,7 +75140,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
76794
75140
|
if (stats.isSymbolicLink()) {
|
|
76795
75141
|
const realPath = await import_fs_extra37.realpath(filePath);
|
|
76796
75142
|
const resolvedReal = resolve34(realPath);
|
|
76797
|
-
if (!resolvedReal.startsWith(resolvedBase +
|
|
75143
|
+
if (!resolvedReal.startsWith(resolvedBase + sep9) && resolvedReal !== resolvedBase) {
|
|
76798
75144
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
76799
75145
|
return false;
|
|
76800
75146
|
}
|
|
@@ -77094,8 +75440,8 @@ function isBetaVersion(version3) {
|
|
|
77094
75440
|
function parseCliVersionFromOutput(output2) {
|
|
77095
75441
|
if (!output2)
|
|
77096
75442
|
return null;
|
|
77097
|
-
const
|
|
77098
|
-
return
|
|
75443
|
+
const match = output2.match(/CLI Version:\s*(\S+)/);
|
|
75444
|
+
return match ? match[1] : null;
|
|
77099
75445
|
}
|
|
77100
75446
|
function selectKitForUpdate(params) {
|
|
77101
75447
|
const { hasLocal, hasGlobal, localKits, globalKits } = params;
|
|
@@ -77650,8 +75996,8 @@ function registerCommands(cli) {
|
|
|
77650
75996
|
cli.command("plan [action] [target]", "Plan management: parse, validate, status, kanban, create, check, uncheck, add-phase").option("--json", "Output in JSON format").option("--strict", "Strict validation mode").option("--title <title>", "Plan title (for create)").option("--phases <phases>", "Comma-separated phase names (for create)").option("--dir <dir>", "Plan directory (for create)").option("--priority <priority>", "Priority: P1, P2, P3 (for create)").option("--issue <issue>", "GitHub issue number (for create)").option("--after <after>", "Insert after phase ID (for add-phase)").option("--start", "Mark as in-progress instead of completed (for check)").action(async (action, target, options2) => {
|
|
77651
75997
|
await planCommand(action, target, options2);
|
|
77652
75998
|
});
|
|
77653
|
-
cli.command("api [action] [service] [path]", "Interact with Takumi API and proxy services").option("--method <method>", "HTTP method for proxy requests (default: GET)").option("--body <json>", "Request body as JSON string (proxy only)").option("--query <json>", "Query params as JSON string (proxy only)").option("--key <key>", "API key to use (setup only)").option("--force", "Force re-setup even if key exists (setup only)").option("--json", "Output raw JSON instead of formatted display").option("--locale <locale>", "Locale for vidcap summary/caption (default: en)").option("--max-results <n>", "Max results for vidcap search").option("--second <s>", "Timestamp in seconds for vidcap screenshot").option("--order <order>", "Sort order for vidcap comments (time/relevance)").option("--format <fmt>", "Summary format for reviewweb (bullet/paragraph)").option("--max-length <n>", "Max summary length for reviewweb").option("--instructions <text>", "Extraction instructions for reviewweb extract").option("--template <json>", "JSON template for reviewweb extract").option("--type <type>", "Link type filter for reviewweb links (web/image/file/all)").option("--country <code>", "Country code for reviewweb SEO commands").action(async (action, service,
|
|
77654
|
-
await apiCommand(action, service,
|
|
75999
|
+
cli.command("api [action] [service] [path]", "Interact with Takumi API and proxy services").option("--method <method>", "HTTP method for proxy requests (default: GET)").option("--body <json>", "Request body as JSON string (proxy only)").option("--query <json>", "Query params as JSON string (proxy only)").option("--key <key>", "API key to use (setup only)").option("--force", "Force re-setup even if key exists (setup only)").option("--json", "Output raw JSON instead of formatted display").option("--locale <locale>", "Locale for vidcap summary/caption (default: en)").option("--max-results <n>", "Max results for vidcap search").option("--second <s>", "Timestamp in seconds for vidcap screenshot").option("--order <order>", "Sort order for vidcap comments (time/relevance)").option("--format <fmt>", "Summary format for reviewweb (bullet/paragraph)").option("--max-length <n>", "Max summary length for reviewweb").option("--instructions <text>", "Extraction instructions for reviewweb extract").option("--template <json>", "JSON template for reviewweb extract").option("--type <type>", "Link type filter for reviewweb links (web/image/file/all)").option("--country <code>", "Country code for reviewweb SEO commands").action(async (action, service, path11, options2) => {
|
|
76000
|
+
await apiCommand(action, service, path11, options2);
|
|
77655
76001
|
});
|
|
77656
76002
|
cli.command("artifact [action] [target]", "Manage Takumi artifacts (upload <file> | download <uuid|url> | delete <uuid|url>)").option("--id <uuid|url>", "Existing artifact (UUID or viewer URL) to overwrite on upload").option("--title <title>", "Display title for the artifact (max 200 chars)").option("-m, --message <message>", "Short note describing this version's change (max 100 chars)").option("-o, --output <dir>", "(download) Output directory; default: slug(title) or uuid in CWD").option("-v, --version <n>", "(download) Download a specific version number").option("--force", "(download) Allow writing into a non-empty directory").option("-y, --yes", "Skip delete confirmation prompt").action(async (action, target, opts) => {
|
|
77657
76003
|
const version3 = opts.version !== undefined ? Number.parseInt(opts.version, 10) : undefined;
|
|
@@ -77878,18 +76224,18 @@ class Logger2 {
|
|
|
77878
76224
|
isVerbose() {
|
|
77879
76225
|
return this.verboseEnabled;
|
|
77880
76226
|
}
|
|
77881
|
-
setLogFile(
|
|
76227
|
+
setLogFile(path11) {
|
|
77882
76228
|
if (this.logFileStream) {
|
|
77883
76229
|
this.logFileStream.end();
|
|
77884
76230
|
this.logFileStream = undefined;
|
|
77885
76231
|
}
|
|
77886
|
-
if (
|
|
77887
|
-
this.logFileStream = createWriteStream4(
|
|
76232
|
+
if (path11) {
|
|
76233
|
+
this.logFileStream = createWriteStream4(path11, {
|
|
77888
76234
|
flags: "a",
|
|
77889
76235
|
mode: 384
|
|
77890
76236
|
});
|
|
77891
76237
|
this.registerExitHandler();
|
|
77892
|
-
this.verbose(`Logging to file: ${
|
|
76238
|
+
this.verbose(`Logging to file: ${path11}`);
|
|
77893
76239
|
}
|
|
77894
76240
|
}
|
|
77895
76241
|
close() {
|