@kevisual/cli 0.1.37 → 0.1.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -9749,6 +9749,297 @@ var require_jsonwebtoken = __commonJS((exports, module) => {
9749
9749
  };
9750
9750
  });
9751
9751
 
9752
+ // node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/dayjs.min.js
9753
+ var require_dayjs_min = __commonJS((exports, module) => {
9754
+ (function(t, e) {
9755
+ typeof exports == "object" && typeof module != "undefined" ? module.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs = e();
9756
+ })(exports, function() {
9757
+ var t = 1000, e = 60000, n = 3600000, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
9758
+ var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
9759
+ return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
9760
+ } }, m = function(t2, e2, n2) {
9761
+ var r2 = String(t2);
9762
+ return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
9763
+ }, v = { s: m, z: function(t2) {
9764
+ var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
9765
+ return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
9766
+ }, m: function t2(e2, n2) {
9767
+ if (e2.date() < n2.date())
9768
+ return -t2(n2, e2);
9769
+ var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
9770
+ return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
9771
+ }, a: function(t2) {
9772
+ return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
9773
+ }, p: function(t2) {
9774
+ return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
9775
+ }, u: function(t2) {
9776
+ return t2 === undefined;
9777
+ } }, g = "en", D = {};
9778
+ D[g] = M;
9779
+ var p = "$isDayjsObject", S = function(t2) {
9780
+ return t2 instanceof _ || !(!t2 || !t2[p]);
9781
+ }, w = function t2(e2, n2, r2) {
9782
+ var i2;
9783
+ if (!e2)
9784
+ return g;
9785
+ if (typeof e2 == "string") {
9786
+ var s2 = e2.toLowerCase();
9787
+ D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
9788
+ var u2 = e2.split("-");
9789
+ if (!i2 && u2.length > 1)
9790
+ return t2(u2[0]);
9791
+ } else {
9792
+ var a2 = e2.name;
9793
+ D[a2] = e2, i2 = a2;
9794
+ }
9795
+ return !r2 && i2 && (g = i2), i2 || !r2 && g;
9796
+ }, O = function(t2, e2) {
9797
+ if (S(t2))
9798
+ return t2.clone();
9799
+ var n2 = typeof e2 == "object" ? e2 : {};
9800
+ return n2.date = t2, n2.args = arguments, new _(n2);
9801
+ }, b = v;
9802
+ b.l = w, b.i = S, b.w = function(t2, e2) {
9803
+ return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
9804
+ };
9805
+ var _ = function() {
9806
+ function M2(t2) {
9807
+ this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
9808
+ }
9809
+ var m2 = M2.prototype;
9810
+ return m2.parse = function(t2) {
9811
+ this.$d = function(t3) {
9812
+ var { date: e2, utc: n2 } = t3;
9813
+ if (e2 === null)
9814
+ return new Date(NaN);
9815
+ if (b.u(e2))
9816
+ return new Date;
9817
+ if (e2 instanceof Date)
9818
+ return new Date(e2);
9819
+ if (typeof e2 == "string" && !/Z$/i.test(e2)) {
9820
+ var r2 = e2.match($);
9821
+ if (r2) {
9822
+ var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
9823
+ return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
9824
+ }
9825
+ }
9826
+ return new Date(e2);
9827
+ }(t2), this.init();
9828
+ }, m2.init = function() {
9829
+ var t2 = this.$d;
9830
+ this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
9831
+ }, m2.$utils = function() {
9832
+ return b;
9833
+ }, m2.isValid = function() {
9834
+ return !(this.$d.toString() === l);
9835
+ }, m2.isSame = function(t2, e2) {
9836
+ var n2 = O(t2);
9837
+ return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
9838
+ }, m2.isAfter = function(t2, e2) {
9839
+ return O(t2) < this.startOf(e2);
9840
+ }, m2.isBefore = function(t2, e2) {
9841
+ return this.endOf(e2) < O(t2);
9842
+ }, m2.$g = function(t2, e2, n2) {
9843
+ return b.u(t2) ? this[e2] : this.set(n2, t2);
9844
+ }, m2.unix = function() {
9845
+ return Math.floor(this.valueOf() / 1000);
9846
+ }, m2.valueOf = function() {
9847
+ return this.$d.getTime();
9848
+ }, m2.startOf = function(t2, e2) {
9849
+ var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
9850
+ var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
9851
+ return r2 ? i2 : i2.endOf(a);
9852
+ }, $2 = function(t3, e3) {
9853
+ return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
9854
+ }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
9855
+ switch (f2) {
9856
+ case h:
9857
+ return r2 ? l2(1, 0) : l2(31, 11);
9858
+ case c:
9859
+ return r2 ? l2(1, M3) : l2(0, M3 + 1);
9860
+ case o:
9861
+ var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
9862
+ return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
9863
+ case a:
9864
+ case d:
9865
+ return $2(v2 + "Hours", 0);
9866
+ case u:
9867
+ return $2(v2 + "Minutes", 1);
9868
+ case s:
9869
+ return $2(v2 + "Seconds", 2);
9870
+ case i:
9871
+ return $2(v2 + "Milliseconds", 3);
9872
+ default:
9873
+ return this.clone();
9874
+ }
9875
+ }, m2.endOf = function(t2) {
9876
+ return this.startOf(t2, false);
9877
+ }, m2.$set = function(t2, e2) {
9878
+ var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
9879
+ if (o2 === c || o2 === h) {
9880
+ var y2 = this.clone().set(d, 1);
9881
+ y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
9882
+ } else
9883
+ l2 && this.$d[l2]($2);
9884
+ return this.init(), this;
9885
+ }, m2.set = function(t2, e2) {
9886
+ return this.clone().$set(t2, e2);
9887
+ }, m2.get = function(t2) {
9888
+ return this[b.p(t2)]();
9889
+ }, m2.add = function(r2, f2) {
9890
+ var d2, l2 = this;
9891
+ r2 = Number(r2);
9892
+ var $2 = b.p(f2), y2 = function(t2) {
9893
+ var e2 = O(l2);
9894
+ return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
9895
+ };
9896
+ if ($2 === c)
9897
+ return this.set(c, this.$M + r2);
9898
+ if ($2 === h)
9899
+ return this.set(h, this.$y + r2);
9900
+ if ($2 === a)
9901
+ return y2(1);
9902
+ if ($2 === o)
9903
+ return y2(7);
9904
+ var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
9905
+ return b.w(m3, this);
9906
+ }, m2.subtract = function(t2, e2) {
9907
+ return this.add(-1 * t2, e2);
9908
+ }, m2.format = function(t2) {
9909
+ var e2 = this, n2 = this.$locale();
9910
+ if (!this.isValid())
9911
+ return n2.invalidDate || l;
9912
+ var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
9913
+ return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
9914
+ }, d2 = function(t3) {
9915
+ return b.s(s2 % 12 || 12, t3, "0");
9916
+ }, $2 = f2 || function(t3, e3, n3) {
9917
+ var r3 = t3 < 12 ? "AM" : "PM";
9918
+ return n3 ? r3.toLowerCase() : r3;
9919
+ };
9920
+ return r2.replace(y, function(t3, r3) {
9921
+ return r3 || function(t4) {
9922
+ switch (t4) {
9923
+ case "YY":
9924
+ return String(e2.$y).slice(-2);
9925
+ case "YYYY":
9926
+ return b.s(e2.$y, 4, "0");
9927
+ case "M":
9928
+ return a2 + 1;
9929
+ case "MM":
9930
+ return b.s(a2 + 1, 2, "0");
9931
+ case "MMM":
9932
+ return h2(n2.monthsShort, a2, c2, 3);
9933
+ case "MMMM":
9934
+ return h2(c2, a2);
9935
+ case "D":
9936
+ return e2.$D;
9937
+ case "DD":
9938
+ return b.s(e2.$D, 2, "0");
9939
+ case "d":
9940
+ return String(e2.$W);
9941
+ case "dd":
9942
+ return h2(n2.weekdaysMin, e2.$W, o2, 2);
9943
+ case "ddd":
9944
+ return h2(n2.weekdaysShort, e2.$W, o2, 3);
9945
+ case "dddd":
9946
+ return o2[e2.$W];
9947
+ case "H":
9948
+ return String(s2);
9949
+ case "HH":
9950
+ return b.s(s2, 2, "0");
9951
+ case "h":
9952
+ return d2(1);
9953
+ case "hh":
9954
+ return d2(2);
9955
+ case "a":
9956
+ return $2(s2, u2, true);
9957
+ case "A":
9958
+ return $2(s2, u2, false);
9959
+ case "m":
9960
+ return String(u2);
9961
+ case "mm":
9962
+ return b.s(u2, 2, "0");
9963
+ case "s":
9964
+ return String(e2.$s);
9965
+ case "ss":
9966
+ return b.s(e2.$s, 2, "0");
9967
+ case "SSS":
9968
+ return b.s(e2.$ms, 3, "0");
9969
+ case "Z":
9970
+ return i2;
9971
+ }
9972
+ return null;
9973
+ }(t3) || i2.replace(":", "");
9974
+ });
9975
+ }, m2.utcOffset = function() {
9976
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
9977
+ }, m2.diff = function(r2, d2, l2) {
9978
+ var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
9979
+ return b.m(y2, m3);
9980
+ };
9981
+ switch (M3) {
9982
+ case h:
9983
+ $2 = D2() / 12;
9984
+ break;
9985
+ case c:
9986
+ $2 = D2();
9987
+ break;
9988
+ case f:
9989
+ $2 = D2() / 3;
9990
+ break;
9991
+ case o:
9992
+ $2 = (g2 - v2) / 604800000;
9993
+ break;
9994
+ case a:
9995
+ $2 = (g2 - v2) / 86400000;
9996
+ break;
9997
+ case u:
9998
+ $2 = g2 / n;
9999
+ break;
10000
+ case s:
10001
+ $2 = g2 / e;
10002
+ break;
10003
+ case i:
10004
+ $2 = g2 / t;
10005
+ break;
10006
+ default:
10007
+ $2 = g2;
10008
+ }
10009
+ return l2 ? $2 : b.a($2);
10010
+ }, m2.daysInMonth = function() {
10011
+ return this.endOf(c).$D;
10012
+ }, m2.$locale = function() {
10013
+ return D[this.$L];
10014
+ }, m2.locale = function(t2, e2) {
10015
+ if (!t2)
10016
+ return this.$L;
10017
+ var n2 = this.clone(), r2 = w(t2, e2, true);
10018
+ return r2 && (n2.$L = r2), n2;
10019
+ }, m2.clone = function() {
10020
+ return b.w(this.$d, this);
10021
+ }, m2.toDate = function() {
10022
+ return new Date(this.valueOf());
10023
+ }, m2.toJSON = function() {
10024
+ return this.isValid() ? this.toISOString() : null;
10025
+ }, m2.toISOString = function() {
10026
+ return this.$d.toISOString();
10027
+ }, m2.toString = function() {
10028
+ return this.$d.toUTCString();
10029
+ }, M2;
10030
+ }(), k = _.prototype;
10031
+ return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
10032
+ k[t2[1]] = function(e2) {
10033
+ return this.$g(e2, t2[0], t2[1]);
10034
+ };
10035
+ }), O.extend = function(t2, e2) {
10036
+ return t2.$i || (t2(e2, _, O), t2.$i = true), O;
10037
+ }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
10038
+ return O(1000 * t2);
10039
+ }, O.en = D[g], O.Ls = D, O.p = {}, O;
10040
+ });
10041
+ });
10042
+
9752
10043
  // node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js
9753
10044
  var require_error2 = __commonJS((exports) => {
9754
10045
  class CommanderError extends Error {
@@ -10472,7 +10763,7 @@ var require_command = __commonJS((exports) => {
10472
10763
  var EventEmitter5 = __require("node:events").EventEmitter;
10473
10764
  var childProcess = __require("node:child_process");
10474
10765
  var path13 = __require("node:path");
10475
- var fs15 = __require("node:fs");
10766
+ var fs16 = __require("node:fs");
10476
10767
  var process4 = __require("node:process");
10477
10768
  var { Argument, humanReadableArgName } = require_argument();
10478
10769
  var { CommanderError } = require_error2();
@@ -11007,7 +11298,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
11007
11298
  this.processedArgs = [];
11008
11299
  }
11009
11300
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
11010
- if (fs15.existsSync(executableFile))
11301
+ if (fs16.existsSync(executableFile))
11011
11302
  return;
11012
11303
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
11013
11304
  const executableMissing = `'${executableFile}' does not exist
@@ -11022,11 +11313,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
11022
11313
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
11023
11314
  function findFile(baseDir, baseName) {
11024
11315
  const localBin = path13.resolve(baseDir, baseName);
11025
- if (fs15.existsSync(localBin))
11316
+ if (fs16.existsSync(localBin))
11026
11317
  return localBin;
11027
11318
  if (sourceExt.includes(path13.extname(baseName)))
11028
11319
  return;
11029
- const foundExt = sourceExt.find((ext) => fs15.existsSync(`${localBin}${ext}`));
11320
+ const foundExt = sourceExt.find((ext) => fs16.existsSync(`${localBin}${ext}`));
11030
11321
  if (foundExt)
11031
11322
  return `${localBin}${foundExt}`;
11032
11323
  return;
@@ -11038,7 +11329,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
11038
11329
  if (this._scriptPath) {
11039
11330
  let resolvedScriptPath;
11040
11331
  try {
11041
- resolvedScriptPath = fs15.realpathSync(this._scriptPath);
11332
+ resolvedScriptPath = fs16.realpathSync(this._scriptPath);
11042
11333
  } catch {
11043
11334
  resolvedScriptPath = this._scriptPath;
11044
11335
  }
@@ -21641,7 +21932,7 @@ var require_form_data = __commonJS((exports, module) => {
21641
21932
  var http3 = __require("http");
21642
21933
  var https2 = __require("https");
21643
21934
  var parseUrl = __require("url").parse;
21644
- var fs16 = __require("fs");
21935
+ var fs17 = __require("fs");
21645
21936
  var Stream = __require("stream").Stream;
21646
21937
  var crypto6 = __require("crypto");
21647
21938
  var mime = require_mime_types();
@@ -21709,7 +22000,7 @@ var require_form_data = __commonJS((exports, module) => {
21709
22000
  if (value.end != null && value.end != Infinity && value.start != null) {
21710
22001
  callback(null, value.end + 1 - (value.start ? value.start : 0));
21711
22002
  } else {
21712
- fs16.stat(value.path, function(err, stat) {
22003
+ fs17.stat(value.path, function(err, stat) {
21713
22004
  if (err) {
21714
22005
  callback(err);
21715
22006
  return;
@@ -25307,7 +25598,7 @@ var require_parse4 = __commonJS((exports, module) => {
25307
25598
 
25308
25599
  // node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js
25309
25600
  var require_gray_matter = __commonJS((exports, module) => {
25310
- var fs23 = __require("fs");
25601
+ var fs24 = __require("fs");
25311
25602
  var sections = require_section_matter();
25312
25603
  var defaults = require_defaults();
25313
25604
  var stringify = require_stringify2();
@@ -25394,7 +25685,7 @@ var require_gray_matter = __commonJS((exports, module) => {
25394
25685
  return stringify(file3, data, options2);
25395
25686
  };
25396
25687
  matter.read = function(filepath, options2) {
25397
- const str2 = fs23.readFileSync(filepath, "utf8");
25688
+ const str2 = fs24.readFileSync(filepath, "utf8");
25398
25689
  const file3 = matter(str2, options2);
25399
25690
  file3.path = filepath;
25400
25691
  return file3;
@@ -25421,297 +25712,6 @@ var require_gray_matter = __commonJS((exports, module) => {
25421
25712
  module.exports = matter;
25422
25713
  });
25423
25714
 
25424
- // node_modules/.pnpm/dayjs@1.11.20/node_modules/dayjs/dayjs.min.js
25425
- var require_dayjs_min = __commonJS((exports, module) => {
25426
- (function(t, e) {
25427
- typeof exports == "object" && typeof module != "undefined" ? module.exports = e() : typeof define == "function" && define.amd ? define(e) : (t = typeof globalThis != "undefined" ? globalThis : t || self).dayjs = e();
25428
- })(exports, function() {
25429
- var t = 1000, e = 60000, n = 3600000, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", c = "month", f = "quarter", h = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t2) {
25430
- var e2 = ["th", "st", "nd", "rd"], n2 = t2 % 100;
25431
- return "[" + t2 + (e2[(n2 - 20) % 10] || e2[n2] || e2[0]) + "]";
25432
- } }, m = function(t2, e2, n2) {
25433
- var r2 = String(t2);
25434
- return !r2 || r2.length >= e2 ? t2 : "" + Array(e2 + 1 - r2.length).join(n2) + t2;
25435
- }, v = { s: m, z: function(t2) {
25436
- var e2 = -t2.utcOffset(), n2 = Math.abs(e2), r2 = Math.floor(n2 / 60), i2 = n2 % 60;
25437
- return (e2 <= 0 ? "+" : "-") + m(r2, 2, "0") + ":" + m(i2, 2, "0");
25438
- }, m: function t2(e2, n2) {
25439
- if (e2.date() < n2.date())
25440
- return -t2(n2, e2);
25441
- var r2 = 12 * (n2.year() - e2.year()) + (n2.month() - e2.month()), i2 = e2.clone().add(r2, c), s2 = n2 - i2 < 0, u2 = e2.clone().add(r2 + (s2 ? -1 : 1), c);
25442
- return +(-(r2 + (n2 - i2) / (s2 ? i2 - u2 : u2 - i2)) || 0);
25443
- }, a: function(t2) {
25444
- return t2 < 0 ? Math.ceil(t2) || 0 : Math.floor(t2);
25445
- }, p: function(t2) {
25446
- return { M: c, y: h, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: f }[t2] || String(t2 || "").toLowerCase().replace(/s$/, "");
25447
- }, u: function(t2) {
25448
- return t2 === undefined;
25449
- } }, g = "en", D = {};
25450
- D[g] = M;
25451
- var p = "$isDayjsObject", S = function(t2) {
25452
- return t2 instanceof _ || !(!t2 || !t2[p]);
25453
- }, w = function t2(e2, n2, r2) {
25454
- var i2;
25455
- if (!e2)
25456
- return g;
25457
- if (typeof e2 == "string") {
25458
- var s2 = e2.toLowerCase();
25459
- D[s2] && (i2 = s2), n2 && (D[s2] = n2, i2 = s2);
25460
- var u2 = e2.split("-");
25461
- if (!i2 && u2.length > 1)
25462
- return t2(u2[0]);
25463
- } else {
25464
- var a2 = e2.name;
25465
- D[a2] = e2, i2 = a2;
25466
- }
25467
- return !r2 && i2 && (g = i2), i2 || !r2 && g;
25468
- }, O = function(t2, e2) {
25469
- if (S(t2))
25470
- return t2.clone();
25471
- var n2 = typeof e2 == "object" ? e2 : {};
25472
- return n2.date = t2, n2.args = arguments, new _(n2);
25473
- }, b = v;
25474
- b.l = w, b.i = S, b.w = function(t2, e2) {
25475
- return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
25476
- };
25477
- var _ = function() {
25478
- function M2(t2) {
25479
- this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
25480
- }
25481
- var m2 = M2.prototype;
25482
- return m2.parse = function(t2) {
25483
- this.$d = function(t3) {
25484
- var { date: e2, utc: n2 } = t3;
25485
- if (e2 === null)
25486
- return new Date(NaN);
25487
- if (b.u(e2))
25488
- return new Date;
25489
- if (e2 instanceof Date)
25490
- return new Date(e2);
25491
- if (typeof e2 == "string" && !/Z$/i.test(e2)) {
25492
- var r2 = e2.match($);
25493
- if (r2) {
25494
- var i2 = r2[2] - 1 || 0, s2 = (r2[7] || "0").substring(0, 3);
25495
- return n2 ? new Date(Date.UTC(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2)) : new Date(r2[1], i2, r2[3] || 1, r2[4] || 0, r2[5] || 0, r2[6] || 0, s2);
25496
- }
25497
- }
25498
- return new Date(e2);
25499
- }(t2), this.init();
25500
- }, m2.init = function() {
25501
- var t2 = this.$d;
25502
- this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
25503
- }, m2.$utils = function() {
25504
- return b;
25505
- }, m2.isValid = function() {
25506
- return !(this.$d.toString() === l);
25507
- }, m2.isSame = function(t2, e2) {
25508
- var n2 = O(t2);
25509
- return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
25510
- }, m2.isAfter = function(t2, e2) {
25511
- return O(t2) < this.startOf(e2);
25512
- }, m2.isBefore = function(t2, e2) {
25513
- return this.endOf(e2) < O(t2);
25514
- }, m2.$g = function(t2, e2, n2) {
25515
- return b.u(t2) ? this[e2] : this.set(n2, t2);
25516
- }, m2.unix = function() {
25517
- return Math.floor(this.valueOf() / 1000);
25518
- }, m2.valueOf = function() {
25519
- return this.$d.getTime();
25520
- }, m2.startOf = function(t2, e2) {
25521
- var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
25522
- var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
25523
- return r2 ? i2 : i2.endOf(a);
25524
- }, $2 = function(t3, e3) {
25525
- return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
25526
- }, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
25527
- switch (f2) {
25528
- case h:
25529
- return r2 ? l2(1, 0) : l2(31, 11);
25530
- case c:
25531
- return r2 ? l2(1, M3) : l2(0, M3 + 1);
25532
- case o:
25533
- var g2 = this.$locale().weekStart || 0, D2 = (y2 < g2 ? y2 + 7 : y2) - g2;
25534
- return l2(r2 ? m3 - D2 : m3 + (6 - D2), M3);
25535
- case a:
25536
- case d:
25537
- return $2(v2 + "Hours", 0);
25538
- case u:
25539
- return $2(v2 + "Minutes", 1);
25540
- case s:
25541
- return $2(v2 + "Seconds", 2);
25542
- case i:
25543
- return $2(v2 + "Milliseconds", 3);
25544
- default:
25545
- return this.clone();
25546
- }
25547
- }, m2.endOf = function(t2) {
25548
- return this.startOf(t2, false);
25549
- }, m2.$set = function(t2, e2) {
25550
- var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
25551
- if (o2 === c || o2 === h) {
25552
- var y2 = this.clone().set(d, 1);
25553
- y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
25554
- } else
25555
- l2 && this.$d[l2]($2);
25556
- return this.init(), this;
25557
- }, m2.set = function(t2, e2) {
25558
- return this.clone().$set(t2, e2);
25559
- }, m2.get = function(t2) {
25560
- return this[b.p(t2)]();
25561
- }, m2.add = function(r2, f2) {
25562
- var d2, l2 = this;
25563
- r2 = Number(r2);
25564
- var $2 = b.p(f2), y2 = function(t2) {
25565
- var e2 = O(l2);
25566
- return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
25567
- };
25568
- if ($2 === c)
25569
- return this.set(c, this.$M + r2);
25570
- if ($2 === h)
25571
- return this.set(h, this.$y + r2);
25572
- if ($2 === a)
25573
- return y2(1);
25574
- if ($2 === o)
25575
- return y2(7);
25576
- var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
25577
- return b.w(m3, this);
25578
- }, m2.subtract = function(t2, e2) {
25579
- return this.add(-1 * t2, e2);
25580
- }, m2.format = function(t2) {
25581
- var e2 = this, n2 = this.$locale();
25582
- if (!this.isValid())
25583
- return n2.invalidDate || l;
25584
- var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
25585
- return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
25586
- }, d2 = function(t3) {
25587
- return b.s(s2 % 12 || 12, t3, "0");
25588
- }, $2 = f2 || function(t3, e3, n3) {
25589
- var r3 = t3 < 12 ? "AM" : "PM";
25590
- return n3 ? r3.toLowerCase() : r3;
25591
- };
25592
- return r2.replace(y, function(t3, r3) {
25593
- return r3 || function(t4) {
25594
- switch (t4) {
25595
- case "YY":
25596
- return String(e2.$y).slice(-2);
25597
- case "YYYY":
25598
- return b.s(e2.$y, 4, "0");
25599
- case "M":
25600
- return a2 + 1;
25601
- case "MM":
25602
- return b.s(a2 + 1, 2, "0");
25603
- case "MMM":
25604
- return h2(n2.monthsShort, a2, c2, 3);
25605
- case "MMMM":
25606
- return h2(c2, a2);
25607
- case "D":
25608
- return e2.$D;
25609
- case "DD":
25610
- return b.s(e2.$D, 2, "0");
25611
- case "d":
25612
- return String(e2.$W);
25613
- case "dd":
25614
- return h2(n2.weekdaysMin, e2.$W, o2, 2);
25615
- case "ddd":
25616
- return h2(n2.weekdaysShort, e2.$W, o2, 3);
25617
- case "dddd":
25618
- return o2[e2.$W];
25619
- case "H":
25620
- return String(s2);
25621
- case "HH":
25622
- return b.s(s2, 2, "0");
25623
- case "h":
25624
- return d2(1);
25625
- case "hh":
25626
- return d2(2);
25627
- case "a":
25628
- return $2(s2, u2, true);
25629
- case "A":
25630
- return $2(s2, u2, false);
25631
- case "m":
25632
- return String(u2);
25633
- case "mm":
25634
- return b.s(u2, 2, "0");
25635
- case "s":
25636
- return String(e2.$s);
25637
- case "ss":
25638
- return b.s(e2.$s, 2, "0");
25639
- case "SSS":
25640
- return b.s(e2.$ms, 3, "0");
25641
- case "Z":
25642
- return i2;
25643
- }
25644
- return null;
25645
- }(t3) || i2.replace(":", "");
25646
- });
25647
- }, m2.utcOffset = function() {
25648
- return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
25649
- }, m2.diff = function(r2, d2, l2) {
25650
- var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
25651
- return b.m(y2, m3);
25652
- };
25653
- switch (M3) {
25654
- case h:
25655
- $2 = D2() / 12;
25656
- break;
25657
- case c:
25658
- $2 = D2();
25659
- break;
25660
- case f:
25661
- $2 = D2() / 3;
25662
- break;
25663
- case o:
25664
- $2 = (g2 - v2) / 604800000;
25665
- break;
25666
- case a:
25667
- $2 = (g2 - v2) / 86400000;
25668
- break;
25669
- case u:
25670
- $2 = g2 / n;
25671
- break;
25672
- case s:
25673
- $2 = g2 / e;
25674
- break;
25675
- case i:
25676
- $2 = g2 / t;
25677
- break;
25678
- default:
25679
- $2 = g2;
25680
- }
25681
- return l2 ? $2 : b.a($2);
25682
- }, m2.daysInMonth = function() {
25683
- return this.endOf(c).$D;
25684
- }, m2.$locale = function() {
25685
- return D[this.$L];
25686
- }, m2.locale = function(t2, e2) {
25687
- if (!t2)
25688
- return this.$L;
25689
- var n2 = this.clone(), r2 = w(t2, e2, true);
25690
- return r2 && (n2.$L = r2), n2;
25691
- }, m2.clone = function() {
25692
- return b.w(this.$d, this);
25693
- }, m2.toDate = function() {
25694
- return new Date(this.valueOf());
25695
- }, m2.toJSON = function() {
25696
- return this.isValid() ? this.toISOString() : null;
25697
- }, m2.toISOString = function() {
25698
- return this.$d.toISOString();
25699
- }, m2.toString = function() {
25700
- return this.$d.toUTCString();
25701
- }, M2;
25702
- }(), k = _.prototype;
25703
- return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
25704
- k[t2[1]] = function(e2) {
25705
- return this.$g(e2, t2[0], t2[1]);
25706
- };
25707
- }), O.extend = function(t2, e2) {
25708
- return t2.$i || (t2(e2, _, O), t2.$i = true), O;
25709
- }, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
25710
- return O(1000 * t2);
25711
- }, O.en = D[g], O.Ls = D, O.p = {}, O;
25712
- });
25713
- });
25714
-
25715
25715
  // node_modules/.pnpm/@kevisual+router@0.2.5/node_modules/@kevisual/router/dist/router.js
25716
25716
  import { createRequire as createRequire2 } from "node:module";
25717
25717
  import { webcrypto as crypto2 } from "node:crypto";
@@ -44435,6 +44435,7 @@ class App extends QueryRouterServer {
44435
44435
  }
44436
44436
 
44437
44437
  // node_modules/.pnpm/@kevisual+context@0.0.8/node_modules/@kevisual/context/dist/app.js
44438
+ var isBrowser = typeof window !== "undefined" && typeof document !== "undefined";
44438
44439
  var isBrowser22 = typeof window !== "undefined" && typeof window.document !== "undefined";
44439
44440
  function getDefaultExportFromCjs(x) {
44440
44441
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
@@ -44987,6 +44988,33 @@ class InitEnv {
44987
44988
  }
44988
44989
  }
44989
44990
  InitEnv.init();
44991
+ var useKey = (envKey, initKey = "context") => {
44992
+ let key = envKey;
44993
+ if (!key)
44994
+ return null;
44995
+ const _env = useEnv({}, initKey);
44996
+ if (typeof _env[key] !== "undefined") {
44997
+ return _env[key];
44998
+ }
44999
+ if (!isBrowser) {
45000
+ const nodeEev = gt?.process?.env;
45001
+ if (typeof nodeEev !== "undefined") {
45002
+ const value = nodeEev[key];
45003
+ if (typeof value !== "undefined") {
45004
+ return value;
45005
+ }
45006
+ }
45007
+ } else {
45008
+ const storage = gt?.localStorage;
45009
+ if (typeof storage !== "undefined") {
45010
+ const value = storage.getItem(key);
45011
+ if (typeof value !== "undefined") {
45012
+ return value;
45013
+ }
45014
+ }
45015
+ }
45016
+ return null;
45017
+ };
44990
45018
 
44991
45019
  // src/app.ts
44992
45020
  var app = useContextKey("app", () => {
@@ -60442,7 +60470,7 @@ var mergeConfig = (config3) => {
60442
60470
  global.config = _config;
60443
60471
  return _config;
60444
60472
  };
60445
- var useKey = (key, opts) => {
60473
+ var useKey2 = (key, opts) => {
60446
60474
  let v = useConfig()[key];
60447
60475
  if (!v) {
60448
60476
  v = process.env[key];
@@ -60458,7 +60486,7 @@ var useKey = (key, opts) => {
60458
60486
  }
60459
60487
  return v;
60460
60488
  };
60461
- var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
60489
+ var isBrowser3 = typeof window !== "undefined" && typeof window.document !== "undefined";
60462
60490
  function getDefaultExportFromCjs2(x) {
60463
60491
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
60464
60492
  }
@@ -61042,7 +61070,7 @@ var writeConfig = (config3) => {
61042
61070
  return config3;
61043
61071
  };
61044
61072
  var getEnvToken = () => {
61045
- const envTokne = useKey("KEVISUAL_TOKEN") || "";
61073
+ const envTokne = useKey2("KEVISUAL_TOKEN") || "";
61046
61074
  return envTokne;
61047
61075
  };
61048
61076
 
@@ -64975,12 +65003,12 @@ app.route({
64975
65003
  }
64976
65004
  }).define(async (ctx) => {
64977
65005
  const registry3 = ctx.args.registry || "default";
64978
- let DOCKER_USERNAME = useKey("DOCKER_USERNAME");
64979
- let DOCKER_PASSWORD = useKey("DOCKER_PASSWORD");
64980
- let DOCKER_REGISTRY = useKey("DOCKER_REGISTRY");
65006
+ let DOCKER_USERNAME = useKey2("DOCKER_USERNAME");
65007
+ let DOCKER_PASSWORD = useKey2("DOCKER_PASSWORD");
65008
+ let DOCKER_REGISTRY = useKey2("DOCKER_REGISTRY");
64981
65009
  if (registry3 !== "default") {
64982
65010
  DOCKER_USERNAME = "cnb";
64983
- DOCKER_PASSWORD = useKey("CNB_TOKEN");
65011
+ DOCKER_PASSWORD = useKey2("CNB_TOKEN");
64984
65012
  DOCKER_REGISTRY = "docker.cnb.cool";
64985
65013
  }
64986
65014
  if (!DOCKER_USERNAME || !DOCKER_PASSWORD) {
@@ -65017,7 +65045,7 @@ app.route({
65017
65045
  }
65018
65046
  }).define(async () => {
65019
65047
  let DOCKER_USERNAME = "cnb";
65020
- let DOCKER_PASSWORD = useKey("CNB_TOKEN");
65048
+ let DOCKER_PASSWORD = useKey2("CNB_TOKEN");
65021
65049
  if (!DOCKER_PASSWORD) {
65022
65050
  console.log(chalk2.red("请先配置 CNB_TOKEN"));
65023
65051
  return;
@@ -69613,6 +69641,7 @@ function customAlphabet2(alphabet, size = 21) {
69613
69641
  }
69614
69642
 
69615
69643
  // src/routes/id.ts
69644
+ var import_dayjs = __toESM(require_dayjs_min(), 1);
69616
69645
  var letters = "0123456789abcdefghijklmnopqrstuvwxyz";
69617
69646
  var nanoid128 = customAlphabet2(letters, 128);
69618
69647
  app.route({
@@ -69628,9 +69657,11 @@ app.route({
69628
69657
  const { size = 128 } = ctx.args;
69629
69658
  const id = nanoid128(size);
69630
69659
  console.log(chalk2.green("生成 ID"), id);
69660
+ const time4 = import_dayjs.default().format("YYYYMMDDHHmm");
69631
69661
  ctx.body = {
69632
69662
  id,
69633
- id8: nanoid128(8)
69663
+ id8: nanoid128(8),
69664
+ time: time4
69634
69665
  };
69635
69666
  }).addTo(app);
69636
69667
 
@@ -69648,6 +69679,9 @@ var gitBlobHashContent = (content) => {
69648
69679
  class KevisualPod {
69649
69680
  constructor(opts) {
69650
69681
  this.setRoot(opts?.root);
69682
+ if (opts?.kevisualName) {
69683
+ this.kevisualName = opts.kevisualName;
69684
+ }
69651
69685
  }
69652
69686
  setRoot(root) {
69653
69687
  if (root) {
@@ -69663,7 +69697,8 @@ class KevisualPod {
69663
69697
  async getConfig() {
69664
69698
  return {
69665
69699
  root: this.root,
69666
- kevisual: path12.join(this.root, "kevisual.json")
69700
+ kevisual: path12.join(this.root, `${this.kevisualName || "kevisual"}.json`),
69701
+ kevisualFilename: `${this.kevisualName || "kevisual"}.json`
69667
69702
  };
69668
69703
  }
69669
69704
  async readFileSync(filePath) {
@@ -69674,6 +69709,14 @@ class KevisualPod {
69674
69709
  return {};
69675
69710
  }
69676
69711
  }
69712
+ async getPodData() {
69713
+ const config4 = await this.getConfig();
69714
+ const data = await this.readFileSync(config4.kevisual);
69715
+ return {
69716
+ isNew: !data.root,
69717
+ data
69718
+ };
69719
+ }
69677
69720
  async writeFileSync(filePath, data) {
69678
69721
  try {
69679
69722
  fs14.writeFileSync(filePath, JSON.stringify(data, null, 2), "utf-8");
@@ -69683,21 +69726,50 @@ class KevisualPod {
69683
69726
  }
69684
69727
  async sync(options2 = {}) {
69685
69728
  const config4 = await this.getConfig();
69686
- const manifest = await this.readFileSync(config4.kevisual);
69729
+ const { isNew, data: manifest } = await this.getPodData();
69687
69730
  const oldManifest = cloneDeep(manifest);
69688
- const isNew = !manifest.root;
69731
+ const ignoreConfig = await getRootIgnore(config4.root);
69732
+ const commonIgnore = [
69733
+ "**/node_modules/**",
69734
+ "**/dist/**",
69735
+ "**/build/**",
69736
+ "**/.astro/**",
69737
+ "**/pack-dist/**",
69738
+ "**/.next/**",
69739
+ "**/.nuxt/**",
69740
+ "**/.output/**",
69741
+ "**/.vite/**",
69742
+ "**/.turbo/**",
69743
+ "**/.cache/**",
69744
+ "**/.parcel-cache/**",
69745
+ "**/coverage/**",
69746
+ "**/.nyc_output/**",
69747
+ "**/.git/**",
69748
+ "**/.svn/**",
69749
+ "**/.hg/**",
69750
+ "**/*.log",
69751
+ "**/npm-debug.log*",
69752
+ "**/yarn-debug.log*",
69753
+ "**/yarn-error.log*",
69754
+ "**/*.tmp",
69755
+ "**/*.temp",
69756
+ "**/.idea/**",
69757
+ "**/.vscode/**",
69758
+ "**/*.swp",
69759
+ "**/*~",
69760
+ "**/.vim/",
69761
+ "**/.DS_Store",
69762
+ "**/Thumbs.db",
69763
+ "**/desktop.ini",
69764
+ "**/.AppleDouble",
69765
+ "**/._*"
69766
+ ];
69767
+ const ignore = [...commonIgnore, ...ignoreConfig.ignoreFG];
69768
+ const ignoreSet = new Set(ignore);
69689
69769
  const files = await import_fast_glob2.default(["**/*"], {
69690
69770
  cwd: config4.root,
69691
69771
  dot: true,
69692
- ignore: [
69693
- "**/node_modules/**",
69694
- "**/dist/**",
69695
- "**/pack-dist/**",
69696
- "**/.git/**",
69697
- "**/build/**",
69698
- "**/.DS_Store",
69699
- "**/Thumbs.db"
69700
- ],
69772
+ ignore: Array.from(ignoreSet),
69701
69773
  onlyFiles: true
69702
69774
  });
69703
69775
  manifest.root = config4.root;
@@ -69712,11 +69784,11 @@ class KevisualPod {
69712
69784
  if (item.exist) {
69713
69785
  try {
69714
69786
  const stat = fs14.statSync(filePath);
69715
- const newUpdatedAt = stat.mtimeMs;
69787
+ const newUpdatedAt = Math.floor(stat.mtimeMs);
69716
69788
  if (item.updatedAt === newUpdatedAt && item.hash) {
69717
69789
  return item;
69718
69790
  }
69719
- if (item.name === "kevisual.json") {
69791
+ if (item.name === config4.kevisualFilename) {
69720
69792
  return item;
69721
69793
  }
69722
69794
  const content = fs14.readFileSync(filePath);
@@ -69743,12 +69815,12 @@ class KevisualPod {
69743
69815
  exist: true
69744
69816
  };
69745
69817
  const filePath = path12.join(config4.root, file3);
69746
- if (file3 !== "kevisual.json") {
69818
+ if (file3 !== config4.kevisualFilename) {
69747
69819
  try {
69748
69820
  const content = fs14.readFileSync(filePath);
69749
69821
  newItem.hash = gitBlobHashContent(content);
69750
69822
  const stat = fs14.statSync(filePath);
69751
- newItem.updatedAt = stat.mtimeMs;
69823
+ newItem.updatedAt = Math.floor(stat.mtimeMs);
69752
69824
  } catch (err) {
69753
69825
  console.error(`Error reading file ${filePath}:`, err);
69754
69826
  }
@@ -69761,7 +69833,6 @@ class KevisualPod {
69761
69833
  if (!isNew || oldResources.length > 0) {
69762
69834
  const changed = JSON.stringify(oldManifest) !== JSON.stringify(manifest);
69763
69835
  if (!changed) {
69764
- console.log("No changes detected, skipping write to kevisual.json");
69765
69836
  return manifest;
69766
69837
  }
69767
69838
  await this.writeFileSync(config4.kevisual, manifest);
@@ -69788,50 +69859,170 @@ class KevisualPod {
69788
69859
  return null;
69789
69860
  }
69790
69861
  }
69791
- const config4 = await this.sync();
69862
+ const kevisualJsonPath = path12.join(process.cwd(), `${this.kevisualName || "kevisual"}.json`);
69863
+ if (fileIsExist2(kevisualJsonPath)) {
69864
+ return await this.readFileSync(kevisualJsonPath);
69865
+ }
69866
+ const config4 = await this.sync({ lock: true });
69792
69867
  if (!config4.root)
69793
69868
  return null;
69794
69869
  return config4;
69795
69870
  }
69871
+ async parseHeader(hearder) {
69872
+ const parsed = {};
69873
+ for (const key in hearder) {
69874
+ const value = hearder[key];
69875
+ const envMatch = value.match(/^\$\{env:([^}]+)\}$/);
69876
+ if (envMatch) {
69877
+ const envKey = envMatch[1];
69878
+ parsed[key] = useKey(envKey) || "";
69879
+ continue;
69880
+ }
69881
+ const directMatch = value.match(/^\$\{([^}]+)\}$/);
69882
+ if (directMatch) {
69883
+ const envKey = directMatch[1];
69884
+ parsed[key] = useKey(envKey) || "";
69885
+ continue;
69886
+ }
69887
+ if (value.startsWith("env:")) {
69888
+ const envKey = value.slice(4);
69889
+ parsed[key] = useKey(envKey) || "";
69890
+ } else {
69891
+ parsed[key] = value;
69892
+ }
69893
+ }
69894
+ return parsed;
69895
+ }
69796
69896
  async download(data, opts) {
69797
69897
  const config4 = await this.getConfig();
69798
69898
  let resources = data.resources || [];
69799
- const baseURL2 = data.baseURL || "https://kevisual.cn";
69899
+ let _baseURL = data.baseURL;
69900
+ if (!_baseURL && data.repo) {
69901
+ const pv = data.private ?? false;
69902
+ let repo = data.repo;
69903
+ if (repo.startsWith("/")) {
69904
+ repo = repo.slice(1);
69905
+ }
69906
+ if (repo.endsWith("/")) {
69907
+ repo = repo.slice(0, -1);
69908
+ }
69909
+ if (pv) {
69910
+ _baseURL = `https://api.cnb.cool/${repo}/-/git/contents`;
69911
+ } else {
69912
+ _baseURL = `https://cnb.cool/${repo}/-/git/raw/main`;
69913
+ }
69914
+ }
69800
69915
  const project = opts?.project;
69801
69916
  if (project) {
69802
69917
  resources = resources.filter((item) => item.tags.includes(project));
69803
69918
  console.log(`Filtering resources by project "${project}", ${resources.length} resources to download.`);
69804
69919
  }
69805
69920
  const done = [];
69921
+ const headers = await this.parseHeader(data.headers || {});
69806
69922
  for (const resource of resources) {
69807
- let _url3 = resource.url || `${baseURL2}/${resource.name}`;
69923
+ let _url3 = resource.url || `${_baseURL}/${resource.name}`;
69924
+ const filePath = path12.join(config4.root, resource.name);
69925
+ const isExist = fileIsExist2(filePath);
69926
+ const dir = path12.dirname(filePath);
69808
69927
  try {
69809
- const res = await fetch(_url3);
69810
- let etag = res.headers.get("ETag");
69811
- if (etag === resource.hash) {
69812
- continue;
69813
- }
69814
- if (res.ok) {
69815
- const arrayBuffer = await res.arrayBuffer();
69816
- const buffer = Buffer.from(arrayBuffer);
69817
- const filePath = path12.join(config4.root, resource.name);
69818
- const dir = path12.dirname(filePath);
69928
+ const buffer = await download(_url3, { headers, hash: isExist ? resource.hash : undefined });
69929
+ if (buffer && buffer.buffer) {
69819
69930
  fs14.mkdirSync(dir, { recursive: true });
69820
- fs14.writeFileSync(filePath, buffer);
69821
- console.log(`Downloaded ${resource.name} from ${_url3}`);
69931
+ fs14.writeFileSync(filePath, buffer.buffer);
69932
+ console.log(`下载 ${resource.name}
69933
+ 下载地址为 ${_url3}`);
69822
69934
  done.push(resource);
69823
69935
  } else {
69824
- console.error(`Failed to download ${_url3}: ${res.statusText}`);
69936
+ if (buffer?.code === 304) {
69937
+ console.warn(`资源 ${resource.name} 未修改,跳过下载。`);
69938
+ } else {
69939
+ console.warn(`资源 ${resource.name} 下载失败,状态码 ${buffer?.code}。`);
69940
+ }
69825
69941
  }
69826
69942
  } catch (err) {
69827
- console.error(`Error downloading ${_url3}:`, err);
69943
+ console.error(`下载错误 ${_url3}:`, err);
69828
69944
  }
69829
69945
  }
69830
69946
  return done;
69831
69947
  }
69832
69948
  }
69949
+ var isCNBOpenApi = (url4) => {
69950
+ return url4.startsWith("https://api.cnb.cool");
69951
+ };
69952
+ var download = async (url4, opts) => {
69953
+ const isCNB = isCNBOpenApi(url4);
69954
+ if (isCNB) {
69955
+ return await downloadByCNBApi(url4, opts);
69956
+ } else {
69957
+ return await downloadResource(url4, opts);
69958
+ }
69959
+ };
69960
+ var downloadResource = async (url4, opts) => {
69961
+ const headers = opts?.headers || {};
69962
+ const res = await fetch(url4, { headers });
69963
+ let etag = res.headers.get("ETag");
69964
+ if (opts?.hash && etag === opts.hash) {
69965
+ return { code: 304, buffer: null };
69966
+ }
69967
+ if (res.ok) {
69968
+ const arrayBuffer = await res.arrayBuffer();
69969
+ return { code: 200, buffer: Buffer.from(arrayBuffer) };
69970
+ } else {
69971
+ console.error(`下载失败 ${url4}: ${res.statusText}`);
69972
+ return { code: res.status, buffer: null };
69973
+ }
69974
+ };
69975
+ var downloadByCNBApi = async (url4, opts) => {
69976
+ const hash3 = opts?.hash;
69977
+ const res = await fetch(url4, {
69978
+ headers: {
69979
+ Accept: "application/vnd.cnb.api+json",
69980
+ ...opts?.headers
69981
+ }
69982
+ });
69983
+ let resJson;
69984
+ try {
69985
+ resJson = await res.json();
69986
+ } catch (e) {
69987
+ console.error(`下载失败 ${url4}: ${res.statusText}`, e);
69988
+ return { code: res.status, buffer: null };
69989
+ }
69990
+ if (res.ok && resJson.type === "blob" && resJson.encoding === "base64" && resJson.content) {
69991
+ if (hash3 && resJson.sha === hash3) {
69992
+ return { code: 304, buffer: null };
69993
+ }
69994
+ const buffer = Buffer.from(resJson.content, "base64");
69995
+ return { code: 200, buffer };
69996
+ } else {
69997
+ console.error(`下载失败 ${url4}: ${res.statusText}`, resJson);
69998
+ return { code: res.status, buffer: null };
69999
+ }
70000
+ };
70001
+ var getRootIgnore = async (dir) => {
70002
+ const cnbIgnorePath = path12.join(dir, ".cnbignore");
70003
+ const gitIgnorePath = path12.join(dir, ".gitignore");
70004
+ let ignoreContent = "";
70005
+ if (fs14.existsSync(cnbIgnorePath)) {
70006
+ ignoreContent = fs14.readFileSync(cnbIgnorePath, "utf-8");
70007
+ } else if (fs14.existsSync(gitIgnorePath)) {
70008
+ ignoreContent = fs14.readFileSync(gitIgnorePath, "utf-8");
70009
+ }
70010
+ const ignore = ignoreContent.split(`
70011
+ `).map((line) => line.trim()).filter((line) => line && !line.startsWith("#"));
70012
+ const ignoreFG = ignore.map((line) => {
70013
+ if (line.startsWith("!")) {
70014
+ return "";
70015
+ }
70016
+ if (line.endsWith("/")) {
70017
+ return line + "**";
70018
+ }
70019
+ return line;
70020
+ }).filter(Boolean);
70021
+ return { ignore, ignoreFG };
70022
+ };
69833
70023
 
69834
70024
  // src/routes/pod/sync.ts
70025
+ import fs15 from "node:fs";
69835
70026
  app.route({
69836
70027
  path: "pod",
69837
70028
  key: "sync",
@@ -69880,16 +70071,18 @@ app.route({
69880
70071
  args: {
69881
70072
  project: exports_external2.string().describe("项目名称"),
69882
70073
  url: exports_external2.string().optional().describe("下载链接,如果不存在, 用当前文件夹下的kevisual.json"),
69883
- repo: exports_external2.string().optional().describe("获取cnb仓库对应的kevisual.json,地址,构建一个url。")
70074
+ repo: exports_external2.string().optional().describe("获取cnb仓库对应的kevisual.json,地址,构建一个url。"),
70075
+ kevisualName: exports_external2.string().optional().describe("自定义kevisual文件名, 默认为kevisual, 会检测kevisual.json")
69884
70076
  }
69885
70077
  }
69886
70078
  }).define(async (ctx) => {
69887
70079
  let url4 = ctx.args.url;
69888
70080
  const project = ctx.args.project || "";
69889
- const pod = new KevisualPod;
70081
+ const kevisualName = ctx.args.kevisualName;
70082
+ const pod = new KevisualPod({ kevisualName });
69890
70083
  const repo = ctx.args.repo;
69891
70084
  if (repo) {
69892
- url4 = `https://cnb.cool/${repo}/-/git/raw/main/kevisual.json`;
70085
+ url4 = `https://cnb.cool/${repo}/-/git/raw/main/${kevisualName || "kevisual"}.json`;
69893
70086
  }
69894
70087
  const data = await pod.getKevisualJSON({ url: url4 });
69895
70088
  if (data) {
@@ -69904,6 +70097,28 @@ app.route({
69904
70097
  content: "完成"
69905
70098
  };
69906
70099
  }).addTo(app);
70100
+ app.route({
70101
+ path: "pod",
70102
+ key: "fetch",
70103
+ middleware: ["auth-admin"]
70104
+ }).define(async (ctx) => {
70105
+ const url4 = "https://api.cnb.cool/xzzlwl/httpecho/-/git/contents/package.json";
70106
+ const CNB_API_KEY = useKey("CNB_API_KEY");
70107
+ console.log("CNB_API_KEY", CNB_API_KEY);
70108
+ const res = await downloadByCNBApi(url4, {
70109
+ headers: {
70110
+ Authorization: `${CNB_API_KEY}`
70111
+ }
70112
+ });
70113
+ if (res.code === 200 && res.buffer) {
70114
+ fs15.writeFileSync("./test.json", res.buffer);
70115
+ } else {
70116
+ console.error(`下载失败 ${url4}: ${res.code}`);
70117
+ }
70118
+ ctx.body = {
70119
+ content: "完成"
70120
+ };
70121
+ }).addTo(app);
69907
70122
 
69908
70123
  // src/index.ts
69909
70124
  app.createAuth(() => {});
@@ -69926,7 +70141,7 @@ var {
69926
70141
  } = import__3.default;
69927
70142
 
69928
70143
  // src/program.ts
69929
- import fs15 from "fs";
70144
+ import fs16 from "fs";
69930
70145
  var version3 = useContextKey("version", () => {
69931
70146
  let version4 = "0.1.33";
69932
70147
  try {
@@ -69938,7 +70153,7 @@ var version3 = useContextKey("version", () => {
69938
70153
  program.name("app").description("A CLI tool with envison").version(version3, "-V, --version");
69939
70154
  var ls = new Command("ls").description("List files in the current directory").action(() => {
69940
70155
  console.log("List files");
69941
- console.log(fs15.readdirSync(process.cwd()));
70156
+ console.log(fs16.readdirSync(process.cwd()));
69942
70157
  });
69943
70158
  program.addCommand(ls);
69944
70159
 
@@ -70094,7 +70309,7 @@ program.addCommand(logoutCommand);
70094
70309
  var import_fast_glob3 = __toESM(require_out4(), 1);
70095
70310
  var import_form_data2 = __toESM(require_form_data(), 1);
70096
70311
  import path13 from "path";
70097
- import fs16 from "fs";
70312
+ import fs17 from "fs";
70098
70313
 
70099
70314
  // src/module/download/upload.ts
70100
70315
  var import_form_data = __toESM(require_form_data(), 1);
@@ -70178,11 +70393,11 @@ var upload = (opts) => {
70178
70393
  var nanoid7 = customAlphabet2("abcdefghijklmnopqrstuvwxyz", 8);
70179
70394
  var getPackageJson = (opts) => {
70180
70395
  const filePath = path13.join(process.cwd(), "package.json");
70181
- if (!fs16.existsSync(filePath)) {
70396
+ if (!fs17.existsSync(filePath)) {
70182
70397
  return null;
70183
70398
  }
70184
70399
  try {
70185
- const packageJson = JSON.parse(fs16.readFileSync(filePath, "utf-8"));
70400
+ const packageJson = JSON.parse(fs17.readFileSync(filePath, "utf-8"));
70186
70401
  const basename = packageJson.basename || "";
70187
70402
  const version4 = packageJson.version || "1.0.0";
70188
70403
  const app2 = packageJson.app;
@@ -70217,7 +70432,7 @@ var command2 = new Command("deploy").description("把前端文件传到服务器
70217
70432
  }
70218
70433
  const pwd = process.cwd();
70219
70434
  const directory = path13.join(pwd, filePath);
70220
- const stat = fs16.statSync(directory);
70435
+ const stat = fs17.statSync(directory);
70221
70436
  let _relativeFiles = [];
70222
70437
  let isDirectory = false;
70223
70438
  if (stat.isDirectory()) {
@@ -70301,7 +70516,7 @@ var uploadFilesV2 = async (files, directory, opts) => {
70301
70516
  const form = new import_form_data2.default;
70302
70517
  const filename = path13.basename(filePath);
70303
70518
  const encodedFilename = Buffer.from(filename, "utf-8").toString("binary");
70304
- form.append("file", fs16.createReadStream(filePath), {
70519
+ form.append("file", fs17.createReadStream(filePath), {
70305
70520
  filename: encodedFilename,
70306
70521
  filepath: file3
70307
70522
  });
@@ -70369,7 +70584,8 @@ var deployLoadFn = async (id, org) => {
70369
70584
  logger.error("deploy-load failed", res.message);
70370
70585
  }
70371
70586
  };
70372
- var deployLoad = new Command("deploy-load").description("部署加载").argument("<id>", "id").option("-o, --org <org>", "org").action(async (id, opts) => {
70587
+ var deployLoad = new Command("deploy-load").description("部署加载").argument("<id>", "id").option("-o, --org <org>", "org").option("-p, --publish ", "是否公开").action(async (id, opts) => {
70588
+ const publish = !!opts.publish;
70373
70589
  deployLoadFn(id, opts?.org);
70374
70590
  });
70375
70591
  program.addCommand(deployLoad);
@@ -70377,7 +70593,7 @@ program.addCommand(deployLoad);
70377
70593
  // src/command/npm.ts
70378
70594
  import path14 from "path";
70379
70595
  import { spawn as spawn4 } from "child_process";
70380
- import fs17 from "fs";
70596
+ import fs18 from "fs";
70381
70597
 
70382
70598
  // src/uitls/npm.ts
70383
70599
  import { spawn as spawn3, spawnSync } from "child_process";
@@ -70428,7 +70644,7 @@ var publishRegistry = (options2) => {
70428
70644
  [key]: config4[key]
70429
70645
  };
70430
70646
  }, {});
70431
- const pkg = fs17.readFileSync(packageJson, "utf-8");
70647
+ const pkg = fs18.readFileSync(packageJson, "utf-8");
70432
70648
  const pkgJson = parseIfJson2(pkg);
70433
70649
  const version4 = pkgJson?.version;
70434
70650
  if (version4 && options2?.tag) {
@@ -70516,7 +70732,7 @@ var getnpmrc = new Command("get").action(async () => {
70516
70732
  const execPath = process.cwd();
70517
70733
  const npmrcPath = path14.resolve(execPath, ".npmrc");
70518
70734
  if (fileIsExist2(npmrcPath)) {
70519
- const npmrcContent = fs17.readFileSync(npmrcPath, "utf-8");
70735
+ const npmrcContent = fs18.readFileSync(npmrcPath, "utf-8");
70520
70736
  console.log(npmrcContent);
70521
70737
  }
70522
70738
  });
@@ -70545,7 +70761,7 @@ var npmrc = new Command("set").description("set .npmrc").option("-f <force>").ac
70545
70761
  writeFlag = true;
70546
70762
  }
70547
70763
  if (writeFlag) {
70548
- fs17.writeFileSync(npmrcPath, npmrcContent);
70764
+ fs18.writeFileSync(npmrcPath, npmrcContent);
70549
70765
  console.log(chalk2.green("write .npmrc success"));
70550
70766
  }
70551
70767
  });
@@ -70554,7 +70770,7 @@ var remove = new Command("remove").description("remove .npmrc").action(async ()
70554
70770
  const execPath = process.cwd();
70555
70771
  const npmrcPath = path14.resolve(execPath, ".npmrc");
70556
70772
  if (fileIsExist2(npmrcPath)) {
70557
- fs17.unlinkSync(npmrcPath);
70773
+ fs18.unlinkSync(npmrcPath);
70558
70774
  console.log(chalk2.green("remove .npmrc success"));
70559
70775
  } else {
70560
70776
  console.log(chalk2.green(".npmrc success"));
@@ -70588,7 +70804,7 @@ var patchFunc = (opts) => {
70588
70804
  const cwd = opts?.directory || process.cwd();
70589
70805
  const packageJson = path14.resolve(cwd, "package.json");
70590
70806
  if (fileIsExist2(packageJson)) {
70591
- const pkg = fs17.readFileSync(packageJson, "utf-8");
70807
+ const pkg = fs18.readFileSync(packageJson, "utf-8");
70592
70808
  const pkgJson = parseIfJson2(pkg);
70593
70809
  const version4 = pkgJson?.version;
70594
70810
  if (version4) {
@@ -70597,7 +70813,7 @@ var patchFunc = (opts) => {
70597
70813
  const patchVersion = Number(versionArr[2]) + 1;
70598
70814
  const newVersion = `${versionArr[0]}.${versionArr[1]}.${patchVersion}`;
70599
70815
  pkgJson.version = newVersion;
70600
- fs17.writeFileSync(packageJson, JSON.stringify(pkgJson, null, 2));
70816
+ fs18.writeFileSync(packageJson, JSON.stringify(pkgJson, null, 2));
70601
70817
  console.log(chalk2.green(`${pkgJson?.name} 更新到版本: ${newVersion}`));
70602
70818
  }
70603
70819
  }
@@ -70611,7 +70827,7 @@ program.addCommand(command3);
70611
70827
 
70612
70828
  // src/command/publish.ts
70613
70829
  var import_fast_glob4 = __toESM(require_out4(), 1);
70614
- import fs18 from "fs";
70830
+ import fs19 from "fs";
70615
70831
  import path15 from "path";
70616
70832
  // src/query/services/index.ts
70617
70833
  var queryServiceOperate = async (appKey, action) => {
@@ -70647,18 +70863,18 @@ var queryServiceDelect = async (appKey) => {
70647
70863
 
70648
70864
  // src/command/publish.ts
70649
70865
  async function findFileInsensitive(targetFile) {
70650
- const files = fs18.readdirSync(".");
70866
+ const files = fs19.readdirSync(".");
70651
70867
  const matchedFile = files.find((file3) => file3.toLowerCase() === targetFile.toLowerCase());
70652
70868
  return matchedFile || null;
70653
70869
  }
70654
70870
  async function collectFileInfo(filePath, baseDir = ".") {
70655
- const stats = fs18.statSync(filePath);
70871
+ const stats = fs19.statSync(filePath);
70656
70872
  const relativePath = path15.relative(baseDir, filePath);
70657
70873
  if (stats.isFile()) {
70658
70874
  return [{ path: relativePath, size: stats.size }];
70659
70875
  }
70660
70876
  if (stats.isDirectory()) {
70661
- const files = fs18.readdirSync(filePath);
70877
+ const files = fs19.readdirSync(filePath);
70662
70878
  const results = await Promise.all(files.map((file3) => collectFileInfo(path15.join(filePath, file3), baseDir)));
70663
70879
  return results.flat();
70664
70880
  }
@@ -70667,12 +70883,12 @@ async function collectFileInfo(filePath, baseDir = ".") {
70667
70883
  var copyFilesToPackDist = async (files, cwd, packDist = "pack-dist", mergeDist = true) => {
70668
70884
  const packDistPath = path15.join(cwd, packDist);
70669
70885
  if (!fileIsExist2(packDistPath)) {
70670
- fs18.mkdirSync(packDistPath, { recursive: true });
70886
+ fs19.mkdirSync(packDistPath, { recursive: true });
70671
70887
  } else {
70672
- fs18.rmSync(packDistPath, { recursive: true, force: true });
70888
+ fs19.rmSync(packDistPath, { recursive: true, force: true });
70673
70889
  }
70674
70890
  files.forEach((file3) => {
70675
- const stat = fs18.statSync(path15.join(cwd, file3));
70891
+ const stat = fs19.statSync(path15.join(cwd, file3));
70676
70892
  let outputFile = file3;
70677
70893
  if (mergeDist) {
70678
70894
  if (file3.startsWith("dist/")) {
@@ -70682,9 +70898,9 @@ var copyFilesToPackDist = async (files, cwd, packDist = "pack-dist", mergeDist =
70682
70898
  }
70683
70899
  }
70684
70900
  if (stat.isDirectory()) {
70685
- fs18.cpSync(path15.join(cwd, file3), path15.join(packDistPath, outputFile), { recursive: true });
70901
+ fs19.cpSync(path15.join(cwd, file3), path15.join(packDistPath, outputFile), { recursive: true });
70686
70902
  } else {
70687
- fs18.copyFileSync(path15.join(cwd, file3), path15.join(packDistPath, outputFile));
70903
+ fs19.copyFileSync(path15.join(cwd, file3), path15.join(packDistPath, outputFile));
70688
70904
  }
70689
70905
  });
70690
70906
  const packageInfo = await getPackageInfo();
@@ -70719,7 +70935,7 @@ ${filesString}
70719
70935
 
70720
70936
  </html>`;
70721
70937
  if (!fileIsExist2(indexHtmlPath)) {
70722
- fs18.writeFileSync(indexHtmlPath, indexHtmlContent);
70938
+ fs19.writeFileSync(indexHtmlPath, indexHtmlContent);
70723
70939
  }
70724
70940
  };
70725
70941
  var pack = async (opts) => {
@@ -70733,7 +70949,7 @@ var pack = async (opts) => {
70733
70949
  }
70734
70950
  let packageJson;
70735
70951
  try {
70736
- const packageContent = fs18.readFileSync(packageJsonPath, "utf-8");
70952
+ const packageContent = fs19.readFileSync(packageJsonPath, "utf-8");
70737
70953
  packageJson = JSON.parse(packageContent);
70738
70954
  } catch (error49) {
70739
70955
  console.error("Invalid package.json:", error49);
@@ -70777,7 +70993,7 @@ var pack = async (opts) => {
70777
70993
  }
70778
70994
  const readme = await findFileInsensitive("README.md");
70779
70995
  if (readme) {
70780
- const readmeContent = fs18.readFileSync(readme, "utf-8");
70996
+ const readmeContent = fs19.readFileSync(readme, "utf-8");
70781
70997
  collection.readme = readmeContent;
70782
70998
  }
70783
70999
  return { collection, dir: cwd };
@@ -70786,7 +71002,7 @@ var getPackageInfo = async () => {
70786
71002
  const cwd = process.cwd();
70787
71003
  const packageJsonPath = path15.join(cwd, "package.json");
70788
71004
  try {
70789
- const packageJson = JSON.parse(fs18.readFileSync(packageJsonPath, "utf-8"));
71005
+ const packageJson = JSON.parse(fs19.readFileSync(packageJsonPath, "utf-8"));
70790
71006
  return packageJson;
70791
71007
  } catch (error49) {
70792
71008
  console.error("Invalid package.json:", error49);
@@ -70876,7 +71092,7 @@ var packCommand = new Command("pack").description("打包应用, 使用 package.
70876
71092
  if (opts?.clean) {
70877
71093
  const newPackageJson = { ...packageInfo };
70878
71094
  delete newPackageJson.devDependencies;
70879
- fs18.writeFileSync(path15.join(process.cwd(), "pack-dist", "package.json"), JSON.stringify(newPackageJson, null, 2));
71095
+ fs19.writeFileSync(path15.join(process.cwd(), "pack-dist", "package.json"), JSON.stringify(newPackageJson, null, 2));
70880
71096
  }
70881
71097
  if (opts.publish) {
70882
71098
  const [_app, _command] = process.argv;
@@ -70994,7 +71210,7 @@ servicesCommand.addCommand(detectCommand);
70994
71210
 
70995
71211
  // src/command/sync/modules/base.ts
70996
71212
  import path16 from "node:path";
70997
- import fs19 from "node:fs";
71213
+ import fs20 from "node:fs";
70998
71214
  var import_fast_glob5 = __toESM(require_out4(), 1);
70999
71215
  var import_micromatch = __toESM(require_micromatch(), 1);
71000
71216
  var checkAuth = (value = "", baseURL2 = "") => {
@@ -71043,7 +71259,7 @@ class SyncBase {
71043
71259
  const filepath = path16.join(dir, filename);
71044
71260
  if (!fileIsExist2(filepath))
71045
71261
  throw new Error("config file not found");
71046
- const config4 = JSON.parse(fs19.readFileSync(filepath, "utf-8"));
71262
+ const config4 = JSON.parse(fs20.readFileSync(filepath, "utf-8"));
71047
71263
  const sync = config4.sync || {};
71048
71264
  const keys = Object.keys(sync);
71049
71265
  const newConfigSync = {};
@@ -71247,7 +71463,7 @@ class SyncBase {
71247
71463
  const dir = path16.dirname(filepath);
71248
71464
  if (check3) {
71249
71465
  if (!fileIsExist2(dir)) {
71250
- fs19.mkdirSync(dir, { recursive: true });
71466
+ fs20.mkdirSync(dir, { recursive: true });
71251
71467
  }
71252
71468
  }
71253
71469
  return dir;
@@ -71257,7 +71473,7 @@ class SyncBase {
71257
71473
  }
71258
71474
 
71259
71475
  // src/command/sync/sync.ts
71260
- import fs20 from "node:fs";
71476
+ import fs21 from "node:fs";
71261
71477
  import path17 from "node:path";
71262
71478
  var command4 = new Command("sync").option("-d --dir <dir>").description("同步项目").action(() => {
71263
71479
  console.log("同步项目");
@@ -71305,7 +71521,7 @@ var syncUpload = new Command("upload").option("-d --dir <dir>", "配置目录").
71305
71521
  }
71306
71522
  const res = await upload({
71307
71523
  token,
71308
- file: fs20.readFileSync(item.filepath),
71524
+ file: fs21.readFileSync(item.filepath),
71309
71525
  url: item.url,
71310
71526
  needHash: true,
71311
71527
  hash: item.hash,
@@ -71352,7 +71568,7 @@ var syncDownload = new Command("download").option("-d --dir <dir>", "配置目
71352
71568
  const { content, status } = await fetchLink(item.url, { setToken: item.auth, returnContent: true, hash: hash3 });
71353
71569
  if (status === 200) {
71354
71570
  await sync.getDir(item.filepath, true);
71355
- fs20.writeFileSync(item.filepath, content);
71571
+ fs21.writeFileSync(item.filepath, content);
71356
71572
  logger.info("下载成功", item.key, chalk2.green(item.url));
71357
71573
  } else if (status === 304) {
71358
71574
  logger.info("文件未修改", item.key, chalk2.green(item.url));
@@ -71395,7 +71611,7 @@ var syncCreateList = new Command("create").option("-d --dir <dir>", "配置目
71395
71611
  const filepath = sync.getRelativePath(opts.output);
71396
71612
  if (filepath) {
71397
71613
  logger.debug("输出文件", filepath);
71398
- fs20.writeFileSync(filepath.absolute, JSON.stringify(newJson, null, 2));
71614
+ fs21.writeFileSync(filepath.absolute, JSON.stringify(newJson, null, 2));
71399
71615
  } else {
71400
71616
  logger.info(`输出内容
71401
71617
  `);
@@ -71412,7 +71628,7 @@ var clone3 = new Command("clone").option("-d --dir <dir>", "配置目录").optio
71412
71628
  }
71413
71629
  const res = await query.fetchText(link);
71414
71630
  if (res.code === 200) {
71415
- fs20.writeFileSync(sync.configPath, JSON.stringify(res.data, null, 2));
71631
+ fs21.writeFileSync(sync.configPath, JSON.stringify(res.data, null, 2));
71416
71632
  } else {
71417
71633
  logger.error("下载配置文件失败", link, res);
71418
71634
  return;
@@ -71477,7 +71693,7 @@ var clone3 = new Command("clone").option("-d --dir <dir>", "配置目录").optio
71477
71693
  if (needDownload) {
71478
71694
  const { content, status } = await fetchLink(matchItem.url, { setToken: item.auth, returnContent: true, hash: hash3 });
71479
71695
  if (status === 200) {
71480
- fs20.writeFileSync(matchItem.absolute, content);
71696
+ fs21.writeFileSync(matchItem.absolute, content);
71481
71697
  logger.info("下载成功", matchItem.pathname, chalk2.green(matchItem.url));
71482
71698
  } else if (status === 304) {
71483
71699
  logger.info("文件未修改", matchItem.pathname, chalk2.green(matchItem.url));
@@ -71502,11 +71718,11 @@ program.addCommand(command4);
71502
71718
  // src/command/coding-plan/cc.ts
71503
71719
  import path18 from "node:path";
71504
71720
  import os4 from "node:os";
71505
- import fs21 from "node:fs";
71721
+ import fs22 from "node:fs";
71506
71722
  var MODELS = ["minimax", "glm", "volcengine", "bailian"];
71507
71723
  var changeMinimax = (token) => {
71508
- const auth_token = token || useKey("MINIMAX_API_KEY");
71509
- const MINIMAX_MODEL = useKey("MINIMAX_MODEL") || "MiniMax-M2.5";
71724
+ const auth_token = token || useKey2("MINIMAX_API_KEY");
71725
+ const MINIMAX_MODEL = useKey2("MINIMAX_MODEL") || "MiniMax-M2.5";
71510
71726
  return {
71511
71727
  env: {
71512
71728
  ANTHROPIC_AUTH_TOKEN: auth_token,
@@ -71521,7 +71737,7 @@ var changeMinimax = (token) => {
71521
71737
  };
71522
71738
  };
71523
71739
  var changeGLM = (token) => {
71524
- const auth_token = token || useKey("ZHIPU_API_KEY");
71740
+ const auth_token = token || useKey2("ZHIPU_API_KEY");
71525
71741
  return {
71526
71742
  env: {
71527
71743
  ANTHROPIC_AUTH_TOKEN: auth_token,
@@ -71534,7 +71750,7 @@ var changeGLM = (token) => {
71534
71750
  };
71535
71751
  };
71536
71752
  var changeVolcengine = (token) => {
71537
- const auth_token = token || useKey("VOLCENGINE_API_KEY");
71753
+ const auth_token = token || useKey2("VOLCENGINE_API_KEY");
71538
71754
  return {
71539
71755
  env: {
71540
71756
  ANTHROPIC_AUTH_TOKEN: auth_token,
@@ -71548,7 +71764,7 @@ var changeVolcengine = (token) => {
71548
71764
  };
71549
71765
  };
71550
71766
  var changeBailian = (token) => {
71551
- const auth_token = token || useKey("BAILIAN_API_KEY");
71767
+ const auth_token = token || useKey2("BAILIAN_API_KEY");
71552
71768
  return {
71553
71769
  env: {
71554
71770
  ANTHROPIC_AUTH_TOKEN: auth_token,
@@ -71565,8 +71781,8 @@ var changeNoCheck = () => {
71565
71781
  const homeDir = os4.homedir();
71566
71782
  const claudeConfigPath = path18.join(homeDir, ".claude.json");
71567
71783
  let claudeConfig = {};
71568
- if (fs21.existsSync(claudeConfigPath)) {
71569
- const content = fs21.readFileSync(claudeConfigPath, "utf-8");
71784
+ if (fs22.existsSync(claudeConfigPath)) {
71785
+ const content = fs22.readFileSync(claudeConfigPath, "utf-8");
71570
71786
  try {
71571
71787
  claudeConfig = JSON.parse(content);
71572
71788
  } catch {
@@ -71577,7 +71793,7 @@ var changeNoCheck = () => {
71577
71793
  ...claudeConfig,
71578
71794
  hasCompletedOnboarding: true
71579
71795
  };
71580
- fs21.writeFileSync(claudeConfigPath, JSON.stringify(claudeConfig, null, 2));
71796
+ fs22.writeFileSync(claudeConfigPath, JSON.stringify(claudeConfig, null, 2));
71581
71797
  };
71582
71798
  var modelConfig = {
71583
71799
  minimax: changeMinimax,
@@ -71586,8 +71802,8 @@ var modelConfig = {
71586
71802
  bailian: changeBailian
71587
71803
  };
71588
71804
  var readOrCreateConfig = (configPath2) => {
71589
- if (fs21.existsSync(configPath2)) {
71590
- const content = fs21.readFileSync(configPath2, "utf-8");
71805
+ if (fs22.existsSync(configPath2)) {
71806
+ const content = fs22.readFileSync(configPath2, "utf-8");
71591
71807
  try {
71592
71808
  return JSON.parse(content);
71593
71809
  } catch {
@@ -71597,7 +71813,7 @@ var readOrCreateConfig = (configPath2) => {
71597
71813
  return {};
71598
71814
  };
71599
71815
  var saveConfig = (configPath2, config4) => {
71600
- fs21.writeFileSync(configPath2, JSON.stringify(config4, null, 2));
71816
+ fs22.writeFileSync(configPath2, JSON.stringify(config4, null, 2));
71601
71817
  };
71602
71818
  var command5 = new Command("cc").description("切换claude code模型,支持GLM4.7、Minimax和豆包").option("-m, --models <model:string>", `选择模型: ${MODELS.join(" | ")}`).action(async (options2) => {
71603
71819
  const configPath2 = path18.join(os4.homedir(), ".claude/settings.json");
@@ -71623,10 +71839,10 @@ program.addCommand(command5);
71623
71839
  // src/command/coding-plan/oc.ts
71624
71840
  import path19 from "node:path";
71625
71841
  import os5 from "node:os";
71626
- import fs22 from "node:fs";
71842
+ import fs23 from "node:fs";
71627
71843
  var readOpencodeConfig = (configPath2) => {
71628
- if (fs22.existsSync(configPath2)) {
71629
- const content = fs22.readFileSync(configPath2, "utf-8");
71844
+ if (fs23.existsSync(configPath2)) {
71845
+ const content = fs23.readFileSync(configPath2, "utf-8");
71630
71846
  try {
71631
71847
  return JSON.parse(content);
71632
71848
  } catch {
@@ -71636,7 +71852,7 @@ var readOpencodeConfig = (configPath2) => {
71636
71852
  return { provider: {} };
71637
71853
  };
71638
71854
  var saveOpencodeConfig = (configPath2, config4) => {
71639
- fs22.writeFileSync(configPath2, JSON.stringify(config4, null, 2));
71855
+ fs23.writeFileSync(configPath2, JSON.stringify(config4, null, 2));
71640
71856
  };
71641
71857
  var extractAvailableModels = (config4) => {
71642
71858
  const models = [];
@@ -71707,7 +71923,7 @@ program.addCommand(command6);
71707
71923
  // packages/common/mark-local/modules/manager.ts
71708
71924
  var import_fast_glob6 = __toESM(require_out4(), 1);
71709
71925
  var import_gray_matter = __toESM(require_gray_matter(), 1);
71710
- import fs23 from "node:fs";
71926
+ import fs24 from "node:fs";
71711
71927
  import path20 from "node:path";
71712
71928
  import crypto6 from "node:crypto";
71713
71929
  var hashFile = (content) => {
@@ -71735,7 +71951,7 @@ class MarkLocalManager {
71735
71951
  if (!fileIsExist3(fullPath)) {
71736
71952
  return null;
71737
71953
  }
71738
- const stat = fs23.statSync(fullPath);
71954
+ const stat = fs24.statSync(fullPath);
71739
71955
  if (!stat.isDirectory()) {
71740
71956
  return null;
71741
71957
  }
@@ -71754,7 +71970,7 @@ class MarkLocalManager {
71754
71970
  }
71755
71971
  for (const file3 of files) {
71756
71972
  try {
71757
- const content = fs23.readFileSync(path20.resolve(dir, file3), "utf-8");
71973
+ const content = fs24.readFileSync(path20.resolve(dir, file3), "utf-8");
71758
71974
  const matterContent = import_gray_matter.default(content);
71759
71975
  const hash3 = hashFile(content);
71760
71976
  datas.push({
@@ -71784,7 +72000,7 @@ class MarkLocalManager {
71784
72000
  if (!fileIsExist3(filepath)) {
71785
72001
  return null;
71786
72002
  }
71787
- const content = fs23.readFileSync(filepath, "utf-8");
72003
+ const content = fs24.readFileSync(filepath, "utf-8");
71788
72004
  const matterContent = import_gray_matter.default(content);
71789
72005
  return matterContent;
71790
72006
  }
@@ -71799,7 +72015,7 @@ class MarkLocalManager {
71799
72015
  return false;
71800
72016
  }
71801
72017
  if (!hasRoot) {
71802
- fs23.mkdirSync(config4.root, { recursive: true });
72018
+ fs24.mkdirSync(config4.root, { recursive: true });
71803
72019
  isNew = true;
71804
72020
  }
71805
72021
  await this.syncLocal();
@@ -71818,7 +72034,7 @@ class MarkLocalManager {
71818
72034
  const newFiles = [];
71819
72035
  for (const file3 of fileList) {
71820
72036
  try {
71821
- const statSync = fs23.statSync(path20.resolve(config4.root, file3));
72037
+ const statSync = fs24.statSync(path20.resolve(config4.root, file3));
71822
72038
  const existFile = hasFiles.find((f) => f.name === file3);
71823
72039
  if (!existFile) {
71824
72040
  newFiles.push({
@@ -71830,7 +72046,7 @@ class MarkLocalManager {
71830
72046
  let needUpdate = !existFile.updatedAt || statSync.mtimeMs > existFile.updatedAt;
71831
72047
  if (needUpdate) {
71832
72048
  existFile.updatedAt = statSync.mtimeMs;
71833
- const content = fs23.readFileSync(path20.resolve(config4.root, file3), "utf-8");
72049
+ const content = fs24.readFileSync(path20.resolve(config4.root, file3), "utf-8");
71834
72050
  const matterContent = import_gray_matter.default(content);
71835
72051
  existFile.title = matterContent.data?.title || "";
71836
72052
  }
@@ -71854,17 +72070,17 @@ class MarkLocalManager {
71854
72070
  name: config4.folder,
71855
72071
  files: []
71856
72072
  };
71857
- fs23.writeFileSync(manifestPath, JSON.stringify(defaultConfig, null, 2), "utf-8");
72073
+ fs24.writeFileSync(manifestPath, JSON.stringify(defaultConfig, null, 2), "utf-8");
71858
72074
  return defaultConfig;
71859
72075
  }
71860
- const content = fs23.readFileSync(manifestPath, "utf-8");
72076
+ const content = fs24.readFileSync(manifestPath, "utf-8");
71861
72077
  const manifest = JSON.parse(content);
71862
72078
  return manifest;
71863
72079
  }
71864
72080
  saveManifest(manifest) {
71865
72081
  const config4 = this.getConfig();
71866
72082
  const manifestPath = config4.mainifest;
71867
- fs23.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
72083
+ fs24.writeFileSync(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
71868
72084
  }
71869
72085
  async build(opts) {
71870
72086
  const config4 = this.getConfig();
@@ -71881,11 +72097,25 @@ class MarkLocalManager {
71881
72097
  const markPath = path20.resolve(config4.root, mark.name);
71882
72098
  const markDir = path20.dirname(markPath);
71883
72099
  if (!fileIsExist3(markDir)) {
71884
- fs23.mkdirSync(markDir, { recursive: true });
72100
+ fs24.mkdirSync(markDir, { recursive: true });
71885
72101
  }
71886
- fs23.writeFileSync(path20.join(markDir, "data.json"), JSON.stringify(mark, null, 2), "utf-8");
72102
+ fs24.writeFileSync(path20.join(markDir, "data.json"), JSON.stringify(mark, null, 2), "utf-8");
71887
72103
  if (opts?.stat) {
71888
- const statInfo = fs23.statSync(markPath);
72104
+ const statInfo = fs24.statSync(markPath);
72105
+ const resources = mark.data?.resources || [];
72106
+ let resourceSize = 0;
72107
+ for (let resource of resources) {
72108
+ if (resource?.name && resource?.type === "file") {
72109
+ const filePath = path20.resolve(markDir, resource.name);
72110
+ console.log(`Calculating size for resource: ${filePath}`);
72111
+ try {
72112
+ const resStat = fs24.statSync(filePath);
72113
+ resourceSize += resStat.size;
72114
+ } catch (error49) {
72115
+ console.error(`Failed to get stat for resource: ${resource.name}`, error49);
72116
+ }
72117
+ }
72118
+ }
71889
72119
  stat.push({
71890
72120
  name: config4.folder + "/" + mark.name,
71891
72121
  size: statInfo.size,
@@ -71893,13 +72123,13 @@ class MarkLocalManager {
71893
72123
  tags: mark.tags || [],
71894
72124
  summary: mark.summary || "",
71895
72125
  updatedAt: mark?.updatedAt || statInfo.mtimeMs,
71896
- data: mark.data?.resources || []
72126
+ data: { resources, resourceSize }
71897
72127
  });
71898
72128
  }
71899
72129
  }
71900
72130
  } catch (error49) {}
71901
72131
  }
71902
- fs23.writeFileSync(config4.data, JSON.stringify(result, null, 2), "utf-8");
72132
+ fs24.writeFileSync(config4.data, JSON.stringify(result, null, 2), "utf-8");
71903
72133
  return {
71904
72134
  data: {
71905
72135
  list: markList,
@@ -71927,7 +72157,7 @@ var getPath2 = (dir) => {
71927
72157
  };
71928
72158
  var fileIsExist3 = (filepath) => {
71929
72159
  try {
71930
- fs23.accessSync(filepath, fs23.constants.F_OK);
72160
+ fs24.accessSync(filepath, fs24.constants.F_OK);
71931
72161
  return true;
71932
72162
  } catch (err) {
71933
72163
  return false;
@@ -71937,7 +72167,7 @@ var fileIsExist3 = (filepath) => {
71937
72167
  // src/command/mark.ts
71938
72168
  var markCmd = new Command("mark").alias("m").description("mark相关命令");
71939
72169
  program.addCommand(markCmd);
71940
- var init = new Command("init").description("初始化mark相关文件").option("-d, --dir <dir>", "目录,默认为当前目录").action(async (opts) => {
72170
+ var init = new Command("sync").alias("init").description("初始化mark相关文件").option("-d, --dir <dir>", "目录,默认为当前目录").action(async (opts) => {
71941
72171
  const dir = opts.dir;
71942
72172
  const markLocal = new MarkLocalManager({ root: dir });
71943
72173
  await markLocal.mount();
@@ -72768,7 +72998,7 @@ var require_command2 = __commonJS4((exports) => {
72768
72998
  var EventEmitter5 = __require4("node:events").EventEmitter;
72769
72999
  var childProcess = __require4("node:child_process");
72770
73000
  var path21 = __require4("node:path");
72771
- var fs24 = __require4("node:fs");
73001
+ var fs25 = __require4("node:fs");
72772
73002
  var process22 = __require4("node:process");
72773
73003
  var { Argument: Argument2, humanReadableArgName } = require_argument2();
72774
73004
  var { CommanderError: CommanderError2 } = require_error3();
@@ -73303,7 +73533,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
73303
73533
  this.processedArgs = [];
73304
73534
  }
73305
73535
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
73306
- if (fs24.existsSync(executableFile))
73536
+ if (fs25.existsSync(executableFile))
73307
73537
  return;
73308
73538
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
73309
73539
  const executableMissing = `'${executableFile}' does not exist
@@ -73318,11 +73548,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
73318
73548
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
73319
73549
  function findFile(baseDir, baseName) {
73320
73550
  const localBin = path21.resolve(baseDir, baseName);
73321
- if (fs24.existsSync(localBin))
73551
+ if (fs25.existsSync(localBin))
73322
73552
  return localBin;
73323
73553
  if (sourceExt.includes(path21.extname(baseName)))
73324
73554
  return;
73325
- const foundExt = sourceExt.find((ext) => fs24.existsSync(`${localBin}${ext}`));
73555
+ const foundExt = sourceExt.find((ext) => fs25.existsSync(`${localBin}${ext}`));
73326
73556
  if (foundExt)
73327
73557
  return `${localBin}${foundExt}`;
73328
73558
  return;
@@ -73334,7 +73564,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
73334
73564
  if (this._scriptPath) {
73335
73565
  let resolvedScriptPath;
73336
73566
  try {
73337
- resolvedScriptPath = fs24.realpathSync(this._scriptPath);
73567
+ resolvedScriptPath = fs25.realpathSync(this._scriptPath);
73338
73568
  } catch {
73339
73569
  resolvedScriptPath = this._scriptPath;
73340
73570
  }
@@ -88446,10 +88676,10 @@ app.route({
88446
88676
 
88447
88677
  // packages/common/mark-local/file.ts
88448
88678
  import path24 from "node:path";
88449
- import fs25 from "node:fs";
88679
+ import fs26 from "node:fs";
88450
88680
 
88451
88681
  // assistant/src/module/assistant/proxy/pipe.ts
88452
- import * as fs24 from "fs";
88682
+ import * as fs25 from "fs";
88453
88683
 
88454
88684
  // assistant/src/module/assistant/proxy/utils.ts
88455
88685
  var isBun2 = typeof Bun !== "undefined" && Bun?.version != null;
@@ -88553,7 +88783,7 @@ var console2 = {
88553
88783
 
88554
88784
  // assistant/src/module/assistant/proxy/pipe.ts
88555
88785
  var pipeFileStream = (filePath, res) => {
88556
- const readStream = fs24.createReadStream(filePath);
88786
+ const readStream = fs25.createReadStream(filePath);
88557
88787
  if (isBun2) {
88558
88788
  res.pipe(readStream);
88559
88789
  } else {
@@ -88682,10 +88912,10 @@ app.route({
88682
88912
  try {
88683
88913
  const encoding = ctx.args.encoding || "utf-8";
88684
88914
  if (encoding === "utf-8") {
88685
- fs25.writeFileSync(filepath, content, "utf-8");
88915
+ fs26.writeFileSync(filepath, content, "utf-8");
88686
88916
  } else if (encoding === "base64") {
88687
88917
  const buffer = Buffer.from(content, "base64");
88688
- fs25.writeFileSync(filepath, buffer);
88918
+ fs26.writeFileSync(filepath, buffer);
88689
88919
  } else {
88690
88920
  ctx.throw("不支持的编码格式");
88691
88921
  }
@@ -88726,7 +88956,7 @@ app.route({
88726
88956
  ctx.throw("文件不存在");
88727
88957
  return;
88728
88958
  }
88729
- fs25.unlinkSync(filepath);
88959
+ fs26.unlinkSync(filepath);
88730
88960
  ctx.body = {
88731
88961
  success: true,
88732
88962
  message: "文件删除成功"
@@ -88765,7 +88995,7 @@ app.route({
88765
88995
  return;
88766
88996
  }
88767
88997
  if (base644) {
88768
- const buffer = fs25.readFileSync(filepath);
88998
+ const buffer = fs26.readFileSync(filepath);
88769
88999
  const base64Content = buffer.toString("base64");
88770
89000
  console.log("base64Content", dir, name);
88771
89001
  ctx.body = {
@@ -88783,8 +89013,8 @@ app.route({
88783
89013
 
88784
89014
  // packages/common/mark-local/note.ts
88785
89015
  import path25 from "node:path";
88786
- import fs26 from "node:fs";
88787
- var import_dayjs = __toESM(require_dayjs_min(), 1);
89016
+ import fs27 from "node:fs";
89017
+ var import_dayjs2 = __toESM(require_dayjs_min(), 1);
88788
89018
  var import_gray_matter2 = __toESM(require_gray_matter(), 1);
88789
89019
  app.route({
88790
89020
  path: "mark-local",
@@ -88861,10 +89091,10 @@ app.route({
88861
89091
  const markLocalManager2 = new MarkLocalManager({ root: dir });
88862
89092
  await markLocalManager2.mount();
88863
89093
  const config5 = markLocalManager2.getConfig();
88864
- const dirname2 = `${id || import_dayjs.default().format("YYYYMMDDHHmmss")}`;
89094
+ const dirname2 = `${id || import_dayjs2.default().format("YYYYMMDDHHmmss")}`;
88865
89095
  const dirpath = path25.resolve(config5.root, dirname2);
88866
89096
  if (!fileIsExist3(dirpath)) {
88867
- fs26.mkdirSync(dirpath, { recursive: true });
89097
+ fs27.mkdirSync(dirpath, { recursive: true });
88868
89098
  }
88869
89099
  const filepath = path25.resolve(config5.root, dirname2, "readme.md");
88870
89100
  const data = {
@@ -88873,7 +89103,7 @@ app.route({
88873
89103
  };
88874
89104
  const _matterContent = import_gray_matter2.default.stringify("", data);
88875
89105
  if (!fileIsExist3(filepath)) {
88876
- fs26.writeFileSync(filepath, _matterContent, "utf-8");
89106
+ fs27.writeFileSync(filepath, _matterContent, "utf-8");
88877
89107
  }
88878
89108
  ctx.body = {
88879
89109
  filepath
@@ -88904,15 +89134,15 @@ app.route({
88904
89134
  const statPath = path25.resolve(config5.root, "..", output || "dist", statHtml);
88905
89135
  if (clean) {
88906
89136
  try {
88907
- fs26.rmSync(distPath, { recursive: true, force: true });
89137
+ fs27.rmSync(distPath, { recursive: true, force: true });
88908
89138
  } catch (error98) {
88909
89139
  console.error(error98);
88910
89140
  }
88911
89141
  }
88912
89142
  if (!fileIsExist3(distPath)) {
88913
- fs26.mkdirSync(distPath, { recursive: true });
89143
+ fs27.mkdirSync(distPath, { recursive: true });
88914
89144
  }
88915
- fs26.cpSync(config5.root, distPath, { recursive: true });
89145
+ fs27.cpSync(config5.root, distPath, { recursive: true });
88916
89146
  const distManager = new MarkLocalManager({ root: distPath });
88917
89147
  await distManager.mount();
88918
89148
  const result = await distManager.build({ stat });
@@ -88944,7 +89174,7 @@ app.route({
88944
89174
  </body>
88945
89175
  </html>
88946
89176
  `;
88947
- fs26.writeFileSync(statPath, statHtmlContent, "utf-8");
89177
+ fs27.writeFileSync(statPath, statHtmlContent, "utf-8");
88948
89178
  }
88949
89179
  ctx.body = {
88950
89180
  distPath