@sunasteriskrnd/takumi 1.0.0-dev.4 → 1.0.0-dev.5

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.
Files changed (2) hide show
  1. package/dist/index.js +177 -2718
  2. package/package.json +4 -3
package/dist/index.js CHANGED
@@ -32445,2542 +32445,6 @@ var require_ignore = __commonJS((exports, module) => {
32445
32445
  }
32446
32446
  });
32447
32447
 
32448
- // node_modules/ms/index.js
32449
- var require_ms = __commonJS((exports, module) => {
32450
- var s3 = 1000;
32451
- var m3 = s3 * 60;
32452
- var h2 = m3 * 60;
32453
- var d3 = h2 * 24;
32454
- var w4 = d3 * 7;
32455
- var y4 = d3 * 365.25;
32456
- module.exports = function(val, options2) {
32457
- options2 = options2 || {};
32458
- var type = typeof val;
32459
- if (type === "string" && val.length > 0) {
32460
- return parse2(val);
32461
- } else if (type === "number" && isFinite(val)) {
32462
- return options2.long ? fmtLong(val) : fmtShort(val);
32463
- }
32464
- throw new Error("val is not a non-empty string or a valid number. val=" + JSON.stringify(val));
32465
- };
32466
- function parse2(str2) {
32467
- str2 = String(str2);
32468
- if (str2.length > 100) {
32469
- return;
32470
- }
32471
- var match = /^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(str2);
32472
- if (!match) {
32473
- return;
32474
- }
32475
- var n = parseFloat(match[1]);
32476
- var type = (match[2] || "ms").toLowerCase();
32477
- switch (type) {
32478
- case "years":
32479
- case "year":
32480
- case "yrs":
32481
- case "yr":
32482
- case "y":
32483
- return n * y4;
32484
- case "weeks":
32485
- case "week":
32486
- case "w":
32487
- return n * w4;
32488
- case "days":
32489
- case "day":
32490
- case "d":
32491
- return n * d3;
32492
- case "hours":
32493
- case "hour":
32494
- case "hrs":
32495
- case "hr":
32496
- case "h":
32497
- return n * h2;
32498
- case "minutes":
32499
- case "minute":
32500
- case "mins":
32501
- case "min":
32502
- case "m":
32503
- return n * m3;
32504
- case "seconds":
32505
- case "second":
32506
- case "secs":
32507
- case "sec":
32508
- case "s":
32509
- return n * s3;
32510
- case "milliseconds":
32511
- case "millisecond":
32512
- case "msecs":
32513
- case "msec":
32514
- case "ms":
32515
- return n;
32516
- default:
32517
- return;
32518
- }
32519
- }
32520
- function fmtShort(ms2) {
32521
- var msAbs = Math.abs(ms2);
32522
- if (msAbs >= d3) {
32523
- return Math.round(ms2 / d3) + "d";
32524
- }
32525
- if (msAbs >= h2) {
32526
- return Math.round(ms2 / h2) + "h";
32527
- }
32528
- if (msAbs >= m3) {
32529
- return Math.round(ms2 / m3) + "m";
32530
- }
32531
- if (msAbs >= s3) {
32532
- return Math.round(ms2 / s3) + "s";
32533
- }
32534
- return ms2 + "ms";
32535
- }
32536
- function fmtLong(ms2) {
32537
- var msAbs = Math.abs(ms2);
32538
- if (msAbs >= d3) {
32539
- return plural(ms2, msAbs, d3, "day");
32540
- }
32541
- if (msAbs >= h2) {
32542
- return plural(ms2, msAbs, h2, "hour");
32543
- }
32544
- if (msAbs >= m3) {
32545
- return plural(ms2, msAbs, m3, "minute");
32546
- }
32547
- if (msAbs >= s3) {
32548
- return plural(ms2, msAbs, s3, "second");
32549
- }
32550
- return ms2 + " ms";
32551
- }
32552
- function plural(ms2, msAbs, n, name) {
32553
- var isPlural = msAbs >= n * 1.5;
32554
- return Math.round(ms2 / n) + " " + name + (isPlural ? "s" : "");
32555
- }
32556
- });
32557
-
32558
- // node_modules/debug/src/common.js
32559
- var require_common2 = __commonJS((exports, module) => {
32560
- function setup(env2) {
32561
- createDebug.debug = createDebug;
32562
- createDebug.default = createDebug;
32563
- createDebug.coerce = coerce2;
32564
- createDebug.disable = disable;
32565
- createDebug.enable = enable;
32566
- createDebug.enabled = enabled;
32567
- createDebug.humanize = require_ms();
32568
- createDebug.destroy = destroy;
32569
- Object.keys(env2).forEach((key) => {
32570
- createDebug[key] = env2[key];
32571
- });
32572
- createDebug.names = [];
32573
- createDebug.skips = [];
32574
- createDebug.formatters = {};
32575
- function selectColor(namespace) {
32576
- let hash = 0;
32577
- for (let i = 0;i < namespace.length; i++) {
32578
- hash = (hash << 5) - hash + namespace.charCodeAt(i);
32579
- hash |= 0;
32580
- }
32581
- return createDebug.colors[Math.abs(hash) % createDebug.colors.length];
32582
- }
32583
- createDebug.selectColor = selectColor;
32584
- function createDebug(namespace) {
32585
- let prevTime;
32586
- let enableOverride = null;
32587
- let namespacesCache;
32588
- let enabledCache;
32589
- function debug(...args) {
32590
- if (!debug.enabled) {
32591
- return;
32592
- }
32593
- const self2 = debug;
32594
- const curr = Number(new Date);
32595
- const ms2 = curr - (prevTime || curr);
32596
- self2.diff = ms2;
32597
- self2.prev = prevTime;
32598
- self2.curr = curr;
32599
- prevTime = curr;
32600
- args[0] = createDebug.coerce(args[0]);
32601
- if (typeof args[0] !== "string") {
32602
- args.unshift("%O");
32603
- }
32604
- let index = 0;
32605
- args[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {
32606
- if (match === "%%") {
32607
- return "%";
32608
- }
32609
- index++;
32610
- const formatter = createDebug.formatters[format];
32611
- if (typeof formatter === "function") {
32612
- const val = args[index];
32613
- match = formatter.call(self2, val);
32614
- args.splice(index, 1);
32615
- index--;
32616
- }
32617
- return match;
32618
- });
32619
- createDebug.formatArgs.call(self2, args);
32620
- const logFn = self2.log || createDebug.log;
32621
- logFn.apply(self2, args);
32622
- }
32623
- debug.namespace = namespace;
32624
- debug.useColors = createDebug.useColors();
32625
- debug.color = createDebug.selectColor(namespace);
32626
- debug.extend = extend;
32627
- debug.destroy = createDebug.destroy;
32628
- Object.defineProperty(debug, "enabled", {
32629
- enumerable: true,
32630
- configurable: false,
32631
- get: () => {
32632
- if (enableOverride !== null) {
32633
- return enableOverride;
32634
- }
32635
- if (namespacesCache !== createDebug.namespaces) {
32636
- namespacesCache = createDebug.namespaces;
32637
- enabledCache = createDebug.enabled(namespace);
32638
- }
32639
- return enabledCache;
32640
- },
32641
- set: (v3) => {
32642
- enableOverride = v3;
32643
- }
32644
- });
32645
- if (typeof createDebug.init === "function") {
32646
- createDebug.init(debug);
32647
- }
32648
- return debug;
32649
- }
32650
- function extend(namespace, delimiter) {
32651
- const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
32652
- newDebug.log = this.log;
32653
- return newDebug;
32654
- }
32655
- function enable(namespaces) {
32656
- createDebug.save(namespaces);
32657
- createDebug.namespaces = namespaces;
32658
- createDebug.names = [];
32659
- createDebug.skips = [];
32660
- const split = (typeof namespaces === "string" ? namespaces : "").trim().replace(/\s+/g, ",").split(",").filter(Boolean);
32661
- for (const ns2 of split) {
32662
- if (ns2[0] === "-") {
32663
- createDebug.skips.push(ns2.slice(1));
32664
- } else {
32665
- createDebug.names.push(ns2);
32666
- }
32667
- }
32668
- }
32669
- function matchesTemplate(search, template) {
32670
- let searchIndex = 0;
32671
- let templateIndex = 0;
32672
- let starIndex = -1;
32673
- let matchIndex = 0;
32674
- while (searchIndex < search.length) {
32675
- if (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === "*")) {
32676
- if (template[templateIndex] === "*") {
32677
- starIndex = templateIndex;
32678
- matchIndex = searchIndex;
32679
- templateIndex++;
32680
- } else {
32681
- searchIndex++;
32682
- templateIndex++;
32683
- }
32684
- } else if (starIndex !== -1) {
32685
- templateIndex = starIndex + 1;
32686
- matchIndex++;
32687
- searchIndex = matchIndex;
32688
- } else {
32689
- return false;
32690
- }
32691
- }
32692
- while (templateIndex < template.length && template[templateIndex] === "*") {
32693
- templateIndex++;
32694
- }
32695
- return templateIndex === template.length;
32696
- }
32697
- function disable() {
32698
- const namespaces = [
32699
- ...createDebug.names,
32700
- ...createDebug.skips.map((namespace) => "-" + namespace)
32701
- ].join(",");
32702
- createDebug.enable("");
32703
- return namespaces;
32704
- }
32705
- function enabled(name) {
32706
- for (const skip of createDebug.skips) {
32707
- if (matchesTemplate(name, skip)) {
32708
- return false;
32709
- }
32710
- }
32711
- for (const ns2 of createDebug.names) {
32712
- if (matchesTemplate(name, ns2)) {
32713
- return true;
32714
- }
32715
- }
32716
- return false;
32717
- }
32718
- function coerce2(val) {
32719
- if (val instanceof Error) {
32720
- return val.stack || val.message;
32721
- }
32722
- return val;
32723
- }
32724
- function destroy() {
32725
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
32726
- }
32727
- createDebug.enable(createDebug.load());
32728
- return createDebug;
32729
- }
32730
- module.exports = setup;
32731
- });
32732
-
32733
- // node_modules/debug/src/browser.js
32734
- var require_browser = __commonJS((exports, module) => {
32735
- exports.formatArgs = formatArgs;
32736
- exports.save = save;
32737
- exports.load = load2;
32738
- exports.useColors = useColors;
32739
- exports.storage = localstorage();
32740
- exports.destroy = (() => {
32741
- let warned = false;
32742
- return () => {
32743
- if (!warned) {
32744
- warned = true;
32745
- console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
32746
- }
32747
- };
32748
- })();
32749
- exports.colors = [
32750
- "#0000CC",
32751
- "#0000FF",
32752
- "#0033CC",
32753
- "#0033FF",
32754
- "#0066CC",
32755
- "#0066FF",
32756
- "#0099CC",
32757
- "#0099FF",
32758
- "#00CC00",
32759
- "#00CC33",
32760
- "#00CC66",
32761
- "#00CC99",
32762
- "#00CCCC",
32763
- "#00CCFF",
32764
- "#3300CC",
32765
- "#3300FF",
32766
- "#3333CC",
32767
- "#3333FF",
32768
- "#3366CC",
32769
- "#3366FF",
32770
- "#3399CC",
32771
- "#3399FF",
32772
- "#33CC00",
32773
- "#33CC33",
32774
- "#33CC66",
32775
- "#33CC99",
32776
- "#33CCCC",
32777
- "#33CCFF",
32778
- "#6600CC",
32779
- "#6600FF",
32780
- "#6633CC",
32781
- "#6633FF",
32782
- "#66CC00",
32783
- "#66CC33",
32784
- "#9900CC",
32785
- "#9900FF",
32786
- "#9933CC",
32787
- "#9933FF",
32788
- "#99CC00",
32789
- "#99CC33",
32790
- "#CC0000",
32791
- "#CC0033",
32792
- "#CC0066",
32793
- "#CC0099",
32794
- "#CC00CC",
32795
- "#CC00FF",
32796
- "#CC3300",
32797
- "#CC3333",
32798
- "#CC3366",
32799
- "#CC3399",
32800
- "#CC33CC",
32801
- "#CC33FF",
32802
- "#CC6600",
32803
- "#CC6633",
32804
- "#CC9900",
32805
- "#CC9933",
32806
- "#CCCC00",
32807
- "#CCCC33",
32808
- "#FF0000",
32809
- "#FF0033",
32810
- "#FF0066",
32811
- "#FF0099",
32812
- "#FF00CC",
32813
- "#FF00FF",
32814
- "#FF3300",
32815
- "#FF3333",
32816
- "#FF3366",
32817
- "#FF3399",
32818
- "#FF33CC",
32819
- "#FF33FF",
32820
- "#FF6600",
32821
- "#FF6633",
32822
- "#FF9900",
32823
- "#FF9933",
32824
- "#FFCC00",
32825
- "#FFCC33"
32826
- ];
32827
- function useColors() {
32828
- if (typeof window !== "undefined" && window.process && (window.process.type === "renderer" || window.process.__nwjs)) {
32829
- return true;
32830
- }
32831
- if (typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)) {
32832
- return false;
32833
- }
32834
- let m3;
32835
- return typeof document !== "undefined" && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== "undefined" && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== "undefined" && navigator.userAgent && (m3 = navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)) && parseInt(m3[1], 10) >= 31 || typeof navigator !== "undefined" && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/);
32836
- }
32837
- function formatArgs(args) {
32838
- args[0] = (this.useColors ? "%c" : "") + this.namespace + (this.useColors ? " %c" : " ") + args[0] + (this.useColors ? "%c " : " ") + "+" + module.exports.humanize(this.diff);
32839
- if (!this.useColors) {
32840
- return;
32841
- }
32842
- const c2 = "color: " + this.color;
32843
- args.splice(1, 0, c2, "color: inherit");
32844
- let index = 0;
32845
- let lastC = 0;
32846
- args[0].replace(/%[a-zA-Z%]/g, (match) => {
32847
- if (match === "%%") {
32848
- return;
32849
- }
32850
- index++;
32851
- if (match === "%c") {
32852
- lastC = index;
32853
- }
32854
- });
32855
- args.splice(lastC, 0, c2);
32856
- }
32857
- exports.log = console.debug || console.log || (() => {});
32858
- function save(namespaces) {
32859
- try {
32860
- if (namespaces) {
32861
- exports.storage.setItem("debug", namespaces);
32862
- } else {
32863
- exports.storage.removeItem("debug");
32864
- }
32865
- } catch (error) {}
32866
- }
32867
- function load2() {
32868
- let r2;
32869
- try {
32870
- r2 = exports.storage.getItem("debug") || exports.storage.getItem("DEBUG");
32871
- } catch (error) {}
32872
- if (!r2 && typeof process !== "undefined" && "env" in process) {
32873
- r2 = process.env.DEBUG;
32874
- }
32875
- return r2;
32876
- }
32877
- function localstorage() {
32878
- try {
32879
- return localStorage;
32880
- } catch (error) {}
32881
- }
32882
- module.exports = require_common2()(exports);
32883
- var { formatters } = module.exports;
32884
- formatters.j = function(v3) {
32885
- try {
32886
- return JSON.stringify(v3);
32887
- } catch (error) {
32888
- return "[UnexpectedJSONParseError]: " + error.message;
32889
- }
32890
- };
32891
- });
32892
-
32893
- // node_modules/has-flag/index.js
32894
- var require_has_flag = __commonJS((exports, module) => {
32895
- module.exports = (flag, argv = process.argv) => {
32896
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
32897
- const position = argv.indexOf(prefix + flag);
32898
- const terminatorPosition = argv.indexOf("--");
32899
- return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
32900
- };
32901
- });
32902
-
32903
- // node_modules/supports-color/index.js
32904
- var require_supports_color = __commonJS((exports, module) => {
32905
- var os6 = __require("os");
32906
- var tty2 = __require("tty");
32907
- var hasFlag2 = require_has_flag();
32908
- var { env: env2 } = process;
32909
- var forceColor;
32910
- if (hasFlag2("no-color") || hasFlag2("no-colors") || hasFlag2("color=false") || hasFlag2("color=never")) {
32911
- forceColor = 0;
32912
- } else if (hasFlag2("color") || hasFlag2("colors") || hasFlag2("color=true") || hasFlag2("color=always")) {
32913
- forceColor = 1;
32914
- }
32915
- if ("FORCE_COLOR" in env2) {
32916
- if (env2.FORCE_COLOR === "true") {
32917
- forceColor = 1;
32918
- } else if (env2.FORCE_COLOR === "false") {
32919
- forceColor = 0;
32920
- } else {
32921
- forceColor = env2.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env2.FORCE_COLOR, 10), 3);
32922
- }
32923
- }
32924
- function translateLevel2(level) {
32925
- if (level === 0) {
32926
- return false;
32927
- }
32928
- return {
32929
- level,
32930
- hasBasic: true,
32931
- has256: level >= 2,
32932
- has16m: level >= 3
32933
- };
32934
- }
32935
- function supportsColor2(haveStream, streamIsTTY) {
32936
- if (forceColor === 0) {
32937
- return 0;
32938
- }
32939
- if (hasFlag2("color=16m") || hasFlag2("color=full") || hasFlag2("color=truecolor")) {
32940
- return 3;
32941
- }
32942
- if (hasFlag2("color=256")) {
32943
- return 2;
32944
- }
32945
- if (haveStream && !streamIsTTY && forceColor === undefined) {
32946
- return 0;
32947
- }
32948
- const min = forceColor || 0;
32949
- if (env2.TERM === "dumb") {
32950
- return min;
32951
- }
32952
- if (process.platform === "win32") {
32953
- const osRelease = os6.release().split(".");
32954
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
32955
- return Number(osRelease[2]) >= 14931 ? 3 : 2;
32956
- }
32957
- return 1;
32958
- }
32959
- if ("CI" in env2) {
32960
- if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => (sign in env2)) || env2.CI_NAME === "codeship") {
32961
- return 1;
32962
- }
32963
- return min;
32964
- }
32965
- if ("TEAMCITY_VERSION" in env2) {
32966
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env2.TEAMCITY_VERSION) ? 1 : 0;
32967
- }
32968
- if (env2.COLORTERM === "truecolor") {
32969
- return 3;
32970
- }
32971
- if ("TERM_PROGRAM" in env2) {
32972
- const version3 = parseInt((env2.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
32973
- switch (env2.TERM_PROGRAM) {
32974
- case "iTerm.app":
32975
- return version3 >= 3 ? 3 : 2;
32976
- case "Apple_Terminal":
32977
- return 2;
32978
- }
32979
- }
32980
- if (/-256(color)?$/i.test(env2.TERM)) {
32981
- return 2;
32982
- }
32983
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env2.TERM)) {
32984
- return 1;
32985
- }
32986
- if ("COLORTERM" in env2) {
32987
- return 1;
32988
- }
32989
- return min;
32990
- }
32991
- function getSupportLevel(stream) {
32992
- const level = supportsColor2(stream, stream && stream.isTTY);
32993
- return translateLevel2(level);
32994
- }
32995
- module.exports = {
32996
- supportsColor: getSupportLevel,
32997
- stdout: translateLevel2(supportsColor2(true, tty2.isatty(1))),
32998
- stderr: translateLevel2(supportsColor2(true, tty2.isatty(2)))
32999
- };
33000
- });
33001
-
33002
- // node_modules/debug/src/node.js
33003
- var require_node = __commonJS((exports, module) => {
33004
- var tty2 = __require("tty");
33005
- var util3 = __require("util");
33006
- exports.init = init;
33007
- exports.log = log2;
33008
- exports.formatArgs = formatArgs;
33009
- exports.save = save;
33010
- exports.load = load2;
33011
- exports.useColors = useColors;
33012
- exports.destroy = util3.deprecate(() => {}, "Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.");
33013
- exports.colors = [6, 2, 3, 4, 5, 1];
33014
- try {
33015
- const supportsColor2 = require_supports_color();
33016
- if (supportsColor2 && (supportsColor2.stderr || supportsColor2).level >= 2) {
33017
- exports.colors = [
33018
- 20,
33019
- 21,
33020
- 26,
33021
- 27,
33022
- 32,
33023
- 33,
33024
- 38,
33025
- 39,
33026
- 40,
33027
- 41,
33028
- 42,
33029
- 43,
33030
- 44,
33031
- 45,
33032
- 56,
33033
- 57,
33034
- 62,
33035
- 63,
33036
- 68,
33037
- 69,
33038
- 74,
33039
- 75,
33040
- 76,
33041
- 77,
33042
- 78,
33043
- 79,
33044
- 80,
33045
- 81,
33046
- 92,
33047
- 93,
33048
- 98,
33049
- 99,
33050
- 112,
33051
- 113,
33052
- 128,
33053
- 129,
33054
- 134,
33055
- 135,
33056
- 148,
33057
- 149,
33058
- 160,
33059
- 161,
33060
- 162,
33061
- 163,
33062
- 164,
33063
- 165,
33064
- 166,
33065
- 167,
33066
- 168,
33067
- 169,
33068
- 170,
33069
- 171,
33070
- 172,
33071
- 173,
33072
- 178,
33073
- 179,
33074
- 184,
33075
- 185,
33076
- 196,
33077
- 197,
33078
- 198,
33079
- 199,
33080
- 200,
33081
- 201,
33082
- 202,
33083
- 203,
33084
- 204,
33085
- 205,
33086
- 206,
33087
- 207,
33088
- 208,
33089
- 209,
33090
- 214,
33091
- 215,
33092
- 220,
33093
- 221
33094
- ];
33095
- }
33096
- } catch (error) {}
33097
- exports.inspectOpts = Object.keys(process.env).filter((key) => {
33098
- return /^debug_/i.test(key);
33099
- }).reduce((obj, key) => {
33100
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_4, k3) => {
33101
- return k3.toUpperCase();
33102
- });
33103
- let val = process.env[key];
33104
- if (/^(yes|on|true|enabled)$/i.test(val)) {
33105
- val = true;
33106
- } else if (/^(no|off|false|disabled)$/i.test(val)) {
33107
- val = false;
33108
- } else if (val === "null") {
33109
- val = null;
33110
- } else {
33111
- val = Number(val);
33112
- }
33113
- obj[prop] = val;
33114
- return obj;
33115
- }, {});
33116
- function useColors() {
33117
- return "colors" in exports.inspectOpts ? Boolean(exports.inspectOpts.colors) : tty2.isatty(process.stderr.fd);
33118
- }
33119
- function formatArgs(args) {
33120
- const { namespace: name, useColors: useColors2 } = this;
33121
- if (useColors2) {
33122
- const c2 = this.color;
33123
- const colorCode = "\x1B[3" + (c2 < 8 ? c2 : "8;5;" + c2);
33124
- const prefix = ` ${colorCode};1m${name} \x1B[0m`;
33125
- args[0] = prefix + args[0].split(`
33126
- `).join(`
33127
- ` + prefix);
33128
- args.push(colorCode + "m+" + module.exports.humanize(this.diff) + "\x1B[0m");
33129
- } else {
33130
- args[0] = getDate() + name + " " + args[0];
33131
- }
33132
- }
33133
- function getDate() {
33134
- if (exports.inspectOpts.hideDate) {
33135
- return "";
33136
- }
33137
- return new Date().toISOString() + " ";
33138
- }
33139
- function log2(...args) {
33140
- return process.stderr.write(util3.formatWithOptions(exports.inspectOpts, ...args) + `
33141
- `);
33142
- }
33143
- function save(namespaces) {
33144
- if (namespaces) {
33145
- process.env.DEBUG = namespaces;
33146
- } else {
33147
- delete process.env.DEBUG;
33148
- }
33149
- }
33150
- function load2() {
33151
- return process.env.DEBUG;
33152
- }
33153
- function init(debug) {
33154
- debug.inspectOpts = {};
33155
- const keys = Object.keys(exports.inspectOpts);
33156
- for (let i = 0;i < keys.length; i++) {
33157
- debug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];
33158
- }
33159
- }
33160
- module.exports = require_common2()(exports);
33161
- var { formatters } = module.exports;
33162
- formatters.o = function(v3) {
33163
- this.inspectOpts.colors = this.useColors;
33164
- return util3.inspect(v3, this.inspectOpts).split(`
33165
- `).map((str2) => str2.trim()).join(" ");
33166
- };
33167
- formatters.O = function(v3) {
33168
- this.inspectOpts.colors = this.useColors;
33169
- return util3.inspect(v3, this.inspectOpts);
33170
- };
33171
- });
33172
-
33173
- // node_modules/debug/src/index.js
33174
- var require_src2 = __commonJS((exports, module) => {
33175
- if (typeof process === "undefined" || process.type === "renderer" || false || process.__nwjs) {
33176
- module.exports = require_browser();
33177
- } else {
33178
- module.exports = require_node();
33179
- }
33180
- });
33181
-
33182
- // node_modules/wrappy/wrappy.js
33183
- var require_wrappy = __commonJS((exports, module) => {
33184
- module.exports = wrappy;
33185
- function wrappy(fn2, cb) {
33186
- if (fn2 && cb)
33187
- return wrappy(fn2)(cb);
33188
- if (typeof fn2 !== "function")
33189
- throw new TypeError("need wrapper function");
33190
- Object.keys(fn2).forEach(function(k3) {
33191
- wrapper[k3] = fn2[k3];
33192
- });
33193
- return wrapper;
33194
- function wrapper() {
33195
- var args = new Array(arguments.length);
33196
- for (var i = 0;i < args.length; i++) {
33197
- args[i] = arguments[i];
33198
- }
33199
- var ret = fn2.apply(this, args);
33200
- var cb2 = args[args.length - 1];
33201
- if (typeof ret === "function" && ret !== cb2) {
33202
- Object.keys(cb2).forEach(function(k3) {
33203
- ret[k3] = cb2[k3];
33204
- });
33205
- }
33206
- return ret;
33207
- }
33208
- }
33209
- });
33210
-
33211
- // node_modules/once/once.js
33212
- var require_once = __commonJS((exports, module) => {
33213
- var wrappy = require_wrappy();
33214
- module.exports = wrappy(once);
33215
- module.exports.strict = wrappy(onceStrict);
33216
- once.proto = once(function() {
33217
- Object.defineProperty(Function.prototype, "once", {
33218
- value: function() {
33219
- return once(this);
33220
- },
33221
- configurable: true
33222
- });
33223
- Object.defineProperty(Function.prototype, "onceStrict", {
33224
- value: function() {
33225
- return onceStrict(this);
33226
- },
33227
- configurable: true
33228
- });
33229
- });
33230
- function once(fn2) {
33231
- var f4 = function() {
33232
- if (f4.called)
33233
- return f4.value;
33234
- f4.called = true;
33235
- return f4.value = fn2.apply(this, arguments);
33236
- };
33237
- f4.called = false;
33238
- return f4;
33239
- }
33240
- function onceStrict(fn2) {
33241
- var f4 = function() {
33242
- if (f4.called)
33243
- throw new Error(f4.onceError);
33244
- f4.called = true;
33245
- return f4.value = fn2.apply(this, arguments);
33246
- };
33247
- var name = fn2.name || "Function wrapped with `once`";
33248
- f4.onceError = name + " shouldn't be called more than once";
33249
- f4.called = false;
33250
- return f4;
33251
- }
33252
- });
33253
-
33254
- // node_modules/end-of-stream/index.js
33255
- var require_end_of_stream = __commonJS((exports, module) => {
33256
- var once = require_once();
33257
- var noop = function() {};
33258
- var qnt = global.Bare ? queueMicrotask : process.nextTick.bind(process);
33259
- var isRequest = function(stream) {
33260
- return stream.setHeader && typeof stream.abort === "function";
33261
- };
33262
- var isChildProcess = function(stream) {
33263
- return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3;
33264
- };
33265
- var eos = function(stream, opts, callback) {
33266
- if (typeof opts === "function")
33267
- return eos(stream, null, opts);
33268
- if (!opts)
33269
- opts = {};
33270
- callback = once(callback || noop);
33271
- var ws2 = stream._writableState;
33272
- var rs2 = stream._readableState;
33273
- var readable = opts.readable || opts.readable !== false && stream.readable;
33274
- var writable = opts.writable || opts.writable !== false && stream.writable;
33275
- var cancelled = false;
33276
- var onlegacyfinish = function() {
33277
- if (!stream.writable)
33278
- onfinish();
33279
- };
33280
- var onfinish = function() {
33281
- writable = false;
33282
- if (!readable)
33283
- callback.call(stream);
33284
- };
33285
- var onend = function() {
33286
- readable = false;
33287
- if (!writable)
33288
- callback.call(stream);
33289
- };
33290
- var onexit = function(exitCode) {
33291
- callback.call(stream, exitCode ? new Error("exited with error code: " + exitCode) : null);
33292
- };
33293
- var onerror = function(err) {
33294
- callback.call(stream, err);
33295
- };
33296
- var onclose = function() {
33297
- qnt(onclosenexttick);
33298
- };
33299
- var onclosenexttick = function() {
33300
- if (cancelled)
33301
- return;
33302
- if (readable && !(rs2 && (rs2.ended && !rs2.destroyed)))
33303
- return callback.call(stream, new Error("premature close"));
33304
- if (writable && !(ws2 && (ws2.ended && !ws2.destroyed)))
33305
- return callback.call(stream, new Error("premature close"));
33306
- };
33307
- var onrequest = function() {
33308
- stream.req.on("finish", onfinish);
33309
- };
33310
- if (isRequest(stream)) {
33311
- stream.on("complete", onfinish);
33312
- stream.on("abort", onclose);
33313
- if (stream.req)
33314
- onrequest();
33315
- else
33316
- stream.on("request", onrequest);
33317
- } else if (writable && !ws2) {
33318
- stream.on("end", onlegacyfinish);
33319
- stream.on("close", onlegacyfinish);
33320
- }
33321
- if (isChildProcess(stream))
33322
- stream.on("exit", onexit);
33323
- stream.on("end", onend);
33324
- stream.on("finish", onfinish);
33325
- if (opts.error !== false)
33326
- stream.on("error", onerror);
33327
- stream.on("close", onclose);
33328
- return function() {
33329
- cancelled = true;
33330
- stream.removeListener("complete", onfinish);
33331
- stream.removeListener("abort", onclose);
33332
- stream.removeListener("request", onrequest);
33333
- if (stream.req)
33334
- stream.req.removeListener("finish", onfinish);
33335
- stream.removeListener("end", onlegacyfinish);
33336
- stream.removeListener("close", onlegacyfinish);
33337
- stream.removeListener("finish", onfinish);
33338
- stream.removeListener("exit", onexit);
33339
- stream.removeListener("end", onend);
33340
- stream.removeListener("error", onerror);
33341
- stream.removeListener("close", onclose);
33342
- };
33343
- };
33344
- module.exports = eos;
33345
- });
33346
-
33347
- // node_modules/pump/index.js
33348
- var require_pump = __commonJS((exports, module) => {
33349
- var once = require_once();
33350
- var eos = require_end_of_stream();
33351
- var fs11;
33352
- try {
33353
- fs11 = __require("fs");
33354
- } catch (e2) {}
33355
- var noop = function() {};
33356
- var ancient = typeof process === "undefined" ? false : /^v?\.0/.test(process.version);
33357
- var isFn = function(fn2) {
33358
- return typeof fn2 === "function";
33359
- };
33360
- var isFS = function(stream) {
33361
- if (!ancient)
33362
- return false;
33363
- if (!fs11)
33364
- return false;
33365
- return (stream instanceof (fs11.ReadStream || noop) || stream instanceof (fs11.WriteStream || noop)) && isFn(stream.close);
33366
- };
33367
- var isRequest = function(stream) {
33368
- return stream.setHeader && isFn(stream.abort);
33369
- };
33370
- var destroyer = function(stream, reading, writing, callback) {
33371
- callback = once(callback);
33372
- var closed = false;
33373
- stream.on("close", function() {
33374
- closed = true;
33375
- });
33376
- eos(stream, { readable: reading, writable: writing }, function(err) {
33377
- if (err)
33378
- return callback(err);
33379
- closed = true;
33380
- callback();
33381
- });
33382
- var destroyed = false;
33383
- return function(err) {
33384
- if (closed)
33385
- return;
33386
- if (destroyed)
33387
- return;
33388
- destroyed = true;
33389
- if (isFS(stream))
33390
- return stream.close(noop);
33391
- if (isRequest(stream))
33392
- return stream.abort();
33393
- if (isFn(stream.destroy))
33394
- return stream.destroy();
33395
- callback(err || new Error("stream was destroyed"));
33396
- };
33397
- };
33398
- var call = function(fn2) {
33399
- fn2();
33400
- };
33401
- var pipe = function(from, to2) {
33402
- return from.pipe(to2);
33403
- };
33404
- var pump = function() {
33405
- var streams = Array.prototype.slice.call(arguments);
33406
- var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop;
33407
- if (Array.isArray(streams[0]))
33408
- streams = streams[0];
33409
- if (streams.length < 2)
33410
- throw new Error("pump requires two streams per minimum");
33411
- var error;
33412
- var destroys = streams.map(function(stream, i) {
33413
- var reading = i < streams.length - 1;
33414
- var writing = i > 0;
33415
- return destroyer(stream, reading, writing, function(err) {
33416
- if (!error)
33417
- error = err;
33418
- if (err)
33419
- destroys.forEach(call);
33420
- if (reading)
33421
- return;
33422
- destroys.forEach(call);
33423
- callback(error);
33424
- });
33425
- });
33426
- return streams.reduce(pipe);
33427
- };
33428
- module.exports = pump;
33429
- });
33430
-
33431
- // node_modules/extract-zip/node_modules/get-stream/buffer-stream.js
33432
- var require_buffer_stream = __commonJS((exports, module) => {
33433
- var { PassThrough: PassThroughStream } = __require("stream");
33434
- module.exports = (options2) => {
33435
- options2 = { ...options2 };
33436
- const { array } = options2;
33437
- let { encoding } = options2;
33438
- const isBuffer = encoding === "buffer";
33439
- let objectMode = false;
33440
- if (array) {
33441
- objectMode = !(encoding || isBuffer);
33442
- } else {
33443
- encoding = encoding || "utf8";
33444
- }
33445
- if (isBuffer) {
33446
- encoding = null;
33447
- }
33448
- const stream = new PassThroughStream({ objectMode });
33449
- if (encoding) {
33450
- stream.setEncoding(encoding);
33451
- }
33452
- let length = 0;
33453
- const chunks = [];
33454
- stream.on("data", (chunk) => {
33455
- chunks.push(chunk);
33456
- if (objectMode) {
33457
- length = chunks.length;
33458
- } else {
33459
- length += chunk.length;
33460
- }
33461
- });
33462
- stream.getBufferedValue = () => {
33463
- if (array) {
33464
- return chunks;
33465
- }
33466
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
33467
- };
33468
- stream.getBufferedLength = () => length;
33469
- return stream;
33470
- };
33471
- });
33472
-
33473
- // node_modules/extract-zip/node_modules/get-stream/index.js
33474
- var require_get_stream = __commonJS((exports, module) => {
33475
- var { constants: BufferConstants } = __require("buffer");
33476
- var pump = require_pump();
33477
- var bufferStream = require_buffer_stream();
33478
-
33479
- class MaxBufferError extends Error {
33480
- constructor() {
33481
- super("maxBuffer exceeded");
33482
- this.name = "MaxBufferError";
33483
- }
33484
- }
33485
- async function getStream(inputStream, options2) {
33486
- if (!inputStream) {
33487
- return Promise.reject(new Error("Expected a stream"));
33488
- }
33489
- options2 = {
33490
- maxBuffer: Infinity,
33491
- ...options2
33492
- };
33493
- const { maxBuffer } = options2;
33494
- let stream;
33495
- await new Promise((resolve7, reject) => {
33496
- const rejectPromise = (error) => {
33497
- if (error && stream.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
33498
- error.bufferedData = stream.getBufferedValue();
33499
- }
33500
- reject(error);
33501
- };
33502
- stream = pump(inputStream, bufferStream(options2), (error) => {
33503
- if (error) {
33504
- rejectPromise(error);
33505
- return;
33506
- }
33507
- resolve7();
33508
- });
33509
- stream.on("data", () => {
33510
- if (stream.getBufferedLength() > maxBuffer) {
33511
- rejectPromise(new MaxBufferError);
33512
- }
33513
- });
33514
- });
33515
- return stream.getBufferedValue();
33516
- }
33517
- module.exports = getStream;
33518
- module.exports.default = getStream;
33519
- module.exports.buffer = (stream, options2) => getStream(stream, { ...options2, encoding: "buffer" });
33520
- module.exports.array = (stream, options2) => getStream(stream, { ...options2, array: true });
33521
- module.exports.MaxBufferError = MaxBufferError;
33522
- });
33523
-
33524
- // node_modules/pend/index.js
33525
- var require_pend = __commonJS((exports, module) => {
33526
- module.exports = Pend;
33527
- function Pend() {
33528
- this.pending = 0;
33529
- this.max = Infinity;
33530
- this.listeners = [];
33531
- this.waiting = [];
33532
- this.error = null;
33533
- }
33534
- Pend.prototype.go = function(fn2) {
33535
- if (this.pending < this.max) {
33536
- pendGo(this, fn2);
33537
- } else {
33538
- this.waiting.push(fn2);
33539
- }
33540
- };
33541
- Pend.prototype.wait = function(cb) {
33542
- if (this.pending === 0) {
33543
- cb(this.error);
33544
- } else {
33545
- this.listeners.push(cb);
33546
- }
33547
- };
33548
- Pend.prototype.hold = function() {
33549
- return pendHold(this);
33550
- };
33551
- function pendHold(self2) {
33552
- self2.pending += 1;
33553
- var called = false;
33554
- return onCb;
33555
- function onCb(err) {
33556
- if (called)
33557
- throw new Error("callback called twice");
33558
- called = true;
33559
- self2.error = self2.error || err;
33560
- self2.pending -= 1;
33561
- if (self2.waiting.length > 0 && self2.pending < self2.max) {
33562
- pendGo(self2, self2.waiting.shift());
33563
- } else if (self2.pending === 0) {
33564
- var listeners = self2.listeners;
33565
- self2.listeners = [];
33566
- listeners.forEach(cbListener);
33567
- }
33568
- }
33569
- function cbListener(listener) {
33570
- listener(self2.error);
33571
- }
33572
- }
33573
- function pendGo(self2, fn2) {
33574
- fn2(pendHold(self2));
33575
- }
33576
- });
33577
-
33578
- // node_modules/fd-slicer/index.js
33579
- var require_fd_slicer = __commonJS((exports) => {
33580
- var fs11 = __require("fs");
33581
- var util3 = __require("util");
33582
- var stream = __require("stream");
33583
- var Readable = stream.Readable;
33584
- var Writable = stream.Writable;
33585
- var PassThrough = stream.PassThrough;
33586
- var Pend = require_pend();
33587
- var EventEmitter2 = __require("events").EventEmitter;
33588
- exports.createFromBuffer = createFromBuffer;
33589
- exports.createFromFd = createFromFd;
33590
- exports.BufferSlicer = BufferSlicer;
33591
- exports.FdSlicer = FdSlicer;
33592
- util3.inherits(FdSlicer, EventEmitter2);
33593
- function FdSlicer(fd, options2) {
33594
- options2 = options2 || {};
33595
- EventEmitter2.call(this);
33596
- this.fd = fd;
33597
- this.pend = new Pend;
33598
- this.pend.max = 1;
33599
- this.refCount = 0;
33600
- this.autoClose = !!options2.autoClose;
33601
- }
33602
- FdSlicer.prototype.read = function(buffer, offset, length, position, callback) {
33603
- var self2 = this;
33604
- self2.pend.go(function(cb) {
33605
- fs11.read(self2.fd, buffer, offset, length, position, function(err, bytesRead, buffer2) {
33606
- cb();
33607
- callback(err, bytesRead, buffer2);
33608
- });
33609
- });
33610
- };
33611
- FdSlicer.prototype.write = function(buffer, offset, length, position, callback) {
33612
- var self2 = this;
33613
- self2.pend.go(function(cb) {
33614
- fs11.write(self2.fd, buffer, offset, length, position, function(err, written, buffer2) {
33615
- cb();
33616
- callback(err, written, buffer2);
33617
- });
33618
- });
33619
- };
33620
- FdSlicer.prototype.createReadStream = function(options2) {
33621
- return new ReadStream(this, options2);
33622
- };
33623
- FdSlicer.prototype.createWriteStream = function(options2) {
33624
- return new WriteStream(this, options2);
33625
- };
33626
- FdSlicer.prototype.ref = function() {
33627
- this.refCount += 1;
33628
- };
33629
- FdSlicer.prototype.unref = function() {
33630
- var self2 = this;
33631
- self2.refCount -= 1;
33632
- if (self2.refCount > 0)
33633
- return;
33634
- if (self2.refCount < 0)
33635
- throw new Error("invalid unref");
33636
- if (self2.autoClose) {
33637
- fs11.close(self2.fd, onCloseDone);
33638
- }
33639
- function onCloseDone(err) {
33640
- if (err) {
33641
- self2.emit("error", err);
33642
- } else {
33643
- self2.emit("close");
33644
- }
33645
- }
33646
- };
33647
- util3.inherits(ReadStream, Readable);
33648
- function ReadStream(context, options2) {
33649
- options2 = options2 || {};
33650
- Readable.call(this, options2);
33651
- this.context = context;
33652
- this.context.ref();
33653
- this.start = options2.start || 0;
33654
- this.endOffset = options2.end;
33655
- this.pos = this.start;
33656
- this.destroyed = false;
33657
- }
33658
- ReadStream.prototype._read = function(n) {
33659
- var self2 = this;
33660
- if (self2.destroyed)
33661
- return;
33662
- var toRead = Math.min(self2._readableState.highWaterMark, n);
33663
- if (self2.endOffset != null) {
33664
- toRead = Math.min(toRead, self2.endOffset - self2.pos);
33665
- }
33666
- if (toRead <= 0) {
33667
- self2.destroyed = true;
33668
- self2.push(null);
33669
- self2.context.unref();
33670
- return;
33671
- }
33672
- self2.context.pend.go(function(cb) {
33673
- if (self2.destroyed)
33674
- return cb();
33675
- var buffer = new Buffer(toRead);
33676
- fs11.read(self2.context.fd, buffer, 0, toRead, self2.pos, function(err, bytesRead) {
33677
- if (err) {
33678
- self2.destroy(err);
33679
- } else if (bytesRead === 0) {
33680
- self2.destroyed = true;
33681
- self2.push(null);
33682
- self2.context.unref();
33683
- } else {
33684
- self2.pos += bytesRead;
33685
- self2.push(buffer.slice(0, bytesRead));
33686
- }
33687
- cb();
33688
- });
33689
- });
33690
- };
33691
- ReadStream.prototype.destroy = function(err) {
33692
- if (this.destroyed)
33693
- return;
33694
- err = err || new Error("stream destroyed");
33695
- this.destroyed = true;
33696
- this.emit("error", err);
33697
- this.context.unref();
33698
- };
33699
- util3.inherits(WriteStream, Writable);
33700
- function WriteStream(context, options2) {
33701
- options2 = options2 || {};
33702
- Writable.call(this, options2);
33703
- this.context = context;
33704
- this.context.ref();
33705
- this.start = options2.start || 0;
33706
- this.endOffset = options2.end == null ? Infinity : +options2.end;
33707
- this.bytesWritten = 0;
33708
- this.pos = this.start;
33709
- this.destroyed = false;
33710
- this.on("finish", this.destroy.bind(this));
33711
- }
33712
- WriteStream.prototype._write = function(buffer, encoding, callback) {
33713
- var self2 = this;
33714
- if (self2.destroyed)
33715
- return;
33716
- if (self2.pos + buffer.length > self2.endOffset) {
33717
- var err = new Error("maximum file length exceeded");
33718
- err.code = "ETOOBIG";
33719
- self2.destroy();
33720
- callback(err);
33721
- return;
33722
- }
33723
- self2.context.pend.go(function(cb) {
33724
- if (self2.destroyed)
33725
- return cb();
33726
- fs11.write(self2.context.fd, buffer, 0, buffer.length, self2.pos, function(err2, bytes) {
33727
- if (err2) {
33728
- self2.destroy();
33729
- cb();
33730
- callback(err2);
33731
- } else {
33732
- self2.bytesWritten += bytes;
33733
- self2.pos += bytes;
33734
- self2.emit("progress");
33735
- cb();
33736
- callback();
33737
- }
33738
- });
33739
- });
33740
- };
33741
- WriteStream.prototype.destroy = function() {
33742
- if (this.destroyed)
33743
- return;
33744
- this.destroyed = true;
33745
- this.context.unref();
33746
- };
33747
- util3.inherits(BufferSlicer, EventEmitter2);
33748
- function BufferSlicer(buffer, options2) {
33749
- EventEmitter2.call(this);
33750
- options2 = options2 || {};
33751
- this.refCount = 0;
33752
- this.buffer = buffer;
33753
- this.maxChunkSize = options2.maxChunkSize || Number.MAX_SAFE_INTEGER;
33754
- }
33755
- BufferSlicer.prototype.read = function(buffer, offset, length, position, callback) {
33756
- var end = position + length;
33757
- var delta = end - this.buffer.length;
33758
- var written = delta > 0 ? delta : length;
33759
- this.buffer.copy(buffer, offset, position, end);
33760
- setImmediate(function() {
33761
- callback(null, written);
33762
- });
33763
- };
33764
- BufferSlicer.prototype.write = function(buffer, offset, length, position, callback) {
33765
- buffer.copy(this.buffer, position, offset, offset + length);
33766
- setImmediate(function() {
33767
- callback(null, length, buffer);
33768
- });
33769
- };
33770
- BufferSlicer.prototype.createReadStream = function(options2) {
33771
- options2 = options2 || {};
33772
- var readStream = new PassThrough(options2);
33773
- readStream.destroyed = false;
33774
- readStream.start = options2.start || 0;
33775
- readStream.endOffset = options2.end;
33776
- readStream.pos = readStream.endOffset || this.buffer.length;
33777
- var entireSlice = this.buffer.slice(readStream.start, readStream.pos);
33778
- var offset = 0;
33779
- while (true) {
33780
- var nextOffset = offset + this.maxChunkSize;
33781
- if (nextOffset >= entireSlice.length) {
33782
- if (offset < entireSlice.length) {
33783
- readStream.write(entireSlice.slice(offset, entireSlice.length));
33784
- }
33785
- break;
33786
- }
33787
- readStream.write(entireSlice.slice(offset, nextOffset));
33788
- offset = nextOffset;
33789
- }
33790
- readStream.end();
33791
- readStream.destroy = function() {
33792
- readStream.destroyed = true;
33793
- };
33794
- return readStream;
33795
- };
33796
- BufferSlicer.prototype.createWriteStream = function(options2) {
33797
- var bufferSlicer = this;
33798
- options2 = options2 || {};
33799
- var writeStream = new Writable(options2);
33800
- writeStream.start = options2.start || 0;
33801
- writeStream.endOffset = options2.end == null ? this.buffer.length : +options2.end;
33802
- writeStream.bytesWritten = 0;
33803
- writeStream.pos = writeStream.start;
33804
- writeStream.destroyed = false;
33805
- writeStream._write = function(buffer, encoding, callback) {
33806
- if (writeStream.destroyed)
33807
- return;
33808
- var end = writeStream.pos + buffer.length;
33809
- if (end > writeStream.endOffset) {
33810
- var err = new Error("maximum file length exceeded");
33811
- err.code = "ETOOBIG";
33812
- writeStream.destroyed = true;
33813
- callback(err);
33814
- return;
33815
- }
33816
- buffer.copy(bufferSlicer.buffer, writeStream.pos, 0, buffer.length);
33817
- writeStream.bytesWritten += buffer.length;
33818
- writeStream.pos = end;
33819
- writeStream.emit("progress");
33820
- callback();
33821
- };
33822
- writeStream.destroy = function() {
33823
- writeStream.destroyed = true;
33824
- };
33825
- return writeStream;
33826
- };
33827
- BufferSlicer.prototype.ref = function() {
33828
- this.refCount += 1;
33829
- };
33830
- BufferSlicer.prototype.unref = function() {
33831
- this.refCount -= 1;
33832
- if (this.refCount < 0) {
33833
- throw new Error("invalid unref");
33834
- }
33835
- };
33836
- function createFromBuffer(buffer, options2) {
33837
- return new BufferSlicer(buffer, options2);
33838
- }
33839
- function createFromFd(fd, options2) {
33840
- return new FdSlicer(fd, options2);
33841
- }
33842
- });
33843
-
33844
- // node_modules/buffer-crc32/index.js
33845
- var require_buffer_crc32 = __commonJS((exports, module) => {
33846
- var Buffer4 = __require("buffer").Buffer;
33847
- var CRC_TABLE = [
33848
- 0,
33849
- 1996959894,
33850
- 3993919788,
33851
- 2567524794,
33852
- 124634137,
33853
- 1886057615,
33854
- 3915621685,
33855
- 2657392035,
33856
- 249268274,
33857
- 2044508324,
33858
- 3772115230,
33859
- 2547177864,
33860
- 162941995,
33861
- 2125561021,
33862
- 3887607047,
33863
- 2428444049,
33864
- 498536548,
33865
- 1789927666,
33866
- 4089016648,
33867
- 2227061214,
33868
- 450548861,
33869
- 1843258603,
33870
- 4107580753,
33871
- 2211677639,
33872
- 325883990,
33873
- 1684777152,
33874
- 4251122042,
33875
- 2321926636,
33876
- 335633487,
33877
- 1661365465,
33878
- 4195302755,
33879
- 2366115317,
33880
- 997073096,
33881
- 1281953886,
33882
- 3579855332,
33883
- 2724688242,
33884
- 1006888145,
33885
- 1258607687,
33886
- 3524101629,
33887
- 2768942443,
33888
- 901097722,
33889
- 1119000684,
33890
- 3686517206,
33891
- 2898065728,
33892
- 853044451,
33893
- 1172266101,
33894
- 3705015759,
33895
- 2882616665,
33896
- 651767980,
33897
- 1373503546,
33898
- 3369554304,
33899
- 3218104598,
33900
- 565507253,
33901
- 1454621731,
33902
- 3485111705,
33903
- 3099436303,
33904
- 671266974,
33905
- 1594198024,
33906
- 3322730930,
33907
- 2970347812,
33908
- 795835527,
33909
- 1483230225,
33910
- 3244367275,
33911
- 3060149565,
33912
- 1994146192,
33913
- 31158534,
33914
- 2563907772,
33915
- 4023717930,
33916
- 1907459465,
33917
- 112637215,
33918
- 2680153253,
33919
- 3904427059,
33920
- 2013776290,
33921
- 251722036,
33922
- 2517215374,
33923
- 3775830040,
33924
- 2137656763,
33925
- 141376813,
33926
- 2439277719,
33927
- 3865271297,
33928
- 1802195444,
33929
- 476864866,
33930
- 2238001368,
33931
- 4066508878,
33932
- 1812370925,
33933
- 453092731,
33934
- 2181625025,
33935
- 4111451223,
33936
- 1706088902,
33937
- 314042704,
33938
- 2344532202,
33939
- 4240017532,
33940
- 1658658271,
33941
- 366619977,
33942
- 2362670323,
33943
- 4224994405,
33944
- 1303535960,
33945
- 984961486,
33946
- 2747007092,
33947
- 3569037538,
33948
- 1256170817,
33949
- 1037604311,
33950
- 2765210733,
33951
- 3554079995,
33952
- 1131014506,
33953
- 879679996,
33954
- 2909243462,
33955
- 3663771856,
33956
- 1141124467,
33957
- 855842277,
33958
- 2852801631,
33959
- 3708648649,
33960
- 1342533948,
33961
- 654459306,
33962
- 3188396048,
33963
- 3373015174,
33964
- 1466479909,
33965
- 544179635,
33966
- 3110523913,
33967
- 3462522015,
33968
- 1591671054,
33969
- 702138776,
33970
- 2966460450,
33971
- 3352799412,
33972
- 1504918807,
33973
- 783551873,
33974
- 3082640443,
33975
- 3233442989,
33976
- 3988292384,
33977
- 2596254646,
33978
- 62317068,
33979
- 1957810842,
33980
- 3939845945,
33981
- 2647816111,
33982
- 81470997,
33983
- 1943803523,
33984
- 3814918930,
33985
- 2489596804,
33986
- 225274430,
33987
- 2053790376,
33988
- 3826175755,
33989
- 2466906013,
33990
- 167816743,
33991
- 2097651377,
33992
- 4027552580,
33993
- 2265490386,
33994
- 503444072,
33995
- 1762050814,
33996
- 4150417245,
33997
- 2154129355,
33998
- 426522225,
33999
- 1852507879,
34000
- 4275313526,
34001
- 2312317920,
34002
- 282753626,
34003
- 1742555852,
34004
- 4189708143,
34005
- 2394877945,
34006
- 397917763,
34007
- 1622183637,
34008
- 3604390888,
34009
- 2714866558,
34010
- 953729732,
34011
- 1340076626,
34012
- 3518719985,
34013
- 2797360999,
34014
- 1068828381,
34015
- 1219638859,
34016
- 3624741850,
34017
- 2936675148,
34018
- 906185462,
34019
- 1090812512,
34020
- 3747672003,
34021
- 2825379669,
34022
- 829329135,
34023
- 1181335161,
34024
- 3412177804,
34025
- 3160834842,
34026
- 628085408,
34027
- 1382605366,
34028
- 3423369109,
34029
- 3138078467,
34030
- 570562233,
34031
- 1426400815,
34032
- 3317316542,
34033
- 2998733608,
34034
- 733239954,
34035
- 1555261956,
34036
- 3268935591,
34037
- 3050360625,
34038
- 752459403,
34039
- 1541320221,
34040
- 2607071920,
34041
- 3965973030,
34042
- 1969922972,
34043
- 40735498,
34044
- 2617837225,
34045
- 3943577151,
34046
- 1913087877,
34047
- 83908371,
34048
- 2512341634,
34049
- 3803740692,
34050
- 2075208622,
34051
- 213261112,
34052
- 2463272603,
34053
- 3855990285,
34054
- 2094854071,
34055
- 198958881,
34056
- 2262029012,
34057
- 4057260610,
34058
- 1759359992,
34059
- 534414190,
34060
- 2176718541,
34061
- 4139329115,
34062
- 1873836001,
34063
- 414664567,
34064
- 2282248934,
34065
- 4279200368,
34066
- 1711684554,
34067
- 285281116,
34068
- 2405801727,
34069
- 4167216745,
34070
- 1634467795,
34071
- 376229701,
34072
- 2685067896,
34073
- 3608007406,
34074
- 1308918612,
34075
- 956543938,
34076
- 2808555105,
34077
- 3495958263,
34078
- 1231636301,
34079
- 1047427035,
34080
- 2932959818,
34081
- 3654703836,
34082
- 1088359270,
34083
- 936918000,
34084
- 2847714899,
34085
- 3736837829,
34086
- 1202900863,
34087
- 817233897,
34088
- 3183342108,
34089
- 3401237130,
34090
- 1404277552,
34091
- 615818150,
34092
- 3134207493,
34093
- 3453421203,
34094
- 1423857449,
34095
- 601450431,
34096
- 3009837614,
34097
- 3294710456,
34098
- 1567103746,
34099
- 711928724,
34100
- 3020668471,
34101
- 3272380065,
34102
- 1510334235,
34103
- 755167117
34104
- ];
34105
- if (typeof Int32Array !== "undefined") {
34106
- CRC_TABLE = new Int32Array(CRC_TABLE);
34107
- }
34108
- function ensureBuffer(input) {
34109
- if (Buffer4.isBuffer(input)) {
34110
- return input;
34111
- }
34112
- var hasNewBufferAPI = typeof Buffer4.alloc === "function" && typeof Buffer4.from === "function";
34113
- if (typeof input === "number") {
34114
- return hasNewBufferAPI ? Buffer4.alloc(input) : new Buffer4(input);
34115
- } else if (typeof input === "string") {
34116
- return hasNewBufferAPI ? Buffer4.from(input) : new Buffer4(input);
34117
- } else {
34118
- throw new Error("input must be buffer, number, or string, received " + typeof input);
34119
- }
34120
- }
34121
- function bufferizeInt(num) {
34122
- var tmp = ensureBuffer(4);
34123
- tmp.writeInt32BE(num, 0);
34124
- return tmp;
34125
- }
34126
- function _crc32(buf, previous) {
34127
- buf = ensureBuffer(buf);
34128
- if (Buffer4.isBuffer(previous)) {
34129
- previous = previous.readUInt32BE(0);
34130
- }
34131
- var crc = ~~previous ^ -1;
34132
- for (var n = 0;n < buf.length; n++) {
34133
- crc = CRC_TABLE[(crc ^ buf[n]) & 255] ^ crc >>> 8;
34134
- }
34135
- return crc ^ -1;
34136
- }
34137
- function crc32() {
34138
- return bufferizeInt(_crc32.apply(null, arguments));
34139
- }
34140
- crc32.signed = function() {
34141
- return _crc32.apply(null, arguments);
34142
- };
34143
- crc32.unsigned = function() {
34144
- return _crc32.apply(null, arguments) >>> 0;
34145
- };
34146
- module.exports = crc32;
34147
- });
34148
-
34149
- // node_modules/yauzl/index.js
34150
- var require_yauzl = __commonJS((exports) => {
34151
- var fs11 = __require("fs");
34152
- var zlib = __require("zlib");
34153
- var fd_slicer = require_fd_slicer();
34154
- var crc32 = require_buffer_crc32();
34155
- var util3 = __require("util");
34156
- var EventEmitter2 = __require("events").EventEmitter;
34157
- var Transform = __require("stream").Transform;
34158
- var PassThrough = __require("stream").PassThrough;
34159
- var Writable = __require("stream").Writable;
34160
- exports.open = open2;
34161
- exports.fromFd = fromFd;
34162
- exports.fromBuffer = fromBuffer;
34163
- exports.fromRandomAccessReader = fromRandomAccessReader;
34164
- exports.dosDateTimeToDate = dosDateTimeToDate;
34165
- exports.validateFileName = validateFileName;
34166
- exports.ZipFile = ZipFile;
34167
- exports.Entry = Entry;
34168
- exports.RandomAccessReader = RandomAccessReader;
34169
- function open2(path4, options2, callback) {
34170
- if (typeof options2 === "function") {
34171
- callback = options2;
34172
- options2 = null;
34173
- }
34174
- if (options2 == null)
34175
- options2 = {};
34176
- if (options2.autoClose == null)
34177
- options2.autoClose = true;
34178
- if (options2.lazyEntries == null)
34179
- options2.lazyEntries = false;
34180
- if (options2.decodeStrings == null)
34181
- options2.decodeStrings = true;
34182
- if (options2.validateEntrySizes == null)
34183
- options2.validateEntrySizes = true;
34184
- if (options2.strictFileNames == null)
34185
- options2.strictFileNames = false;
34186
- if (callback == null)
34187
- callback = defaultCallback;
34188
- fs11.open(path4, "r", function(err, fd) {
34189
- if (err)
34190
- return callback(err);
34191
- fromFd(fd, options2, function(err2, zipfile) {
34192
- if (err2)
34193
- fs11.close(fd, defaultCallback);
34194
- callback(err2, zipfile);
34195
- });
34196
- });
34197
- }
34198
- function fromFd(fd, options2, callback) {
34199
- if (typeof options2 === "function") {
34200
- callback = options2;
34201
- options2 = null;
34202
- }
34203
- if (options2 == null)
34204
- options2 = {};
34205
- if (options2.autoClose == null)
34206
- options2.autoClose = false;
34207
- if (options2.lazyEntries == null)
34208
- options2.lazyEntries = false;
34209
- if (options2.decodeStrings == null)
34210
- options2.decodeStrings = true;
34211
- if (options2.validateEntrySizes == null)
34212
- options2.validateEntrySizes = true;
34213
- if (options2.strictFileNames == null)
34214
- options2.strictFileNames = false;
34215
- if (callback == null)
34216
- callback = defaultCallback;
34217
- fs11.fstat(fd, function(err, stats) {
34218
- if (err)
34219
- return callback(err);
34220
- var reader = fd_slicer.createFromFd(fd, { autoClose: true });
34221
- fromRandomAccessReader(reader, stats.size, options2, callback);
34222
- });
34223
- }
34224
- function fromBuffer(buffer, options2, callback) {
34225
- if (typeof options2 === "function") {
34226
- callback = options2;
34227
- options2 = null;
34228
- }
34229
- if (options2 == null)
34230
- options2 = {};
34231
- options2.autoClose = false;
34232
- if (options2.lazyEntries == null)
34233
- options2.lazyEntries = false;
34234
- if (options2.decodeStrings == null)
34235
- options2.decodeStrings = true;
34236
- if (options2.validateEntrySizes == null)
34237
- options2.validateEntrySizes = true;
34238
- if (options2.strictFileNames == null)
34239
- options2.strictFileNames = false;
34240
- var reader = fd_slicer.createFromBuffer(buffer, { maxChunkSize: 65536 });
34241
- fromRandomAccessReader(reader, buffer.length, options2, callback);
34242
- }
34243
- function fromRandomAccessReader(reader, totalSize, options2, callback) {
34244
- if (typeof options2 === "function") {
34245
- callback = options2;
34246
- options2 = null;
34247
- }
34248
- if (options2 == null)
34249
- options2 = {};
34250
- if (options2.autoClose == null)
34251
- options2.autoClose = true;
34252
- if (options2.lazyEntries == null)
34253
- options2.lazyEntries = false;
34254
- if (options2.decodeStrings == null)
34255
- options2.decodeStrings = true;
34256
- var decodeStrings = !!options2.decodeStrings;
34257
- if (options2.validateEntrySizes == null)
34258
- options2.validateEntrySizes = true;
34259
- if (options2.strictFileNames == null)
34260
- options2.strictFileNames = false;
34261
- if (callback == null)
34262
- callback = defaultCallback;
34263
- if (typeof totalSize !== "number")
34264
- throw new Error("expected totalSize parameter to be a number");
34265
- if (totalSize > Number.MAX_SAFE_INTEGER) {
34266
- throw new Error("zip file too large. only file sizes up to 2^52 are supported due to JavaScript's Number type being an IEEE 754 double.");
34267
- }
34268
- reader.ref();
34269
- var eocdrWithoutCommentSize = 22;
34270
- var maxCommentSize = 65535;
34271
- var bufferSize = Math.min(eocdrWithoutCommentSize + maxCommentSize, totalSize);
34272
- var buffer = newBuffer(bufferSize);
34273
- var bufferReadStart = totalSize - buffer.length;
34274
- readAndAssertNoEof(reader, buffer, 0, bufferSize, bufferReadStart, function(err) {
34275
- if (err)
34276
- return callback(err);
34277
- for (var i = bufferSize - eocdrWithoutCommentSize;i >= 0; i -= 1) {
34278
- if (buffer.readUInt32LE(i) !== 101010256)
34279
- continue;
34280
- var eocdrBuffer = buffer.slice(i);
34281
- var diskNumber = eocdrBuffer.readUInt16LE(4);
34282
- if (diskNumber !== 0) {
34283
- return callback(new Error("multi-disk zip files are not supported: found disk number: " + diskNumber));
34284
- }
34285
- var entryCount = eocdrBuffer.readUInt16LE(10);
34286
- var centralDirectoryOffset = eocdrBuffer.readUInt32LE(16);
34287
- var commentLength = eocdrBuffer.readUInt16LE(20);
34288
- var expectedCommentLength = eocdrBuffer.length - eocdrWithoutCommentSize;
34289
- if (commentLength !== expectedCommentLength) {
34290
- return callback(new Error("invalid comment length. expected: " + expectedCommentLength + ". found: " + commentLength));
34291
- }
34292
- var comment = decodeStrings ? decodeBuffer(eocdrBuffer, 22, eocdrBuffer.length, false) : eocdrBuffer.slice(22);
34293
- if (!(entryCount === 65535 || centralDirectoryOffset === 4294967295)) {
34294
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
34295
- }
34296
- var zip64EocdlBuffer = newBuffer(20);
34297
- var zip64EocdlOffset = bufferReadStart + i - zip64EocdlBuffer.length;
34298
- readAndAssertNoEof(reader, zip64EocdlBuffer, 0, zip64EocdlBuffer.length, zip64EocdlOffset, function(err2) {
34299
- if (err2)
34300
- return callback(err2);
34301
- if (zip64EocdlBuffer.readUInt32LE(0) !== 117853008) {
34302
- return callback(new Error("invalid zip64 end of central directory locator signature"));
34303
- }
34304
- var zip64EocdrOffset = readUInt64LE(zip64EocdlBuffer, 8);
34305
- var zip64EocdrBuffer = newBuffer(56);
34306
- readAndAssertNoEof(reader, zip64EocdrBuffer, 0, zip64EocdrBuffer.length, zip64EocdrOffset, function(err3) {
34307
- if (err3)
34308
- return callback(err3);
34309
- if (zip64EocdrBuffer.readUInt32LE(0) !== 101075792) {
34310
- return callback(new Error("invalid zip64 end of central directory record signature"));
34311
- }
34312
- entryCount = readUInt64LE(zip64EocdrBuffer, 32);
34313
- centralDirectoryOffset = readUInt64LE(zip64EocdrBuffer, 48);
34314
- return callback(null, new ZipFile(reader, centralDirectoryOffset, totalSize, entryCount, comment, options2.autoClose, options2.lazyEntries, decodeStrings, options2.validateEntrySizes, options2.strictFileNames));
34315
- });
34316
- });
34317
- return;
34318
- }
34319
- callback(new Error("end of central directory record signature not found"));
34320
- });
34321
- }
34322
- util3.inherits(ZipFile, EventEmitter2);
34323
- function ZipFile(reader, centralDirectoryOffset, fileSize, entryCount, comment, autoClose, lazyEntries, decodeStrings, validateEntrySizes, strictFileNames) {
34324
- var self2 = this;
34325
- EventEmitter2.call(self2);
34326
- self2.reader = reader;
34327
- self2.reader.on("error", function(err) {
34328
- emitError(self2, err);
34329
- });
34330
- self2.reader.once("close", function() {
34331
- self2.emit("close");
34332
- });
34333
- self2.readEntryCursor = centralDirectoryOffset;
34334
- self2.fileSize = fileSize;
34335
- self2.entryCount = entryCount;
34336
- self2.comment = comment;
34337
- self2.entriesRead = 0;
34338
- self2.autoClose = !!autoClose;
34339
- self2.lazyEntries = !!lazyEntries;
34340
- self2.decodeStrings = !!decodeStrings;
34341
- self2.validateEntrySizes = !!validateEntrySizes;
34342
- self2.strictFileNames = !!strictFileNames;
34343
- self2.isOpen = true;
34344
- self2.emittedError = false;
34345
- if (!self2.lazyEntries)
34346
- self2._readEntry();
34347
- }
34348
- ZipFile.prototype.close = function() {
34349
- if (!this.isOpen)
34350
- return;
34351
- this.isOpen = false;
34352
- this.reader.unref();
34353
- };
34354
- function emitErrorAndAutoClose(self2, err) {
34355
- if (self2.autoClose)
34356
- self2.close();
34357
- emitError(self2, err);
34358
- }
34359
- function emitError(self2, err) {
34360
- if (self2.emittedError)
34361
- return;
34362
- self2.emittedError = true;
34363
- self2.emit("error", err);
34364
- }
34365
- ZipFile.prototype.readEntry = function() {
34366
- if (!this.lazyEntries)
34367
- throw new Error("readEntry() called without lazyEntries:true");
34368
- this._readEntry();
34369
- };
34370
- ZipFile.prototype._readEntry = function() {
34371
- var self2 = this;
34372
- if (self2.entryCount === self2.entriesRead) {
34373
- setImmediate(function() {
34374
- if (self2.autoClose)
34375
- self2.close();
34376
- if (self2.emittedError)
34377
- return;
34378
- self2.emit("end");
34379
- });
34380
- return;
34381
- }
34382
- if (self2.emittedError)
34383
- return;
34384
- var buffer = newBuffer(46);
34385
- readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, self2.readEntryCursor, function(err) {
34386
- if (err)
34387
- return emitErrorAndAutoClose(self2, err);
34388
- if (self2.emittedError)
34389
- return;
34390
- var entry = new Entry;
34391
- var signature = buffer.readUInt32LE(0);
34392
- if (signature !== 33639248)
34393
- return emitErrorAndAutoClose(self2, new Error("invalid central directory file header signature: 0x" + signature.toString(16)));
34394
- entry.versionMadeBy = buffer.readUInt16LE(4);
34395
- entry.versionNeededToExtract = buffer.readUInt16LE(6);
34396
- entry.generalPurposeBitFlag = buffer.readUInt16LE(8);
34397
- entry.compressionMethod = buffer.readUInt16LE(10);
34398
- entry.lastModFileTime = buffer.readUInt16LE(12);
34399
- entry.lastModFileDate = buffer.readUInt16LE(14);
34400
- entry.crc32 = buffer.readUInt32LE(16);
34401
- entry.compressedSize = buffer.readUInt32LE(20);
34402
- entry.uncompressedSize = buffer.readUInt32LE(24);
34403
- entry.fileNameLength = buffer.readUInt16LE(28);
34404
- entry.extraFieldLength = buffer.readUInt16LE(30);
34405
- entry.fileCommentLength = buffer.readUInt16LE(32);
34406
- entry.internalFileAttributes = buffer.readUInt16LE(36);
34407
- entry.externalFileAttributes = buffer.readUInt32LE(38);
34408
- entry.relativeOffsetOfLocalHeader = buffer.readUInt32LE(42);
34409
- if (entry.generalPurposeBitFlag & 64)
34410
- return emitErrorAndAutoClose(self2, new Error("strong encryption is not supported"));
34411
- self2.readEntryCursor += 46;
34412
- buffer = newBuffer(entry.fileNameLength + entry.extraFieldLength + entry.fileCommentLength);
34413
- readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, self2.readEntryCursor, function(err2) {
34414
- if (err2)
34415
- return emitErrorAndAutoClose(self2, err2);
34416
- if (self2.emittedError)
34417
- return;
34418
- var isUtf8 = (entry.generalPurposeBitFlag & 2048) !== 0;
34419
- entry.fileName = self2.decodeStrings ? decodeBuffer(buffer, 0, entry.fileNameLength, isUtf8) : buffer.slice(0, entry.fileNameLength);
34420
- var fileCommentStart = entry.fileNameLength + entry.extraFieldLength;
34421
- var extraFieldBuffer = buffer.slice(entry.fileNameLength, fileCommentStart);
34422
- entry.extraFields = [];
34423
- var i = 0;
34424
- while (i < extraFieldBuffer.length - 3) {
34425
- var headerId = extraFieldBuffer.readUInt16LE(i + 0);
34426
- var dataSize = extraFieldBuffer.readUInt16LE(i + 2);
34427
- var dataStart = i + 4;
34428
- var dataEnd = dataStart + dataSize;
34429
- if (dataEnd > extraFieldBuffer.length)
34430
- return emitErrorAndAutoClose(self2, new Error("extra field length exceeds extra field buffer size"));
34431
- var dataBuffer = newBuffer(dataSize);
34432
- extraFieldBuffer.copy(dataBuffer, 0, dataStart, dataEnd);
34433
- entry.extraFields.push({
34434
- id: headerId,
34435
- data: dataBuffer
34436
- });
34437
- i = dataEnd;
34438
- }
34439
- entry.fileComment = self2.decodeStrings ? decodeBuffer(buffer, fileCommentStart, fileCommentStart + entry.fileCommentLength, isUtf8) : buffer.slice(fileCommentStart, fileCommentStart + entry.fileCommentLength);
34440
- entry.comment = entry.fileComment;
34441
- self2.readEntryCursor += buffer.length;
34442
- self2.entriesRead += 1;
34443
- if (entry.uncompressedSize === 4294967295 || entry.compressedSize === 4294967295 || entry.relativeOffsetOfLocalHeader === 4294967295) {
34444
- var zip64EiefBuffer = null;
34445
- for (var i = 0;i < entry.extraFields.length; i++) {
34446
- var extraField = entry.extraFields[i];
34447
- if (extraField.id === 1) {
34448
- zip64EiefBuffer = extraField.data;
34449
- break;
34450
- }
34451
- }
34452
- if (zip64EiefBuffer == null) {
34453
- return emitErrorAndAutoClose(self2, new Error("expected zip64 extended information extra field"));
34454
- }
34455
- var index = 0;
34456
- if (entry.uncompressedSize === 4294967295) {
34457
- if (index + 8 > zip64EiefBuffer.length) {
34458
- return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include uncompressed size"));
34459
- }
34460
- entry.uncompressedSize = readUInt64LE(zip64EiefBuffer, index);
34461
- index += 8;
34462
- }
34463
- if (entry.compressedSize === 4294967295) {
34464
- if (index + 8 > zip64EiefBuffer.length) {
34465
- return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include compressed size"));
34466
- }
34467
- entry.compressedSize = readUInt64LE(zip64EiefBuffer, index);
34468
- index += 8;
34469
- }
34470
- if (entry.relativeOffsetOfLocalHeader === 4294967295) {
34471
- if (index + 8 > zip64EiefBuffer.length) {
34472
- return emitErrorAndAutoClose(self2, new Error("zip64 extended information extra field does not include relative header offset"));
34473
- }
34474
- entry.relativeOffsetOfLocalHeader = readUInt64LE(zip64EiefBuffer, index);
34475
- index += 8;
34476
- }
34477
- }
34478
- if (self2.decodeStrings) {
34479
- for (var i = 0;i < entry.extraFields.length; i++) {
34480
- var extraField = entry.extraFields[i];
34481
- if (extraField.id === 28789) {
34482
- if (extraField.data.length < 6) {
34483
- continue;
34484
- }
34485
- if (extraField.data.readUInt8(0) !== 1) {
34486
- continue;
34487
- }
34488
- var oldNameCrc32 = extraField.data.readUInt32LE(1);
34489
- if (crc32.unsigned(buffer.slice(0, entry.fileNameLength)) !== oldNameCrc32) {
34490
- continue;
34491
- }
34492
- entry.fileName = decodeBuffer(extraField.data, 5, extraField.data.length, true);
34493
- break;
34494
- }
34495
- }
34496
- }
34497
- if (self2.validateEntrySizes && entry.compressionMethod === 0) {
34498
- var expectedCompressedSize = entry.uncompressedSize;
34499
- if (entry.isEncrypted()) {
34500
- expectedCompressedSize += 12;
34501
- }
34502
- if (entry.compressedSize !== expectedCompressedSize) {
34503
- var msg = "compressed/uncompressed size mismatch for stored file: " + entry.compressedSize + " != " + entry.uncompressedSize;
34504
- return emitErrorAndAutoClose(self2, new Error(msg));
34505
- }
34506
- }
34507
- if (self2.decodeStrings) {
34508
- if (!self2.strictFileNames) {
34509
- entry.fileName = entry.fileName.replace(/\\/g, "/");
34510
- }
34511
- var errorMessage = validateFileName(entry.fileName, self2.validateFileNameOptions);
34512
- if (errorMessage != null)
34513
- return emitErrorAndAutoClose(self2, new Error(errorMessage));
34514
- }
34515
- self2.emit("entry", entry);
34516
- if (!self2.lazyEntries)
34517
- self2._readEntry();
34518
- });
34519
- });
34520
- };
34521
- ZipFile.prototype.openReadStream = function(entry, options2, callback) {
34522
- var self2 = this;
34523
- var relativeStart = 0;
34524
- var relativeEnd = entry.compressedSize;
34525
- if (callback == null) {
34526
- callback = options2;
34527
- options2 = {};
34528
- } else {
34529
- if (options2.decrypt != null) {
34530
- if (!entry.isEncrypted()) {
34531
- throw new Error("options.decrypt can only be specified for encrypted entries");
34532
- }
34533
- if (options2.decrypt !== false)
34534
- throw new Error("invalid options.decrypt value: " + options2.decrypt);
34535
- if (entry.isCompressed()) {
34536
- if (options2.decompress !== false)
34537
- throw new Error("entry is encrypted and compressed, and options.decompress !== false");
34538
- }
34539
- }
34540
- if (options2.decompress != null) {
34541
- if (!entry.isCompressed()) {
34542
- throw new Error("options.decompress can only be specified for compressed entries");
34543
- }
34544
- if (!(options2.decompress === false || options2.decompress === true)) {
34545
- throw new Error("invalid options.decompress value: " + options2.decompress);
34546
- }
34547
- }
34548
- if (options2.start != null || options2.end != null) {
34549
- if (entry.isCompressed() && options2.decompress !== false) {
34550
- throw new Error("start/end range not allowed for compressed entry without options.decompress === false");
34551
- }
34552
- if (entry.isEncrypted() && options2.decrypt !== false) {
34553
- throw new Error("start/end range not allowed for encrypted entry without options.decrypt === false");
34554
- }
34555
- }
34556
- if (options2.start != null) {
34557
- relativeStart = options2.start;
34558
- if (relativeStart < 0)
34559
- throw new Error("options.start < 0");
34560
- if (relativeStart > entry.compressedSize)
34561
- throw new Error("options.start > entry.compressedSize");
34562
- }
34563
- if (options2.end != null) {
34564
- relativeEnd = options2.end;
34565
- if (relativeEnd < 0)
34566
- throw new Error("options.end < 0");
34567
- if (relativeEnd > entry.compressedSize)
34568
- throw new Error("options.end > entry.compressedSize");
34569
- if (relativeEnd < relativeStart)
34570
- throw new Error("options.end < options.start");
34571
- }
34572
- }
34573
- if (!self2.isOpen)
34574
- return callback(new Error("closed"));
34575
- if (entry.isEncrypted()) {
34576
- if (options2.decrypt !== false)
34577
- return callback(new Error("entry is encrypted, and options.decrypt !== false"));
34578
- }
34579
- self2.reader.ref();
34580
- var buffer = newBuffer(30);
34581
- readAndAssertNoEof(self2.reader, buffer, 0, buffer.length, entry.relativeOffsetOfLocalHeader, function(err) {
34582
- try {
34583
- if (err)
34584
- return callback(err);
34585
- var signature = buffer.readUInt32LE(0);
34586
- if (signature !== 67324752) {
34587
- return callback(new Error("invalid local file header signature: 0x" + signature.toString(16)));
34588
- }
34589
- var fileNameLength = buffer.readUInt16LE(26);
34590
- var extraFieldLength = buffer.readUInt16LE(28);
34591
- var localFileHeaderEnd = entry.relativeOffsetOfLocalHeader + buffer.length + fileNameLength + extraFieldLength;
34592
- var decompress;
34593
- if (entry.compressionMethod === 0) {
34594
- decompress = false;
34595
- } else if (entry.compressionMethod === 8) {
34596
- decompress = options2.decompress != null ? options2.decompress : true;
34597
- } else {
34598
- return callback(new Error("unsupported compression method: " + entry.compressionMethod));
34599
- }
34600
- var fileDataStart = localFileHeaderEnd;
34601
- var fileDataEnd = fileDataStart + entry.compressedSize;
34602
- if (entry.compressedSize !== 0) {
34603
- if (fileDataEnd > self2.fileSize) {
34604
- return callback(new Error("file data overflows file bounds: " + fileDataStart + " + " + entry.compressedSize + " > " + self2.fileSize));
34605
- }
34606
- }
34607
- var readStream = self2.reader.createReadStream({
34608
- start: fileDataStart + relativeStart,
34609
- end: fileDataStart + relativeEnd
34610
- });
34611
- var endpointStream = readStream;
34612
- if (decompress) {
34613
- var destroyed = false;
34614
- var inflateFilter = zlib.createInflateRaw();
34615
- readStream.on("error", function(err2) {
34616
- setImmediate(function() {
34617
- if (!destroyed)
34618
- inflateFilter.emit("error", err2);
34619
- });
34620
- });
34621
- readStream.pipe(inflateFilter);
34622
- if (self2.validateEntrySizes) {
34623
- endpointStream = new AssertByteCountStream(entry.uncompressedSize);
34624
- inflateFilter.on("error", function(err2) {
34625
- setImmediate(function() {
34626
- if (!destroyed)
34627
- endpointStream.emit("error", err2);
34628
- });
34629
- });
34630
- inflateFilter.pipe(endpointStream);
34631
- } else {
34632
- endpointStream = inflateFilter;
34633
- }
34634
- endpointStream.destroy = function() {
34635
- destroyed = true;
34636
- if (inflateFilter !== endpointStream)
34637
- inflateFilter.unpipe(endpointStream);
34638
- readStream.unpipe(inflateFilter);
34639
- readStream.destroy();
34640
- };
34641
- }
34642
- callback(null, endpointStream);
34643
- } finally {
34644
- self2.reader.unref();
34645
- }
34646
- });
34647
- };
34648
- function Entry() {}
34649
- Entry.prototype.getLastModDate = function() {
34650
- return dosDateTimeToDate(this.lastModFileDate, this.lastModFileTime);
34651
- };
34652
- Entry.prototype.isEncrypted = function() {
34653
- return (this.generalPurposeBitFlag & 1) !== 0;
34654
- };
34655
- Entry.prototype.isCompressed = function() {
34656
- return this.compressionMethod === 8;
34657
- };
34658
- function dosDateTimeToDate(date, time) {
34659
- var day = date & 31;
34660
- var month = (date >> 5 & 15) - 1;
34661
- var year = (date >> 9 & 127) + 1980;
34662
- var millisecond = 0;
34663
- var second = (time & 31) * 2;
34664
- var minute = time >> 5 & 63;
34665
- var hour = time >> 11 & 31;
34666
- return new Date(year, month, day, hour, minute, second, millisecond);
34667
- }
34668
- function validateFileName(fileName) {
34669
- if (fileName.indexOf("\\") !== -1) {
34670
- return "invalid characters in fileName: " + fileName;
34671
- }
34672
- if (/^[a-zA-Z]:/.test(fileName) || /^\//.test(fileName)) {
34673
- return "absolute path: " + fileName;
34674
- }
34675
- if (fileName.split("/").indexOf("..") !== -1) {
34676
- return "invalid relative path: " + fileName;
34677
- }
34678
- return null;
34679
- }
34680
- function readAndAssertNoEof(reader, buffer, offset, length, position, callback) {
34681
- if (length === 0) {
34682
- return setImmediate(function() {
34683
- callback(null, newBuffer(0));
34684
- });
34685
- }
34686
- reader.read(buffer, offset, length, position, function(err, bytesRead) {
34687
- if (err)
34688
- return callback(err);
34689
- if (bytesRead < length) {
34690
- return callback(new Error("unexpected EOF"));
34691
- }
34692
- callback();
34693
- });
34694
- }
34695
- util3.inherits(AssertByteCountStream, Transform);
34696
- function AssertByteCountStream(byteCount) {
34697
- Transform.call(this);
34698
- this.actualByteCount = 0;
34699
- this.expectedByteCount = byteCount;
34700
- }
34701
- AssertByteCountStream.prototype._transform = function(chunk, encoding, cb) {
34702
- this.actualByteCount += chunk.length;
34703
- if (this.actualByteCount > this.expectedByteCount) {
34704
- var msg = "too many bytes in the stream. expected " + this.expectedByteCount + ". got at least " + this.actualByteCount;
34705
- return cb(new Error(msg));
34706
- }
34707
- cb(null, chunk);
34708
- };
34709
- AssertByteCountStream.prototype._flush = function(cb) {
34710
- if (this.actualByteCount < this.expectedByteCount) {
34711
- var msg = "not enough bytes in the stream. expected " + this.expectedByteCount + ". got only " + this.actualByteCount;
34712
- return cb(new Error(msg));
34713
- }
34714
- cb();
34715
- };
34716
- util3.inherits(RandomAccessReader, EventEmitter2);
34717
- function RandomAccessReader() {
34718
- EventEmitter2.call(this);
34719
- this.refCount = 0;
34720
- }
34721
- RandomAccessReader.prototype.ref = function() {
34722
- this.refCount += 1;
34723
- };
34724
- RandomAccessReader.prototype.unref = function() {
34725
- var self2 = this;
34726
- self2.refCount -= 1;
34727
- if (self2.refCount > 0)
34728
- return;
34729
- if (self2.refCount < 0)
34730
- throw new Error("invalid unref");
34731
- self2.close(onCloseDone);
34732
- function onCloseDone(err) {
34733
- if (err)
34734
- return self2.emit("error", err);
34735
- self2.emit("close");
34736
- }
34737
- };
34738
- RandomAccessReader.prototype.createReadStream = function(options2) {
34739
- var start = options2.start;
34740
- var end = options2.end;
34741
- if (start === end) {
34742
- var emptyStream = new PassThrough;
34743
- setImmediate(function() {
34744
- emptyStream.end();
34745
- });
34746
- return emptyStream;
34747
- }
34748
- var stream = this._readStreamForRange(start, end);
34749
- var destroyed = false;
34750
- var refUnrefFilter = new RefUnrefFilter(this);
34751
- stream.on("error", function(err) {
34752
- setImmediate(function() {
34753
- if (!destroyed)
34754
- refUnrefFilter.emit("error", err);
34755
- });
34756
- });
34757
- refUnrefFilter.destroy = function() {
34758
- stream.unpipe(refUnrefFilter);
34759
- refUnrefFilter.unref();
34760
- stream.destroy();
34761
- };
34762
- var byteCounter = new AssertByteCountStream(end - start);
34763
- refUnrefFilter.on("error", function(err) {
34764
- setImmediate(function() {
34765
- if (!destroyed)
34766
- byteCounter.emit("error", err);
34767
- });
34768
- });
34769
- byteCounter.destroy = function() {
34770
- destroyed = true;
34771
- refUnrefFilter.unpipe(byteCounter);
34772
- refUnrefFilter.destroy();
34773
- };
34774
- return stream.pipe(refUnrefFilter).pipe(byteCounter);
34775
- };
34776
- RandomAccessReader.prototype._readStreamForRange = function(start, end) {
34777
- throw new Error("not implemented");
34778
- };
34779
- RandomAccessReader.prototype.read = function(buffer, offset, length, position, callback) {
34780
- var readStream = this.createReadStream({ start: position, end: position + length });
34781
- var writeStream = new Writable;
34782
- var written = 0;
34783
- writeStream._write = function(chunk, encoding, cb) {
34784
- chunk.copy(buffer, offset + written, 0, chunk.length);
34785
- written += chunk.length;
34786
- cb();
34787
- };
34788
- writeStream.on("finish", callback);
34789
- readStream.on("error", function(error) {
34790
- callback(error);
34791
- });
34792
- readStream.pipe(writeStream);
34793
- };
34794
- RandomAccessReader.prototype.close = function(callback) {
34795
- setImmediate(callback);
34796
- };
34797
- util3.inherits(RefUnrefFilter, PassThrough);
34798
- function RefUnrefFilter(context) {
34799
- PassThrough.call(this);
34800
- this.context = context;
34801
- this.context.ref();
34802
- this.unreffedYet = false;
34803
- }
34804
- RefUnrefFilter.prototype._flush = function(cb) {
34805
- this.unref();
34806
- cb();
34807
- };
34808
- RefUnrefFilter.prototype.unref = function(cb) {
34809
- if (this.unreffedYet)
34810
- return;
34811
- this.unreffedYet = true;
34812
- this.context.unref();
34813
- };
34814
- var cp437 = "\x00☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■ ";
34815
- function decodeBuffer(buffer, start, end, isUtf8) {
34816
- if (isUtf8) {
34817
- return buffer.toString("utf8", start, end);
34818
- } else {
34819
- var result = "";
34820
- for (var i = start;i < end; i++) {
34821
- result += cp437[buffer[i]];
34822
- }
34823
- return result;
34824
- }
34825
- }
34826
- function readUInt64LE(buffer, offset) {
34827
- var lower32 = buffer.readUInt32LE(offset);
34828
- var upper32 = buffer.readUInt32LE(offset + 4);
34829
- return upper32 * 4294967296 + lower32;
34830
- }
34831
- var newBuffer;
34832
- if (typeof Buffer.allocUnsafe === "function") {
34833
- newBuffer = function(len) {
34834
- return Buffer.allocUnsafe(len);
34835
- };
34836
- } else {
34837
- newBuffer = function(len) {
34838
- return new Buffer(len);
34839
- };
34840
- }
34841
- function defaultCallback(err) {
34842
- if (err)
34843
- throw err;
34844
- }
34845
- });
34846
-
34847
- // node_modules/extract-zip/index.js
34848
- var require_extract_zip = __commonJS((exports, module) => {
34849
- var debug = require_src2()("extract-zip");
34850
- var { createWriteStream: createWriteStream3, promises: fs11 } = __require("fs");
34851
- var getStream = require_get_stream();
34852
- var path4 = __require("path");
34853
- var { promisify: promisify12 } = __require("util");
34854
- var stream = __require("stream");
34855
- var yauzl = require_yauzl();
34856
- var openZip = promisify12(yauzl.open);
34857
- var pipeline = promisify12(stream.pipeline);
34858
-
34859
- class Extractor {
34860
- constructor(zipPath, opts) {
34861
- this.zipPath = zipPath;
34862
- this.opts = opts;
34863
- }
34864
- async extract() {
34865
- debug("opening", this.zipPath, "with opts", this.opts);
34866
- this.zipfile = await openZip(this.zipPath, { lazyEntries: true });
34867
- this.canceled = false;
34868
- return new Promise((resolve7, reject) => {
34869
- this.zipfile.on("error", (err) => {
34870
- this.canceled = true;
34871
- reject(err);
34872
- });
34873
- this.zipfile.readEntry();
34874
- this.zipfile.on("close", () => {
34875
- if (!this.canceled) {
34876
- debug("zip extraction complete");
34877
- resolve7();
34878
- }
34879
- });
34880
- this.zipfile.on("entry", async (entry) => {
34881
- if (this.canceled) {
34882
- debug("skipping entry", entry.fileName, { cancelled: this.canceled });
34883
- return;
34884
- }
34885
- debug("zipfile entry", entry.fileName);
34886
- if (entry.fileName.startsWith("__MACOSX/")) {
34887
- this.zipfile.readEntry();
34888
- return;
34889
- }
34890
- const destDir = path4.dirname(path4.join(this.opts.dir, entry.fileName));
34891
- try {
34892
- await fs11.mkdir(destDir, { recursive: true });
34893
- const canonicalDestDir = await fs11.realpath(destDir);
34894
- const relativeDestDir = path4.relative(this.opts.dir, canonicalDestDir);
34895
- if (relativeDestDir.split(path4.sep).includes("..")) {
34896
- throw new Error(`Out of bound path "${canonicalDestDir}" found while processing file ${entry.fileName}`);
34897
- }
34898
- await this.extractEntry(entry);
34899
- debug("finished processing", entry.fileName);
34900
- this.zipfile.readEntry();
34901
- } catch (err) {
34902
- this.canceled = true;
34903
- this.zipfile.close();
34904
- reject(err);
34905
- }
34906
- });
34907
- });
34908
- }
34909
- async extractEntry(entry) {
34910
- if (this.canceled) {
34911
- debug("skipping entry extraction", entry.fileName, { cancelled: this.canceled });
34912
- return;
34913
- }
34914
- if (this.opts.onEntry) {
34915
- this.opts.onEntry(entry, this.zipfile);
34916
- }
34917
- const dest = path4.join(this.opts.dir, entry.fileName);
34918
- const mode = entry.externalFileAttributes >> 16 & 65535;
34919
- const IFMT = 61440;
34920
- const IFDIR = 16384;
34921
- const IFLNK = 40960;
34922
- const symlink3 = (mode & IFMT) === IFLNK;
34923
- let isDir = (mode & IFMT) === IFDIR;
34924
- if (!isDir && entry.fileName.endsWith("/")) {
34925
- isDir = true;
34926
- }
34927
- const madeBy = entry.versionMadeBy >> 8;
34928
- if (!isDir)
34929
- isDir = madeBy === 0 && entry.externalFileAttributes === 16;
34930
- debug("extracting entry", { filename: entry.fileName, isDir, isSymlink: symlink3 });
34931
- const procMode = this.getExtractedMode(mode, isDir) & 511;
34932
- const destDir = isDir ? dest : path4.dirname(dest);
34933
- const mkdirOptions = { recursive: true };
34934
- if (isDir) {
34935
- mkdirOptions.mode = procMode;
34936
- }
34937
- debug("mkdir", { dir: destDir, ...mkdirOptions });
34938
- await fs11.mkdir(destDir, mkdirOptions);
34939
- if (isDir)
34940
- return;
34941
- debug("opening read stream", dest);
34942
- const readStream = await promisify12(this.zipfile.openReadStream.bind(this.zipfile))(entry);
34943
- if (symlink3) {
34944
- const link = await getStream(readStream);
34945
- debug("creating symlink", link, dest);
34946
- await fs11.symlink(link, dest);
34947
- } else {
34948
- await pipeline(readStream, createWriteStream3(dest, { mode: procMode }));
34949
- }
34950
- }
34951
- getExtractedMode(entryMode, isDir) {
34952
- let mode = entryMode;
34953
- if (mode === 0) {
34954
- if (isDir) {
34955
- if (this.opts.defaultDirMode) {
34956
- mode = parseInt(this.opts.defaultDirMode, 10);
34957
- }
34958
- if (!mode) {
34959
- mode = 493;
34960
- }
34961
- } else {
34962
- if (this.opts.defaultFileMode) {
34963
- mode = parseInt(this.opts.defaultFileMode, 10);
34964
- }
34965
- if (!mode) {
34966
- mode = 420;
34967
- }
34968
- }
34969
- }
34970
- return mode;
34971
- }
34972
- }
34973
- module.exports = async function(zipPath, opts) {
34974
- debug("creating target directory", opts.dir);
34975
- if (!path4.isAbsolute(opts.dir)) {
34976
- throw new Error("Target directory is expected to be absolute");
34977
- }
34978
- await fs11.mkdir(opts.dir, { recursive: true });
34979
- opts.dir = await fs11.realpath(opts.dir);
34980
- return new Extractor(zipPath, opts).extract();
34981
- };
34982
- });
34983
-
34984
32448
  // node_modules/semver/internal/constants.js
34985
32449
  var require_constants4 = __commonJS((exports, module) => {
34986
32450
  var SEMVER_SPEC_VERSION = "2.0.0";
@@ -36906,7 +34370,7 @@ __export(exports_monorepo_resolver, {
36906
34370
  resolveMonorepoRoot: () => resolveMonorepoRoot
36907
34371
  });
36908
34372
  import { existsSync as existsSync29, readFileSync as readFileSync11 } from "node:fs";
36909
- import { dirname as dirname14, join as join77, resolve as resolve10 } from "node:path";
34373
+ import { dirname as dirname15, join as join77, resolve as resolve11 } from "node:path";
36910
34374
  import { fileURLToPath as fileURLToPath3 } from "node:url";
36911
34375
  function parseMetadataAt(metadataPath) {
36912
34376
  if (!existsSync29(metadataPath))
@@ -36958,12 +34422,12 @@ function tryReadAtCandidate(candidateRoot) {
36958
34422
  return null;
36959
34423
  }
36960
34424
  function walkUpForMetadata(startDir, maxDepth = 5) {
36961
- let current = resolve10(startDir);
34425
+ let current = resolve11(startDir);
36962
34426
  for (let i = 0;i < maxDepth; i++) {
36963
34427
  const result = tryReadAtCandidate(current);
36964
34428
  if (result)
36965
34429
  return result;
36966
- const parent = dirname14(current);
34430
+ const parent = dirname15(current);
36967
34431
  if (parent === current)
36968
34432
  break;
36969
34433
  current = parent;
@@ -36973,13 +34437,13 @@ function walkUpForMetadata(startDir, maxDepth = 5) {
36973
34437
  function resolveMonorepoRoot() {
36974
34438
  try {
36975
34439
  const thisFile = fileURLToPath3(import.meta.url);
36976
- const thisDir = dirname14(thisFile);
34440
+ const thisDir = dirname15(thisFile);
36977
34441
  const result2 = walkUpForMetadata(thisDir);
36978
34442
  if (result2)
36979
34443
  return result2;
36980
34444
  } catch {}
36981
34445
  if (process.argv[1]) {
36982
- const binDir = dirname14(resolve10(process.argv[1]));
34446
+ const binDir = dirname15(resolve11(process.argv[1]));
36983
34447
  const result2 = walkUpForMetadata(binDir);
36984
34448
  if (result2)
36985
34449
  return result2;
@@ -37077,7 +34541,7 @@ async function restoreOriginalBranch(branchName, cwd2, issueNumber) {
37077
34541
  }
37078
34542
  }
37079
34543
  function spawnAndCollect(command, args, cwd2) {
37080
- return new Promise((resolve25, reject) => {
34544
+ return new Promise((resolve26, reject) => {
37081
34545
  const child = spawn3(command, args, { ...cwd2 && { cwd: cwd2 }, stdio: ["ignore", "pipe", "pipe"] });
37082
34546
  const chunks = [];
37083
34547
  const stderrChunks = [];
@@ -37090,7 +34554,7 @@ function spawnAndCollect(command, args, cwd2) {
37090
34554
  reject(new Error(`${command} ${args[0] ?? ""} exited with code ${code}: ${stderr}`));
37091
34555
  return;
37092
34556
  }
37093
- resolve25(Buffer.concat(chunks).toString("utf-8"));
34557
+ resolve26(Buffer.concat(chunks).toString("utf-8"));
37094
34558
  });
37095
34559
  });
37096
34560
  }
@@ -37922,7 +35386,7 @@ var init_content_creator = __esm(() => {
37922
35386
  });
37923
35387
 
37924
35388
  // src/commands/content/phases/content-logger.ts
37925
- import { createWriteStream as createWriteStream4, existsSync as existsSync59, mkdirSync as mkdirSync5, statSync as statSync8 } from "node:fs";
35389
+ import { createWriteStream as createWriteStream5, existsSync as existsSync59, mkdirSync as mkdirSync5, statSync as statSync8 } from "node:fs";
37926
35390
  import { homedir as homedir27 } from "node:os";
37927
35391
  import { join as join117 } from "node:path";
37928
35392
 
@@ -37982,7 +35446,7 @@ class ContentLogger {
37982
35446
  this.close();
37983
35447
  this.currentDate = dateStr;
37984
35448
  const logPath = join117(this.logDir, `content-${dateStr}.log`);
37985
- this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
35449
+ this.stream = createWriteStream5(logPath, { flags: "a", mode: 384 });
37986
35450
  return;
37987
35451
  }
37988
35452
  if (this.maxBytes > 0 && this.stream) {
@@ -37994,7 +35458,7 @@ class ContentLogger {
37994
35458
  const suffix = Date.now();
37995
35459
  const rotatedPath = join117(this.logDir, `content-${this.currentDate}-${suffix}.log`);
37996
35460
  import("node:fs/promises").then(({ rename: rename9 }) => rename9(logPath, rotatedPath).catch(() => {}));
37997
- this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
35461
+ this.stream = createWriteStream5(logPath, { flags: "w", mode: 384 });
37998
35462
  }
37999
35463
  } catch {}
38000
35464
  }
@@ -38030,7 +35494,7 @@ var init_sqlite_client = () => {};
38030
35494
 
38031
35495
  // src/commands/content/phases/db-manager.ts
38032
35496
  import { existsSync as existsSync60, mkdirSync as mkdirSync6 } from "node:fs";
38033
- import { dirname as dirname30 } from "node:path";
35497
+ import { dirname as dirname31 } from "node:path";
38034
35498
  function initDatabase(dbPath) {
38035
35499
  ensureParentDir2(dbPath);
38036
35500
  const db = openDatabase(dbPath);
@@ -38051,7 +35515,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
38051
35515
  db.prepare("DELETE FROM git_events WHERE processed = 1 AND created_at < ?").run(cutoff);
38052
35516
  }
38053
35517
  function ensureParentDir2(dbPath) {
38054
- const dir = dirname30(dbPath);
35518
+ const dir = dirname31(dbPath);
38055
35519
  if (dir && !existsSync60(dir)) {
38056
35520
  mkdirSync6(dir, { recursive: true });
38057
35521
  }
@@ -39880,8 +37344,8 @@ function shouldRunCleanup(lastAt) {
39880
37344
  return Date.now() - new Date(lastAt).getTime() >= 86400000;
39881
37345
  }
39882
37346
  function sleep3(ms2) {
39883
- return new Promise((resolve25) => {
39884
- setTimeout(resolve25, ms2);
37347
+ return new Promise((resolve26) => {
37348
+ setTimeout(resolve26, ms2);
39885
37349
  });
39886
37350
  }
39887
37351
  var LOCK_DIR2, LOCK_FILE, MAX_CREATION_RETRIES = 3, MAX_PUBLISH_RETRIES_PER_CYCLE = 3, PUBLISH_RETRY_WINDOW_HOURS = 24;
@@ -41265,7 +38729,7 @@ function getPagerArgs(pagerCmd) {
41265
38729
  return [];
41266
38730
  }
41267
38731
  async function trySystemPager(content) {
41268
- return new Promise((resolve25) => {
38732
+ return new Promise((resolve26) => {
41269
38733
  const pagerCmd = process.env.PAGER || "less";
41270
38734
  const pagerArgs = getPagerArgs(pagerCmd);
41271
38735
  try {
@@ -41275,20 +38739,20 @@ async function trySystemPager(content) {
41275
38739
  });
41276
38740
  const timeout = setTimeout(() => {
41277
38741
  pager.kill();
41278
- resolve25(false);
38742
+ resolve26(false);
41279
38743
  }, 30000);
41280
38744
  pager.stdin.write(content);
41281
38745
  pager.stdin.end();
41282
38746
  pager.on("close", (code) => {
41283
38747
  clearTimeout(timeout);
41284
- resolve25(code === 0);
38748
+ resolve26(code === 0);
41285
38749
  });
41286
38750
  pager.on("error", () => {
41287
38751
  clearTimeout(timeout);
41288
- resolve25(false);
38752
+ resolve26(false);
41289
38753
  });
41290
38754
  } catch {
41291
- resolve25(false);
38755
+ resolve26(false);
41292
38756
  }
41293
38757
  });
41294
38758
  }
@@ -41315,16 +38779,16 @@ async function basicPager(content) {
41315
38779
  break;
41316
38780
  }
41317
38781
  const remaining = lines.length - currentLine;
41318
- await new Promise((resolve25) => {
38782
+ await new Promise((resolve26) => {
41319
38783
  rl.question(`-- More (${remaining} lines) [Enter/q] --`, (answer) => {
41320
38784
  if (answer.toLowerCase() === "q") {
41321
38785
  rl.close();
41322
38786
  process.exitCode = 0;
41323
- resolve25();
38787
+ resolve26();
41324
38788
  return;
41325
38789
  }
41326
38790
  process.stdout.write("\x1B[1A\x1B[2K");
41327
- resolve25();
38791
+ resolve26();
41328
38792
  });
41329
38793
  });
41330
38794
  }
@@ -61149,54 +58613,18 @@ class TarExtractor {
61149
58613
  }
61150
58614
 
61151
58615
  // src/domains/installation/extraction/zip-extractor.ts
61152
- init_environment();
61153
58616
  init_logger();
61154
- var import_extract_zip = __toESM(require_extract_zip(), 1);
61155
- import { execFile as execFile7 } from "node:child_process";
61156
- import { copyFile as copyFile3, mkdir as mkdir17, readdir as readdir9, rm as rm5, stat as stat4 } from "node:fs/promises";
61157
- import { join as join49 } from "node:path";
58617
+ import { createWriteStream as createWriteStream3 } from "node:fs";
58618
+ import { chmod as chmod3, copyFile as copyFile3, mkdir as mkdir17, readdir as readdir9, rm as rm5, stat as stat4 } from "node:fs/promises";
58619
+ import { dirname as dirname10, join as join49, resolve as resolve7 } from "node:path";
58620
+ import { pipeline } from "node:stream/promises";
58621
+ import yauzl from "yauzl-promise";
61158
58622
  class ZipExtractor {
61159
- async tryNativeUnzip(archivePath, destDir) {
61160
- if (!isMacOS()) {
61161
- return false;
61162
- }
61163
- return new Promise((resolve7) => {
61164
- mkdir17(destDir, { recursive: true }).then(() => {
61165
- execFile7("unzip", ["-o", "-q", archivePath, "-d", destDir], (error, _stdout, stderr) => {
61166
- if (error) {
61167
- logger.debug(`Native unzip failed: ${stderr || error.message}`);
61168
- resolve7(false);
61169
- return;
61170
- }
61171
- logger.debug("Native unzip succeeded");
61172
- resolve7(true);
61173
- });
61174
- }).catch((err) => {
61175
- logger.debug(`Failed to create directory for native unzip: ${err.message}`);
61176
- resolve7(false);
61177
- });
61178
- });
61179
- }
61180
58623
  async extract(archivePath, destDir, shouldExclude, sizeTracker) {
61181
58624
  const tempExtractDir = `${destDir}-temp`;
61182
58625
  await mkdir17(tempExtractDir, { recursive: true });
61183
58626
  try {
61184
- const nativeSuccess = await this.tryNativeUnzip(archivePath, tempExtractDir);
61185
- if (!nativeSuccess) {
61186
- logger.debug("Using extract-zip library");
61187
- let extractedCount = 0;
61188
- const zipOptions = {
61189
- dir: tempExtractDir,
61190
- onEntry: (entry) => {
61191
- const normalized = normalizeZipEntryName(entry.fileName);
61192
- entry.fileName = normalized;
61193
- extractedCount++;
61194
- },
61195
- yauzl: { decodeStrings: false }
61196
- };
61197
- await import_extract_zip.default(archivePath, zipOptions);
61198
- logger.verbose(`Extracted ${extractedCount} files`);
61199
- }
58627
+ await this.extractToDir(archivePath, tempExtractDir);
61200
58628
  logger.debug(`Extracted ZIP to temp: ${tempExtractDir}`);
61201
58629
  const entries = await readdir9(tempExtractDir, { encoding: "utf8" });
61202
58630
  logger.debug(`Root entries: ${entries.join(", ")}`);
@@ -61233,6 +58661,36 @@ class ZipExtractor {
61233
58661
  throw error;
61234
58662
  }
61235
58663
  }
58664
+ async extractToDir(archivePath, destDir) {
58665
+ const zip = await yauzl.open(archivePath, { decodeStrings: false });
58666
+ const destRoot = resolve7(destDir);
58667
+ let count = 0;
58668
+ try {
58669
+ for await (const entry of zip) {
58670
+ const rawName = entry.filename;
58671
+ const name = normalizeZipEntryName(rawName);
58672
+ const outPath = resolve7(destRoot, name);
58673
+ if (!isPathSafe(destRoot, outPath)) {
58674
+ throw new Error(`Unsafe zip entry path (zip-slip): ${name}`);
58675
+ }
58676
+ if (name.endsWith("/")) {
58677
+ await mkdir17(outPath, { recursive: true });
58678
+ continue;
58679
+ }
58680
+ await mkdir17(dirname10(outPath), { recursive: true });
58681
+ const readStream = await entry.openReadStream();
58682
+ await pipeline(readStream, createWriteStream3(outPath));
58683
+ const unixMode = entry.externalFileAttributes >>> 16 & 511;
58684
+ if (unixMode) {
58685
+ await chmod3(outPath, unixMode);
58686
+ }
58687
+ count++;
58688
+ }
58689
+ logger.verbose(`Extracted ${count} files`);
58690
+ } finally {
58691
+ await zip.close();
58692
+ }
58693
+ }
61236
58694
  }
61237
58695
  // src/domains/installation/download-manager.ts
61238
58696
  var SLOW_EXTRACTION_THRESHOLD_MS = 30000;
@@ -61864,7 +59322,7 @@ import { join as join66 } from "node:path";
61864
59322
 
61865
59323
  // src/domains/installation/deletion-handler.ts
61866
59324
  import { existsSync as existsSync27, lstatSync as lstatSync3, readdirSync as readdirSync2, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync3 } from "node:fs";
61867
- import { dirname as dirname11, join as join53, relative as relative7, resolve as resolve8, sep as sep2 } from "node:path";
59325
+ import { dirname as dirname12, join as join53, relative as relative7, resolve as resolve9, sep as sep2 } from "node:path";
61868
59326
 
61869
59327
  // src/services/file-operations/manifest/manifest-reader.ts
61870
59328
  import { join as join52 } from "node:path";
@@ -62081,8 +59539,8 @@ function expandGlobPatterns(patterns, claudeDir) {
62081
59539
  }
62082
59540
  var MAX_CLEANUP_ITERATIONS = 50;
62083
59541
  function cleanupEmptyDirectories(filePath, claudeDir) {
62084
- const normalizedClaudeDir = resolve8(claudeDir);
62085
- let currentDir = resolve8(dirname11(filePath));
59542
+ const normalizedClaudeDir = resolve9(claudeDir);
59543
+ let currentDir = resolve9(dirname12(filePath));
62086
59544
  let iterations = 0;
62087
59545
  while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir) && iterations < MAX_CLEANUP_ITERATIONS) {
62088
59546
  iterations++;
@@ -62091,7 +59549,7 @@ function cleanupEmptyDirectories(filePath, claudeDir) {
62091
59549
  if (entries.length === 0) {
62092
59550
  rmdirSync(currentDir);
62093
59551
  logger.debug(`Removed empty directory: ${currentDir}`);
62094
- currentDir = resolve8(dirname11(currentDir));
59552
+ currentDir = resolve9(dirname12(currentDir));
62095
59553
  } else {
62096
59554
  break;
62097
59555
  }
@@ -62101,8 +59559,8 @@ function cleanupEmptyDirectories(filePath, claudeDir) {
62101
59559
  }
62102
59560
  }
62103
59561
  function deletePath(fullPath, claudeDir) {
62104
- const normalizedPath = resolve8(fullPath);
62105
- const normalizedClaudeDir = resolve8(claudeDir);
59562
+ const normalizedPath = resolve9(fullPath);
59563
+ const normalizedClaudeDir = resolve9(claudeDir);
62106
59564
  if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep2}`) && normalizedPath !== normalizedClaudeDir) {
62107
59565
  throw new Error(`Path traversal detected: ${fullPath}`);
62108
59566
  }
@@ -62175,8 +59633,8 @@ async function handleDeletions(sourceMetadata, claudeDir) {
62175
59633
  const result = { deletedPaths: [], preservedPaths: [], errors: [] };
62176
59634
  for (const path5 of deletions) {
62177
59635
  const fullPath = join53(claudeDir, path5);
62178
- const normalizedPath = resolve8(fullPath);
62179
- const normalizedClaudeDir = resolve8(claudeDir);
59636
+ const normalizedPath = resolve9(fullPath);
59637
+ const normalizedClaudeDir = resolve9(claudeDir);
62180
59638
  if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep2}`)) {
62181
59639
  logger.warning(`Skipping invalid path: ${path5}`);
62182
59640
  result.errors.push(path5);
@@ -62214,7 +59672,7 @@ init_logger();
62214
59672
  init_types2();
62215
59673
  var import_fs_extra10 = __toESM(require_lib(), 1);
62216
59674
  var import_ignore3 = __toESM(require_ignore(), 1);
62217
- import { dirname as dirname13, join as join56, relative as relative9 } from "node:path";
59675
+ import { dirname as dirname14, join as join56, relative as relative9 } from "node:path";
62218
59676
 
62219
59677
  // src/domains/installation/selective-merger.ts
62220
59678
  import { stat as stat6 } from "node:fs/promises";
@@ -64133,7 +61591,7 @@ import { execSync as execSync4 } from "node:child_process";
64133
61591
  // src/domains/config/installed-settings-tracker.ts
64134
61592
  import { existsSync as existsSync28 } from "node:fs";
64135
61593
  import { mkdir as mkdir19, readFile as readFile22, writeFile as writeFile18 } from "node:fs/promises";
64136
- import { dirname as dirname12, join as join55 } from "node:path";
61594
+ import { dirname as dirname13, join as join55 } from "node:path";
64137
61595
  var TAKUMI_JSON_FILE = ".takumi.json";
64138
61596
 
64139
61597
  class InstalledSettingsTracker {
@@ -64184,7 +61642,7 @@ class InstalledSettingsTracker {
64184
61642
  data.kits[this.kitName] = {};
64185
61643
  }
64186
61644
  data.kits[this.kitName].installedSettings = settings;
64187
- await mkdir19(dirname12(ckJsonPath), { recursive: true });
61645
+ await mkdir19(dirname13(ckJsonPath), { recursive: true });
64188
61646
  await writeFile18(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
64189
61647
  logger.debug(`Saved installed settings to ${ckJsonPath}`);
64190
61648
  } catch (error) {
@@ -64892,10 +62350,10 @@ class CopyExecutor {
64892
62350
  }
64893
62351
  trackInstalledFile(relativePath) {
64894
62352
  this.installedFiles.add(relativePath);
64895
- let dir = dirname13(relativePath);
62353
+ let dir = dirname14(relativePath);
64896
62354
  while (dir && dir !== "." && dir !== "/") {
64897
62355
  this.installedDirectories.add(`${dir}/`);
64898
- dir = dirname13(dir);
62356
+ dir = dirname14(dir);
64899
62357
  }
64900
62358
  }
64901
62359
  }
@@ -65567,7 +63025,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
65567
63025
  }
65568
63026
 
65569
63027
  // src/services/file-operations/file-scanner.ts
65570
- import { join as join61, relative as relative11, resolve as resolve9 } from "node:path";
63028
+ import { join as join61, relative as relative11, resolve as resolve10 } from "node:path";
65571
63029
  init_logger();
65572
63030
  var import_fs_extra14 = __toESM(require_lib(), 1);
65573
63031
 
@@ -65649,8 +63107,8 @@ class FileScanner2 {
65649
63107
  return customFiles;
65650
63108
  }
65651
63109
  static isSafePath(basePath, targetPath) {
65652
- const resolvedBase = resolve9(basePath);
65653
- const resolvedTarget = resolve9(targetPath);
63110
+ const resolvedBase = resolve10(basePath);
63111
+ const resolvedTarget = resolve10(targetPath);
65654
63112
  return resolvedTarget.startsWith(resolvedBase);
65655
63113
  }
65656
63114
  static toPosixPath(path6) {
@@ -67133,12 +64591,12 @@ async function getAllFiles(dirPath) {
67133
64591
  return files;
67134
64592
  }
67135
64593
  async function hashFile(filePath) {
67136
- return new Promise((resolve10, reject) => {
64594
+ return new Promise((resolve11, reject) => {
67137
64595
  const hash = createHash6("sha256");
67138
64596
  const stream = createReadStream2(filePath);
67139
64597
  stream.on("data", (chunk) => hash.update(chunk));
67140
64598
  stream.on("end", () => {
67141
- resolve10(hash.digest("hex"));
64599
+ resolve11(hash.digest("hex"));
67142
64600
  });
67143
64601
  stream.on("error", (error) => {
67144
64602
  stream.destroy();
@@ -67721,7 +65179,7 @@ init_types2();
67721
65179
  import { randomUUID as randomUUID2 } from "node:crypto";
67722
65180
  import { existsSync as existsSync30, statSync as statSync3 } from "node:fs";
67723
65181
  import { copyFile as copyFile6, mkdir as mkdir23, open as open2, readFile as readFile31, unlink as unlink10, writeFile as writeFile25 } from "node:fs/promises";
67724
- import { basename as basename4, dirname as dirname15, resolve as resolve11 } from "node:path";
65182
+ import { basename as basename4, dirname as dirname16, resolve as resolve12 } from "node:path";
67725
65183
 
67726
65184
  class ProjectsRegistryManager {
67727
65185
  static registry = null;
@@ -67732,7 +65190,7 @@ class ProjectsRegistryManager {
67732
65190
  static LOCK_MAX_RETRIES = 50;
67733
65191
  static async acquireLock(retries = 0) {
67734
65192
  const lockPath = `${PathResolver.getProjectsRegistryPath()}.lock`;
67735
- const lockDir = dirname15(lockPath);
65193
+ const lockDir = dirname16(lockPath);
67736
65194
  if (!existsSync30(lockDir)) {
67737
65195
  await mkdir23(lockDir, { recursive: true });
67738
65196
  }
@@ -67821,7 +65279,7 @@ class ProjectsRegistryManager {
67821
65279
  try {
67822
65280
  const validRegistry = ProjectsRegistrySchema.parse(registry);
67823
65281
  const registryPath = PathResolver.getProjectsRegistryPath();
67824
- const dir = dirname15(registryPath);
65282
+ const dir = dirname16(registryPath);
67825
65283
  if (!existsSync30(dir)) {
67826
65284
  await mkdir23(dir, { recursive: true });
67827
65285
  }
@@ -67839,7 +65297,7 @@ class ProjectsRegistryManager {
67839
65297
  if (projectPath.includes("..") || projectPath.startsWith("~")) {
67840
65298
  throw new Error("Invalid path: path traversal patterns not allowed");
67841
65299
  }
67842
- const absolutePath = resolve11(projectPath);
65300
+ const absolutePath = resolve12(projectPath);
67843
65301
  if (!existsSync30(absolutePath)) {
67844
65302
  throw new Error(`Path does not exist: ${absolutePath}`);
67845
65303
  }
@@ -67970,7 +65428,7 @@ class ProjectsRegistryManager {
67970
65428
  return projects;
67971
65429
  }
67972
65430
  static async isRegistered(projectPath) {
67973
- const absolutePath = resolve11(projectPath);
65431
+ const absolutePath = resolve12(projectPath);
67974
65432
  const registry = await ProjectsRegistryManager.load();
67975
65433
  return registry.projects.some((p2) => p2.path === absolutePath);
67976
65434
  }
@@ -68052,7 +65510,7 @@ async function handlePostInstall(ctx) {
68052
65510
  // src/commands/init/phases/selection-handler.ts
68053
65511
  init_auth_client();
68054
65512
  import { mkdir as mkdir24 } from "node:fs/promises";
68055
- import { join as join80, resolve as resolve13 } from "node:path";
65513
+ import { join as join80, resolve as resolve14 } from "node:path";
68056
65514
  init_github_client();
68057
65515
 
68058
65516
  // src/domains/github/kit-access-checker.ts
@@ -68182,7 +65640,7 @@ async function runPreflightChecks() {
68182
65640
 
68183
65641
  // src/domains/installation/fresh-installer.ts
68184
65642
  import { existsSync as existsSync31, readdirSync as readdirSync3, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
68185
- import { dirname as dirname16, join as join79, resolve as resolve12 } from "node:path";
65643
+ import { dirname as dirname17, join as join79, resolve as resolve13 } from "node:path";
68186
65644
  init_logger();
68187
65645
  var import_fs_extra29 = __toESM(require_lib(), 1);
68188
65646
  var TAKUMI_SUBDIRECTORIES = ["commands", "agents", "skills", "rules", "hooks"];
@@ -68229,15 +65687,15 @@ async function analyzeFreshInstallation(claudeDir) {
68229
65687
  };
68230
65688
  }
68231
65689
  function cleanupEmptyDirectories2(filePath, claudeDir) {
68232
- const normalizedClaudeDir = resolve12(claudeDir);
68233
- let currentDir = resolve12(dirname16(filePath));
65690
+ const normalizedClaudeDir = resolve13(claudeDir);
65691
+ let currentDir = resolve13(dirname17(filePath));
68234
65692
  while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
68235
65693
  try {
68236
65694
  const entries = readdirSync3(currentDir);
68237
65695
  if (entries.length === 0) {
68238
65696
  rmdirSync2(currentDir);
68239
65697
  logger.debug(`Removed empty directory: ${currentDir}`);
68240
- currentDir = resolve12(dirname16(currentDir));
65698
+ currentDir = resolve13(dirname17(currentDir));
68241
65699
  } else {
68242
65700
  break;
68243
65701
  }
@@ -68506,7 +65964,7 @@ async function handleSelection(ctx) {
68506
65964
  }
68507
65965
  }
68508
65966
  }
68509
- const resolvedDir = resolve13(targetDir);
65967
+ const resolvedDir = resolve14(targetDir);
68510
65968
  logger.info(`Target directory: ${resolvedDir}`);
68511
65969
  if (!ctx.options.global && PathResolver.isLocalSameAsGlobal(resolvedDir)) {
68512
65970
  logger.warning("You're at HOME directory. Installing here modifies your GLOBAL Takumi.");
@@ -68704,7 +66162,7 @@ async function handleSelection(ctx) {
68704
66162
  }
68705
66163
  // src/commands/init/phases/sync-handler.ts
68706
66164
  import { copyFile as copyFile7, mkdir as mkdir25, open as open3, readFile as readFile33, rename as rename4, stat as stat10, unlink as unlink11, writeFile as writeFile27 } from "node:fs/promises";
68707
- import { dirname as dirname17, join as join81, resolve as resolve14 } from "node:path";
66165
+ import { dirname as dirname18, join as join81, resolve as resolve15 } from "node:path";
68708
66166
  init_logger();
68709
66167
  init_path_resolver();
68710
66168
  var import_fs_extra31 = __toESM(require_lib(), 1);
@@ -68713,7 +66171,7 @@ async function handleSync(ctx) {
68713
66171
  if (!ctx.options.sync) {
68714
66172
  return ctx;
68715
66173
  }
68716
- const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve14(ctx.options.dir || ".");
66174
+ const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve15(ctx.options.dir || ".");
68717
66175
  const claudeDir = ctx.options.global ? resolvedDir : join81(resolvedDir, ".claude");
68718
66176
  if (!await import_fs_extra31.pathExists(claudeDir)) {
68719
66177
  logger.error("Cannot sync: no .claude directory found");
@@ -68813,7 +66271,7 @@ async function acquireSyncLock(global3) {
68813
66271
  const lockPath = join81(cacheDir, ".sync-lock");
68814
66272
  const startTime = Date.now();
68815
66273
  const lockTimeout = getLockTimeout();
68816
- await mkdir25(dirname17(lockPath), { recursive: true });
66274
+ await mkdir25(dirname18(lockPath), { recursive: true });
68817
66275
  while (Date.now() - startTime < lockTimeout) {
68818
66276
  try {
68819
66277
  const handle = await open3(lockPath, "wx");
@@ -68837,7 +66295,7 @@ async function acquireSyncLock(global3) {
68837
66295
  }
68838
66296
  logger.debug(`Lock stat failed: ${statError}`);
68839
66297
  }
68840
- await new Promise((resolve15) => setTimeout(resolve15, 100));
66298
+ await new Promise((resolve16) => setTimeout(resolve16, 100));
68841
66299
  continue;
68842
66300
  }
68843
66301
  throw err;
@@ -69662,7 +67120,7 @@ var import_picocolors25 = __toESM(require_picocolors(), 1);
69662
67120
  import { existsSync as existsSync37 } from "node:fs";
69663
67121
  import { readFile as readFile41, rm as rm11, unlink as unlink12 } from "node:fs/promises";
69664
67122
  import { homedir as homedir18 } from "node:os";
69665
- import { basename as basename6, join as join90, resolve as resolve16 } from "node:path";
67123
+ import { basename as basename6, join as join90, resolve as resolve17 } from "node:path";
69666
67124
  init_logger();
69667
67125
 
69668
67126
  // src/commands/portable/config-discovery.ts
@@ -69953,7 +67411,7 @@ async function resolveConflict(action, options2) {
69953
67411
  init_provider_registry();
69954
67412
  import { existsSync as existsSync33, mkdirSync, renameSync, rmSync as rmSync4, writeFileSync as writeFileSync3 } from "node:fs";
69955
67413
  import { readFile as readFile37 } from "node:fs/promises";
69956
- import { basename as basename5, dirname as dirname18, join as join87 } from "node:path";
67414
+ import { basename as basename5, dirname as dirname19, join as join87 } from "node:path";
69957
67415
  async function inspectHooksSettings(settingsPath) {
69958
67416
  try {
69959
67417
  if (!existsSync33(settingsPath)) {
@@ -70048,7 +67506,7 @@ async function mergeHooksIntoSettings(targetSettingsPath, newHooks) {
70048
67506
  const existingHooks = existingSettings.hooks ?? {};
70049
67507
  const merged = deduplicateMerge(existingHooks, newHooks);
70050
67508
  existingSettings.hooks = merged;
70051
- const dir = dirname18(targetSettingsPath);
67509
+ const dir = dirname19(targetSettingsPath);
70052
67510
  mkdirSync(dir, { recursive: true });
70053
67511
  const tempPath = `${targetSettingsPath}.tmp`;
70054
67512
  try {
@@ -71106,7 +68564,7 @@ function buildPlan(actions) {
71106
68564
  // src/commands/skills/skills-discovery.ts
71107
68565
  import { readFile as readFile40, readdir as readdir28, stat as stat11 } from "node:fs/promises";
71108
68566
  import { homedir as homedir17 } from "node:os";
71109
- import { dirname as dirname19, join as join88 } from "node:path";
68567
+ import { dirname as dirname20, join as join88 } from "node:path";
71110
68568
  init_logger();
71111
68569
  var import_gray_matter4 = __toESM(require_gray_matter(), 1);
71112
68570
  var home5 = homedir17();
@@ -71133,7 +68591,7 @@ async function parseSkillMd(skillMdPath) {
71133
68591
  try {
71134
68592
  const content = await readFile40(skillMdPath, "utf-8");
71135
68593
  const { data } = import_gray_matter4.default(content);
71136
- const skillDir = dirname19(skillMdPath);
68594
+ const skillDir = dirname20(skillMdPath);
71137
68595
  const dirName = skillDir.split(/[/\\]/).pop() || "";
71138
68596
  if (!dirName) {
71139
68597
  logger.verbose(`Skipping ${skillMdPath}: cannot determine skill directory`);
@@ -71221,7 +68679,7 @@ function resolveMigrationScope(argv, options2) {
71221
68679
  // src/commands/migrate/skill-directory-installer.ts
71222
68680
  import { existsSync as existsSync36 } from "node:fs";
71223
68681
  import { cp as cp2, mkdir as mkdir26, rename as rename6, rm as rm10 } from "node:fs/promises";
71224
- import { join as join89, resolve as resolve15 } from "node:path";
68682
+ import { join as join89, resolve as resolve16 } from "node:path";
71225
68683
  init_provider_registry();
71226
68684
  async function installSkillDirectories(skills, targetProviders, options2) {
71227
68685
  const results = [];
@@ -71251,7 +68709,7 @@ async function installSkillDirectories(skills, targetProviders, options2) {
71251
68709
  }
71252
68710
  for (const skill of skills) {
71253
68711
  const targetDir = join89(basePath, skill.name);
71254
- if (resolve15(skill.path) === resolve15(targetDir)) {
68712
+ if (resolve16(skill.path) === resolve16(targetDir)) {
71255
68713
  results.push({
71256
68714
  provider,
71257
68715
  providerDisplayName: config.displayName,
@@ -71350,7 +68808,7 @@ function shouldExecuteAction(action) {
71350
68808
  }
71351
68809
  async function executeDeleteAction(action, options2) {
71352
68810
  const preservePaths = options2?.preservePaths ?? new Set;
71353
- const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve16(action.targetPath));
68811
+ const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve17(action.targetPath));
71354
68812
  try {
71355
68813
  if (!shouldPreserveTarget && action.targetPath && existsSync37(action.targetPath)) {
71356
68814
  await rm11(action.targetPath, { recursive: true, force: true });
@@ -71377,7 +68835,7 @@ async function executeDeleteAction(action, options2) {
71377
68835
  async function processMetadataDeletions(skillSourcePath, installGlobally) {
71378
68836
  if (!skillSourcePath)
71379
68837
  return;
71380
- const sourceMetadataPath = join90(resolve16(skillSourcePath, ".."), "metadata.json");
68838
+ const sourceMetadataPath = join90(resolve17(skillSourcePath, ".."), "metadata.json");
71381
68839
  if (!existsSync37(sourceMetadataPath))
71382
68840
  return;
71383
68841
  let sourceMetadata;
@@ -71768,7 +69226,7 @@ async function migrateCommand(options2) {
71768
69226
  }
71769
69227
  }
71770
69228
  await processMetadataDeletions(skillSource, installGlobally);
71771
- const writtenPaths = new Set(allResults.filter((result) => result.success && !result.skipped && result.path.length > 0).map((result) => resolve16(result.path)));
69229
+ const writtenPaths = new Set(allResults.filter((result) => result.success && !result.skipped && result.path.length > 0).map((result) => resolve17(result.path)));
71772
69230
  for (const deleteAction of plannedDeleteActions) {
71773
69231
  allResults.push(await executeDeleteAction(deleteAction, {
71774
69232
  preservePaths: writtenPaths
@@ -71796,7 +69254,7 @@ async function migrateCommand(options2) {
71796
69254
  }
71797
69255
  }
71798
69256
  try {
71799
- const kitRoot = (agentSource ? resolve16(agentSource, "..") : null) ?? (commandSource ? resolve16(commandSource, "..") : null) ?? (skillSource ? resolve16(skillSource, "..") : null) ?? null;
69257
+ const kitRoot = (agentSource ? resolve17(agentSource, "..") : null) ?? (commandSource ? resolve17(commandSource, "..") : null) ?? (skillSource ? resolve17(skillSource, "..") : null) ?? null;
71800
69258
  const manifest = kitRoot ? await loadPortableManifest(kitRoot) : null;
71801
69259
  if (manifest?.cliVersion) {
71802
69260
  await updateAppliedManifestVersion(manifest.cliVersion);
@@ -71943,7 +69401,7 @@ init_types2();
71943
69401
  var import_picocolors26 = __toESM(require_picocolors(), 1);
71944
69402
 
71945
69403
  // src/commands/new/phases/directory-setup.ts
71946
- import { resolve as resolve17 } from "node:path";
69404
+ import { resolve as resolve18 } from "node:path";
71947
69405
  init_logger();
71948
69406
  init_path_resolver();
71949
69407
  init_types2();
@@ -72028,7 +69486,7 @@ async function directorySetup(validOptions, prompts) {
72028
69486
  targetDir = await prompts.getDirectory(targetDir);
72029
69487
  }
72030
69488
  }
72031
- const resolvedDir = resolve17(targetDir);
69489
+ const resolvedDir = resolve18(targetDir);
72032
69490
  logger.info(`Target directory: ${resolvedDir}`);
72033
69491
  if (PathResolver.isLocalSameAsGlobal(resolvedDir)) {
72034
69492
  logger.warning("You're creating a project at HOME directory.");
@@ -72628,19 +70086,19 @@ Example: tkm new --use-git --release v2.1.0`);
72628
70086
  // src/commands/plan/plan-command.ts
72629
70087
  init_output_manager();
72630
70088
  import { existsSync as existsSync42, statSync as statSync5 } from "node:fs";
72631
- import { dirname as dirname25, join as join97, parse as parse2, resolve as resolve21 } from "node:path";
70089
+ import { dirname as dirname26, join as join97, parse as parse2, resolve as resolve22 } from "node:path";
72632
70090
 
72633
70091
  // src/commands/plan/plan-read-handlers.ts
72634
70092
  import { existsSync as existsSync41, statSync as statSync4 } from "node:fs";
72635
- import { basename as basename9, dirname as dirname24, join as join96, relative as relative18, resolve as resolve19 } from "node:path";
70093
+ import { basename as basename9, dirname as dirname25, join as join96, relative as relative18, resolve as resolve20 } from "node:path";
72636
70094
 
72637
70095
  // src/domains/plan-parser/index.ts
72638
- import { dirname as dirname23 } from "node:path";
70096
+ import { dirname as dirname24 } from "node:path";
72639
70097
 
72640
70098
  // src/domains/plan-parser/plan-table-parser.ts
72641
70099
  var import_gray_matter5 = __toESM(require_gray_matter(), 1);
72642
70100
  import { readFileSync as readFileSync12 } from "node:fs";
72643
- import { dirname as dirname20, resolve as resolve18 } from "node:path";
70101
+ import { dirname as dirname21, resolve as resolve19 } from "node:path";
72644
70102
  function normalizeStatus(raw) {
72645
70103
  const s3 = raw.toLowerCase().trim();
72646
70104
  if (s3.includes("complete") || s3.includes("done") || s3.includes("✓") || s3.includes("✅")) {
@@ -72724,7 +70182,7 @@ function parseHeaderAwareTable(content, dir, options2) {
72724
70182
  hasLinks = true;
72725
70183
  linkText = linkMatch[1].trim();
72726
70184
  name = filenameToTitle(linkText);
72727
- file = resolve18(dir, linkMatch[2]);
70185
+ file = resolve19(dir, linkMatch[2]);
72728
70186
  } else {
72729
70187
  name = nameRaw.replace(/\[.*?\]\(.*?\)/g, "").trim() || `Phase ${phaseId}`;
72730
70188
  linkText = name;
@@ -72764,7 +70222,7 @@ function parseFormat1(content, dir, options2) {
72764
70222
  phaseId,
72765
70223
  name: name.trim(),
72766
70224
  status: normalizeStatus(status2),
72767
- file: resolve18(dir, linkPath),
70225
+ file: resolve19(dir, linkPath),
72768
70226
  linkText: linkText.trim(),
72769
70227
  anchor
72770
70228
  });
@@ -72784,7 +70242,7 @@ function parseFormat2(content, dir, options2) {
72784
70242
  phaseId,
72785
70243
  name: name.trim(),
72786
70244
  status: normalizeStatus(status2),
72787
- file: resolve18(dir, linkPath),
70245
+ file: resolve19(dir, linkPath),
72788
70246
  linkText,
72789
70247
  anchor
72790
70248
  });
@@ -72803,7 +70261,7 @@ function parseFormat2b(content, dir, options2) {
72803
70261
  phaseId,
72804
70262
  name: name.trim(),
72805
70263
  status: normalizeStatus(status2),
72806
- file: resolve18(dir, linkPath),
70264
+ file: resolve19(dir, linkPath),
72807
70265
  linkText: name.trim(),
72808
70266
  anchor
72809
70267
  });
@@ -72901,8 +70359,8 @@ function parseFormat4(content, planFilePath, options2) {
72901
70359
  const hasCheck = /[✅✓]/.test(line);
72902
70360
  current = { name, status: hasCheck ? "completed" : "pending" };
72903
70361
  } else if (fileMatch && current) {
72904
- const planDir = dirname20(planFilePath);
72905
- current.file = resolve18(planDir, fileMatch[1].trim());
70362
+ const planDir = dirname21(planFilePath);
70363
+ current.file = resolve19(planDir, fileMatch[1].trim());
72906
70364
  } else if (statusMatch && current) {
72907
70365
  current.status = normalizeStatus(statusMatch[2]);
72908
70366
  }
@@ -72968,7 +70426,7 @@ function parseFormat6(content, dir, options2) {
72968
70426
  phaseId,
72969
70427
  name: phaseName,
72970
70428
  status: checked.toLowerCase() === "x" ? "completed" : "pending",
72971
- file: resolve18(dir, linkPath),
70429
+ file: resolve19(dir, linkPath),
72972
70430
  linkText: phaseName,
72973
70431
  anchor
72974
70432
  });
@@ -73006,7 +70464,7 @@ function parsePhasesFromBody(body, dir, options2) {
73006
70464
  }
73007
70465
  function parsePlanFile(planFilePath, options2) {
73008
70466
  const content = readFileSync12(planFilePath, "utf8");
73009
- const dir = dirname20(planFilePath);
70467
+ const dir = dirname21(planFilePath);
73010
70468
  const { data: frontmatter, content: body } = import_gray_matter5.default(content);
73011
70469
  const phases = parsePhasesFromBody(body, dir, options2);
73012
70470
  return { frontmatter, phases };
@@ -73026,10 +70484,10 @@ function scanPlanDir(dir) {
73026
70484
  // src/domains/plan-parser/plan-validator.ts
73027
70485
  var import_gray_matter6 = __toESM(require_gray_matter(), 1);
73028
70486
  import { existsSync as existsSync39, readFileSync as readFileSync13 } from "node:fs";
73029
- import { basename as basename7, dirname as dirname21 } from "node:path";
70487
+ import { basename as basename7, dirname as dirname22 } from "node:path";
73030
70488
  function validatePlanFile(filePath, strict = false) {
73031
70489
  const content = readFileSync13(filePath, "utf8");
73032
- const dir = dirname21(filePath);
70490
+ const dir = dirname22(filePath);
73033
70491
  const issues = [];
73034
70492
  const lines = content.split(`
73035
70493
  `);
@@ -73087,7 +70545,7 @@ function validatePlanFile(filePath, strict = false) {
73087
70545
  var import_gray_matter7 = __toESM(require_gray_matter(), 1);
73088
70546
  import { mkdirSync as mkdirSync2, readFileSync as readFileSync14, writeFileSync as writeFileSync4 } from "node:fs";
73089
70547
  import { existsSync as existsSync40 } from "node:fs";
73090
- import { basename as basename8, dirname as dirname22, join as join95 } from "node:path";
70548
+ import { basename as basename8, dirname as dirname23, join as join95 } from "node:path";
73091
70549
  function phaseNameToFilename(id, name) {
73092
70550
  const numMatch = /^(\d+)([a-z]*)$/i.exec(id);
73093
70551
  const num = numMatch ? numMatch[1] : id;
@@ -73266,7 +70724,7 @@ function updatePhaseStatus(planFile, phaseId, newStatus) {
73266
70724
  const updatedFrontmatter = { ...frontmatter, status: planStatus };
73267
70725
  const updatedContent = import_gray_matter7.default.stringify(updatedBody, updatedFrontmatter);
73268
70726
  writeFileSync4(planFile, updatedContent, "utf8");
73269
- const planDir = dirname22(planFile);
70727
+ const planDir = dirname23(planFile);
73270
70728
  const phaseFilename = phaseNameFilenameFromTableRow(updatedBody, phaseId, planDir);
73271
70729
  if (phaseFilename && existsSync40(phaseFilename)) {
73272
70730
  updatePhaseFileFrontmatter(phaseFilename, newStatus);
@@ -73298,7 +70756,7 @@ function addPhase(planFile, name, afterId) {
73298
70756
  throw new Error("Non-canonical plan.md — cannot add phase");
73299
70757
  }
73300
70758
  const { data: frontmatter, content: body } = import_gray_matter7.default(raw);
73301
- const planDir = dirname22(planFile);
70759
+ const planDir = dirname23(planFile);
73302
70760
  const existingIds = [];
73303
70761
  for (const match2 of body.matchAll(/^\|\s*(\d+[a-z]?)\s*\|/gim)) {
73304
70762
  existingIds.push(match2[1].toLowerCase());
@@ -73373,7 +70831,7 @@ function buildPlanSummary(planFile) {
73373
70831
  const inProgress = phases.filter((p2) => p2.status === "in-progress").length;
73374
70832
  const pending = phases.filter((p2) => p2.status === "pending").length;
73375
70833
  return {
73376
- planDir: dirname23(planFile),
70834
+ planDir: dirname24(planFile),
73377
70835
  planFile,
73378
70836
  title: typeof frontmatter.title === "string" ? frontmatter.title : undefined,
73379
70837
  description: typeof frontmatter.description === "string" ? frontmatter.description : undefined,
@@ -73410,7 +70868,7 @@ async function handleParse(target, options2) {
73410
70868
  console.log(JSON.stringify({ file: relative18(process.cwd(), planFile), frontmatter, phases }, null, 2));
73411
70869
  return;
73412
70870
  }
73413
- const title = typeof frontmatter.title === "string" ? frontmatter.title : basename9(dirname24(planFile));
70871
+ const title = typeof frontmatter.title === "string" ? frontmatter.title : basename9(dirname25(planFile));
73414
70872
  console.log();
73415
70873
  console.log(import_picocolors27.default.bold(` Plan: ${title}`));
73416
70874
  console.log(` File: ${planFile}`);
@@ -73464,7 +70922,7 @@ async function handleValidate(target, options2) {
73464
70922
  process.exitCode = 1;
73465
70923
  }
73466
70924
  async function handleStatus(target, options2) {
73467
- const t = target ? resolve19(target) : null;
70925
+ const t = target ? resolve20(target) : null;
73468
70926
  const plansDir = t && existsSync41(t) && statSync4(t).isDirectory() && !existsSync41(join96(t, "plan.md")) ? t : null;
73469
70927
  if (plansDir) {
73470
70928
  const planFiles = scanPlanDir(plansDir);
@@ -73490,14 +70948,14 @@ async function handleStatus(target, options2) {
73490
70948
  try {
73491
70949
  const s3 = buildPlanSummary(pf);
73492
70950
  const bar = progressBar(s3.completed, s3.totalPhases);
73493
- const title2 = s3.title ?? basename9(dirname24(pf));
70951
+ const title2 = s3.title ?? basename9(dirname25(pf));
73494
70952
  console.log(` ${import_picocolors27.default.bold(title2)}`);
73495
70953
  console.log(` ${bar}`);
73496
70954
  if (s3.inProgress > 0)
73497
70955
  console.log(` [~] ${s3.inProgress} in progress`);
73498
70956
  console.log();
73499
70957
  } catch {
73500
- console.log(` [X] Failed to read: ${basename9(dirname24(pf))}`);
70958
+ console.log(` [X] Failed to read: ${basename9(dirname25(pf))}`);
73501
70959
  console.log();
73502
70960
  }
73503
70961
  }
@@ -73521,7 +70979,7 @@ async function handleStatus(target, options2) {
73521
70979
  console.log(JSON.stringify(summary, null, 2));
73522
70980
  return;
73523
70981
  }
73524
- const title = summary.title ?? basename9(dirname24(planFile));
70982
+ const title = summary.title ?? basename9(dirname25(planFile));
73525
70983
  console.log();
73526
70984
  console.log(import_picocolors27.default.bold(` ${title}`));
73527
70985
  if (summary.status)
@@ -73547,7 +71005,7 @@ async function handleKanban(target, _options) {
73547
71005
  }
73548
71006
 
73549
71007
  // src/commands/plan/plan-write-handlers.ts
73550
- import { basename as basename10, relative as relative19, resolve as resolve20 } from "node:path";
71008
+ import { basename as basename10, relative as relative19, resolve as resolve21 } from "node:path";
73551
71009
  init_output_manager();
73552
71010
  var import_picocolors28 = __toESM(require_picocolors(), 1);
73553
71011
  async function handleCreate(target, options2) {
@@ -73583,7 +71041,7 @@ async function handleCreate(target, options2) {
73583
71041
  const result = scaffoldPlan({
73584
71042
  title: options2.title,
73585
71043
  phases: phaseNames.map((name) => ({ name })),
73586
- dir: resolve20(dir),
71044
+ dir: resolve21(dir),
73587
71045
  priority,
73588
71046
  issue: options2.issue ? Number(options2.issue) : undefined
73589
71047
  });
@@ -73597,7 +71055,7 @@ async function handleCreate(target, options2) {
73597
71055
  }
73598
71056
  console.log();
73599
71057
  console.log(import_picocolors28.default.bold(` [OK] Plan created: ${options2.title}`));
73600
- console.log(` Directory: ${resolve20(dir)}`);
71058
+ console.log(` Directory: ${resolve21(dir)}`);
73601
71059
  console.log(` Phases: ${result.phaseFiles.length}`);
73602
71060
  for (const f4 of result.phaseFiles) {
73603
71061
  console.log(` [ ] ${basename10(f4)}`);
@@ -73695,7 +71153,7 @@ async function handleAddPhase(target, options2) {
73695
71153
 
73696
71154
  // src/commands/plan/plan-command.ts
73697
71155
  function resolvePlanFile(target) {
73698
- const t = target ? resolve21(target) : process.cwd();
71156
+ const t = target ? resolve22(target) : process.cwd();
73699
71157
  if (existsSync42(t)) {
73700
71158
  const stat12 = statSync5(t);
73701
71159
  if (stat12.isFile())
@@ -73711,7 +71169,7 @@ function resolvePlanFile(target) {
73711
71169
  const candidate = join97(dir, "plan.md");
73712
71170
  if (existsSync42(candidate))
73713
71171
  return candidate;
73714
- dir = dirname25(dir);
71172
+ dir = dirname26(dir);
73715
71173
  }
73716
71174
  }
73717
71175
  return null;
@@ -73759,7 +71217,7 @@ async function planCommand(action, target, options2) {
73759
71217
  let resolvedTarget = target;
73760
71218
  if (resolvedAction && !knownActions.has(resolvedAction)) {
73761
71219
  const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
73762
- const existsOnDisk = !looksLikePath && existsSync42(resolve21(resolvedAction));
71220
+ const existsOnDisk = !looksLikePath && existsSync42(resolve22(resolvedAction));
73763
71221
  if (looksLikePath || existsOnDisk) {
73764
71222
  resolvedTarget = resolvedAction;
73765
71223
  resolvedAction = undefined;
@@ -73798,7 +71256,7 @@ async function planCommand(action, target, options2) {
73798
71256
  }
73799
71257
  // src/commands/projects/add-handler.ts
73800
71258
  import { existsSync as existsSync43 } from "node:fs";
73801
- import { resolve as resolve22 } from "node:path";
71259
+ import { resolve as resolve23 } from "node:path";
73802
71260
  // src/domains/takumi-data/claude-projects-scanner.ts
73803
71261
  init_logger();
73804
71262
  init_path_resolver();
@@ -73808,7 +71266,7 @@ var import_picocolors29 = __toESM(require_picocolors(), 1);
73808
71266
  async function handleAdd(projectPath, options2) {
73809
71267
  logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
73810
71268
  intro("Add Project");
73811
- const absolutePath = resolve22(projectPath);
71269
+ const absolutePath = resolve23(projectPath);
73812
71270
  if (!existsSync43(absolutePath)) {
73813
71271
  log.error(`Path does not exist: ${absolutePath}`);
73814
71272
  process.exitCode = 1;
@@ -74326,14 +71784,14 @@ function isSkillInstalled(skillName, agent, options2) {
74326
71784
  import { existsSync as existsSync46 } from "node:fs";
74327
71785
  import { cp as cp3, mkdir as mkdir28, rm as rm12, stat as stat12 } from "node:fs/promises";
74328
71786
  import { homedir as homedir21 } from "node:os";
74329
- import { dirname as dirname27, join as join100, resolve as resolve23 } from "node:path";
71787
+ import { dirname as dirname28, join as join100, resolve as resolve24 } from "node:path";
74330
71788
 
74331
71789
  // src/commands/skills/skills-registry.ts
74332
71790
  init_zod();
74333
71791
  import { existsSync as existsSync45 } from "node:fs";
74334
71792
  import { mkdir as mkdir27, readFile as readFile43, writeFile as writeFile30 } from "node:fs/promises";
74335
71793
  import { homedir as homedir20 } from "node:os";
74336
- import { dirname as dirname26, join as join99, sep as sep5 } from "node:path";
71794
+ import { dirname as dirname27, join as join99, sep as sep5 } from "node:path";
74337
71795
  var home7 = homedir20();
74338
71796
  var REGISTRY_PATH2 = join99(home7, ".sunagentkit", "skill-registry.json");
74339
71797
  var SkillInstallationSchema = exports_external.object({
@@ -74355,9 +71813,9 @@ function getCliVersion4() {
74355
71813
  return process.env.npm_package_version;
74356
71814
  }
74357
71815
  const { readFileSync: readFileSync15 } = __require("node:fs");
74358
- const { dirname: dirname27, join: joinPath } = __require("node:path");
71816
+ const { dirname: dirname28, join: joinPath } = __require("node:path");
74359
71817
  const { fileURLToPath: fileURLToPath4 } = __require("node:url");
74360
- const __dirname3 = dirname27(fileURLToPath4(import.meta.url));
71818
+ const __dirname3 = dirname28(fileURLToPath4(import.meta.url));
74361
71819
  const pkgPath = joinPath(__dirname3, "../../../package.json");
74362
71820
  const pkg = JSON.parse(readFileSync15(pkgPath, "utf-8"));
74363
71821
  return pkg.version || "unknown";
@@ -74412,7 +71870,7 @@ async function readRegistry() {
74412
71870
  }
74413
71871
  }
74414
71872
  async function writeRegistry(registry) {
74415
- const dir = dirname26(REGISTRY_PATH2);
71873
+ const dir = dirname27(REGISTRY_PATH2);
74416
71874
  if (!existsSync45(dir)) {
74417
71875
  await mkdir27(dir, { recursive: true });
74418
71876
  }
@@ -74478,7 +71936,7 @@ var LEGACY_SKILL_PATHS = {
74478
71936
  };
74479
71937
  function isSamePath2(path1, path22) {
74480
71938
  try {
74481
- return resolve23(path1) === resolve23(path22);
71939
+ return resolve24(path1) === resolve24(path22);
74482
71940
  } catch {
74483
71941
  return false;
74484
71942
  }
@@ -74544,7 +72002,7 @@ async function installSkillForAgent(skill, agent, options2) {
74544
72002
  try {
74545
72003
  await cleanupLegacySkillPath(skill.name, agent, options2.global);
74546
72004
  } catch {}
74547
- const parentDir = dirname27(targetPath);
72005
+ const parentDir = dirname28(targetPath);
74548
72006
  if (!existsSync46(parentDir)) {
74549
72007
  await mkdir28(parentDir, { recursive: true });
74550
72008
  }
@@ -75494,13 +72952,13 @@ async function detectInstallations() {
75494
72952
 
75495
72953
  // src/commands/uninstall/removal-handler.ts
75496
72954
  import { readdirSync as readdirSync8, rmSync as rmSync6 } from "node:fs";
75497
- import { join as join105, resolve as resolve24, sep as sep6 } from "node:path";
72955
+ import { join as join105, resolve as resolve25, sep as sep6 } from "node:path";
75498
72956
  init_logger();
75499
72957
  var import_fs_extra36 = __toESM(require_lib(), 1);
75500
72958
 
75501
72959
  // src/commands/uninstall/analysis-handler.ts
75502
72960
  import { readdirSync as readdirSync7, rmSync as rmSync5 } from "node:fs";
75503
- import { dirname as dirname28, join as join104 } from "node:path";
72961
+ import { dirname as dirname29, join as join104 } from "node:path";
75504
72962
  init_logger();
75505
72963
  var import_picocolors33 = __toESM(require_picocolors(), 1);
75506
72964
  function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
@@ -75517,7 +72975,7 @@ function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
75517
72975
  }
75518
72976
  async function cleanupEmptyDirectories3(filePath, installationRoot) {
75519
72977
  let cleaned = 0;
75520
- let currentDir = dirname28(filePath);
72978
+ let currentDir = dirname29(filePath);
75521
72979
  while (currentDir !== installationRoot && currentDir.startsWith(installationRoot)) {
75522
72980
  try {
75523
72981
  const entries = readdirSync7(currentDir);
@@ -75525,7 +72983,7 @@ async function cleanupEmptyDirectories3(filePath, installationRoot) {
75525
72983
  rmSync5(currentDir, { recursive: true });
75526
72984
  cleaned++;
75527
72985
  logger.debug(`Removed empty directory: ${currentDir}`);
75528
- currentDir = dirname28(currentDir);
72986
+ currentDir = dirname29(currentDir);
75529
72987
  } else {
75530
72988
  break;
75531
72989
  }
@@ -75631,8 +73089,8 @@ async function isDirectory(filePath) {
75631
73089
  }
75632
73090
  async function isPathSafeToRemove(filePath, baseDir) {
75633
73091
  try {
75634
- const resolvedPath = resolve24(filePath);
75635
- const resolvedBase = resolve24(baseDir);
73092
+ const resolvedPath = resolve25(filePath);
73093
+ const resolvedBase = resolve25(baseDir);
75636
73094
  if (!resolvedPath.startsWith(resolvedBase + sep6) && resolvedPath !== resolvedBase) {
75637
73095
  logger.debug(`Path outside installation directory: ${filePath}`);
75638
73096
  return false;
@@ -75640,7 +73098,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
75640
73098
  const stats = await import_fs_extra36.lstat(filePath);
75641
73099
  if (stats.isSymbolicLink()) {
75642
73100
  const realPath = await import_fs_extra36.realpath(filePath);
75643
- const resolvedReal = resolve24(realPath);
73101
+ const resolvedReal = resolve25(realPath);
75644
73102
  if (!resolvedReal.startsWith(resolvedBase + sep6) && resolvedReal !== resolvedBase) {
75645
73103
  logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
75646
73104
  return false;
@@ -76043,7 +73501,7 @@ var import_fs_extra37 = __toESM(require_lib(), 1);
76043
73501
  // package.json
76044
73502
  var package_default = {
76045
73503
  name: "@sunasteriskrnd/takumi",
76046
- version: "1.0.0-dev.4",
73504
+ version: "1.0.0-dev.5",
76047
73505
  description: "CLI tool for bootstrapping and managing Takumi projects",
76048
73506
  type: "module",
76049
73507
  repository: {
@@ -76063,7 +73521,7 @@ var package_default = {
76063
73521
  ],
76064
73522
  scripts: {
76065
73523
  dev: "bun run src/index.ts",
76066
- build: `bun build src/index.ts --outdir dist --target node --external @octokit/rest --external better-sqlite3 && node -e "const fs=require('fs'),f='dist/index.js',c=fs.readFileSync(f,'utf-8');fs.writeFileSync(f,c.replace(/^#!.*\\n\\/\\/ @bun\\n/,''))"`,
73524
+ build: `bun build src/index.ts --outdir dist --target node --external @octokit/rest --external better-sqlite3 --external yauzl-promise --external @node-rs/crc32 && node -e "const fs=require('fs'),f='dist/index.js',c=fs.readFileSync(f,'utf-8');fs.writeFileSync(f,c.replace(/^#!.*\\n\\/\\/ @bun\\n/,''))"`,
76067
73525
  "verify:package": "node scripts/prepublish-check.js",
76068
73526
  test: "bun test",
76069
73527
  "test:integration": "CK_RUN_CLI_INTEGRATION=1 bun test tests/integration/cli.test.ts",
@@ -76102,7 +73560,6 @@ var package_default = {
76102
73560
  "cli-progress": "^3.12.0",
76103
73561
  "compare-versions": "^6.1.1",
76104
73562
  diff: "^8.0.3",
76105
- "extract-zip": "^2.0.1",
76106
73563
  "fs-extra": "^11.2.0",
76107
73564
  "gray-matter": "^4.0.3",
76108
73565
  ignore: "^5.3.2",
@@ -76116,6 +73573,7 @@ var package_default = {
76116
73573
  semver: "^7.7.3",
76117
73574
  tar: "^7.4.3",
76118
73575
  tmp: "^0.2.3",
73576
+ "yauzl-promise": "^4.0.0",
76119
73577
  zod: "^3.23.8"
76120
73578
  },
76121
73579
  devDependencies: {
@@ -76133,6 +73591,7 @@ var package_default = {
76133
73591
  "@types/semver": "^7.7.1",
76134
73592
  "@types/tar": "^6.1.13",
76135
73593
  "@types/tmp": "^0.2.6",
73594
+ "@types/yauzl-promise": "^4.0.1",
76136
73595
  "conventional-changelog-conventionalcommits": "^9.1.0",
76137
73596
  "semantic-release": "^25.0.0",
76138
73597
  typescript: "^5.7.2"
@@ -76354,12 +73813,12 @@ async function promptKitUpdate(beta, yes, deps) {
76354
73813
  args.push("--beta");
76355
73814
  const displayCmd = `tkm ${args.join(" ")}`;
76356
73815
  logger.info(`Running: ${displayCmd}`);
76357
- const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve25) => {
73816
+ const spawnFn = deps?.spawnInitFn ?? ((spawnArgs) => new Promise((resolve26) => {
76358
73817
  const child = spawn2("tkm", spawnArgs, { stdio: "inherit", shell: true });
76359
- child.on("close", (code) => resolve25(code ?? 1));
73818
+ child.on("close", (code) => resolve26(code ?? 1));
76360
73819
  child.on("error", (err) => {
76361
73820
  logger.verbose(`Failed to spawn tkm init: ${err.message}`);
76362
- resolve25(1);
73821
+ resolve26(1);
76363
73822
  });
76364
73823
  }));
76365
73824
  const exitCode = await spawnFn(args);
@@ -76392,9 +73851,9 @@ async function promptMigrateUpdate(deps) {
76392
73851
  let migrateProviders = "auto";
76393
73852
  try {
76394
73853
  const ckConfig = await loadFullConfigFn(null);
76395
- const pipeline = ckConfig.config.updatePipeline;
76396
- autoMigrate = pipeline?.autoMigrateAfterUpdate ?? false;
76397
- migrateProviders = pipeline?.migrateProviders ?? "auto";
73854
+ const pipeline2 = ckConfig.config.updatePipeline;
73855
+ autoMigrate = pipeline2?.autoMigrateAfterUpdate ?? false;
73856
+ migrateProviders = pipeline2?.migrateProviders ?? "auto";
76398
73857
  } catch {}
76399
73858
  if (!autoMigrate)
76400
73859
  return;
@@ -76794,7 +74253,7 @@ function getDisclaimerMarker() {
76794
74253
  return AI_DISCLAIMER;
76795
74254
  }
76796
74255
  function spawnAndCollect2(command, args) {
76797
- return new Promise((resolve25, reject) => {
74256
+ return new Promise((resolve26, reject) => {
76798
74257
  const child = spawn4(command, args, { stdio: ["ignore", "pipe", "pipe"] });
76799
74258
  const chunks = [];
76800
74259
  const stderrChunks = [];
@@ -76807,7 +74266,7 @@ function spawnAndCollect2(command, args) {
76807
74266
  reject(new Error(`${command} exited with code ${code}: ${stderr}`));
76808
74267
  return;
76809
74268
  }
76810
- resolve25(Buffer.concat(chunks).toString("utf-8"));
74269
+ resolve26(Buffer.concat(chunks).toString("utf-8"));
76811
74270
  });
76812
74271
  });
76813
74272
  }
@@ -76907,7 +74366,7 @@ function formatResponse(content) {
76907
74366
  return disclaimer + formatted;
76908
74367
  }
76909
74368
  async function postViaGh(owner, repo, issueNumber, body) {
76910
- return new Promise((resolve25, reject) => {
74369
+ return new Promise((resolve26, reject) => {
76911
74370
  const args = [
76912
74371
  "issue",
76913
74372
  "comment",
@@ -76929,7 +74388,7 @@ async function postViaGh(owner, repo, issueNumber, body) {
76929
74388
  reject(new Error(`gh exited with code ${code}: ${stderr}`));
76930
74389
  return;
76931
74390
  }
76932
- resolve25();
74391
+ resolve26();
76933
74392
  });
76934
74393
  });
76935
74394
  }
@@ -77047,7 +74506,7 @@ After completing the implementation:
77047
74506
  "--allowedTools",
77048
74507
  tools
77049
74508
  ];
77050
- await new Promise((resolve25, reject) => {
74509
+ await new Promise((resolve26, reject) => {
77051
74510
  const child = spawn6("claude", args, { cwd: cwd2, stdio: ["pipe", "pipe", "pipe"], detached: false });
77052
74511
  child.stdin.write(prompt);
77053
74512
  child.stdin.end();
@@ -77072,7 +74531,7 @@ After completing the implementation:
77072
74531
  reject(new Error(`Claude exited ${code}: ${stderr.slice(0, 500)}`));
77073
74532
  return;
77074
74533
  }
77075
- resolve25();
74534
+ resolve26();
77076
74535
  });
77077
74536
  });
77078
74537
  }
@@ -77215,7 +74674,7 @@ function checkRateLimit2(processedThisHour, maxPerHour) {
77215
74674
  return processedThisHour < maxPerHour;
77216
74675
  }
77217
74676
  function spawnAndCollect3(command, args) {
77218
- return new Promise((resolve25, reject) => {
74677
+ return new Promise((resolve26, reject) => {
77219
74678
  const child = spawn7(command, args, { stdio: ["ignore", "pipe", "pipe"] });
77220
74679
  const chunks = [];
77221
74680
  const stderrChunks = [];
@@ -77228,7 +74687,7 @@ function spawnAndCollect3(command, args) {
77228
74687
  reject(new Error(`${command} exited with code ${code}: ${stderr}`));
77229
74688
  return;
77230
74689
  }
77231
- resolve25(Buffer.concat(chunks).toString("utf-8"));
74690
+ resolve26(Buffer.concat(chunks).toString("utf-8"));
77232
74691
  });
77233
74692
  });
77234
74693
  }
@@ -77277,7 +74736,7 @@ async function invokeClaude(options2) {
77277
74736
  return collectClaudeOutput(child, options2.timeoutSec, verbose);
77278
74737
  }
77279
74738
  function collectClaudeOutput(child, timeoutSec, verbose = false) {
77280
- return new Promise((resolve25, reject) => {
74739
+ return new Promise((resolve26, reject) => {
77281
74740
  const chunks = [];
77282
74741
  const stderrChunks = [];
77283
74742
  child.stdout?.on("data", (chunk) => {
@@ -77307,7 +74766,7 @@ function collectClaudeOutput(child, timeoutSec, verbose = false) {
77307
74766
  reject(new Error(`Claude exited with code ${code}: ${stderr}`));
77308
74767
  return;
77309
74768
  }
77310
- resolve25(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
74769
+ resolve26(verbose ? parseStreamJsonOutput(stdout2) : parseClaudeOutput(stdout2));
77311
74770
  });
77312
74771
  });
77313
74772
  }
@@ -78009,7 +75468,7 @@ function cleanExpiredIssues(state, ttlDays) {
78009
75468
  // src/commands/watch/phases/state-manager.ts
78010
75469
  import { existsSync as existsSync51 } from "node:fs";
78011
75470
  import { mkdir as mkdir30, readFile as readFile46 } from "node:fs/promises";
78012
- import { dirname as dirname29 } from "node:path";
75471
+ import { dirname as dirname30 } from "node:path";
78013
75472
  init_takumi_config_manager();
78014
75473
  init_logger();
78015
75474
  var PROCESSED_ISSUES_CAP = 500;
@@ -78041,7 +75500,7 @@ async function loadWatchState(projectDir) {
78041
75500
  }
78042
75501
  async function saveWatchState(projectDir, state) {
78043
75502
  const configPath = TakumiConfigManager.getProjectConfigPath(projectDir);
78044
- const configDir = dirname29(configPath);
75503
+ const configDir = dirname30(configPath);
78045
75504
  if (!existsSync51(configDir)) {
78046
75505
  await mkdir30(configDir, { recursive: true });
78047
75506
  }
@@ -78255,7 +75714,7 @@ Run this command from a directory with a GitHub remote.`);
78255
75714
  // src/commands/watch/phases/watch-logger.ts
78256
75715
  init_logger();
78257
75716
  init_path_resolver();
78258
- import { createWriteStream as createWriteStream3, statSync as statSync6 } from "node:fs";
75717
+ import { createWriteStream as createWriteStream4, statSync as statSync6 } from "node:fs";
78259
75718
  import { existsSync as existsSync54 } from "node:fs";
78260
75719
  import { mkdir as mkdir31, rename as rename7 } from "node:fs/promises";
78261
75720
  import { join as join112 } from "node:path";
@@ -78276,7 +75735,7 @@ class WatchLogger {
78276
75735
  }
78277
75736
  const dateStr = formatDate(new Date);
78278
75737
  this.logPath = join112(this.logDir, `watch-${dateStr}.log`);
78279
- this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
75738
+ this.logStream = createWriteStream4(this.logPath, { flags: "a", mode: 384 });
78280
75739
  } catch (error) {
78281
75740
  logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
78282
75741
  }
@@ -78341,7 +75800,7 @@ class WatchLogger {
78341
75800
  this.logStream.end();
78342
75801
  const rotatedPath = `${this.logPath}.1`;
78343
75802
  rename7(this.logPath, rotatedPath).catch(() => {});
78344
- this.logStream = createWriteStream3(this.logPath, { flags: "w", mode: 384 });
75803
+ this.logStream = createWriteStream4(this.logPath, { flags: "w", mode: 384 });
78345
75804
  } catch {}
78346
75805
  }
78347
75806
  }
@@ -78564,7 +76023,7 @@ function formatQueueInfo(state) {
78564
76023
  return "idle";
78565
76024
  }
78566
76025
  function sleep2(ms2) {
78567
- return new Promise((resolve25) => setTimeout(resolve25, ms2));
76026
+ return new Promise((resolve26) => setTimeout(resolve26, ms2));
78568
76027
  }
78569
76028
  // src/cli/command-registry.ts
78570
76029
  init_logger();
@@ -79085,7 +76544,7 @@ function getPackageVersion2() {
79085
76544
  // src/shared/logger.ts
79086
76545
  init_output_manager();
79087
76546
  var import_picocolors41 = __toESM(require_picocolors(), 1);
79088
- import { createWriteStream as createWriteStream5 } from "node:fs";
76547
+ import { createWriteStream as createWriteStream6 } from "node:fs";
79089
76548
 
79090
76549
  class Logger2 {
79091
76550
  verboseEnabled = false;
@@ -79141,7 +76600,7 @@ class Logger2 {
79141
76600
  this.logFileStream = undefined;
79142
76601
  }
79143
76602
  if (path8) {
79144
- this.logFileStream = createWriteStream5(path8, {
76603
+ this.logFileStream = createWriteStream6(path8, {
79145
76604
  flags: "a",
79146
76605
  mode: 384
79147
76606
  });