@jixo/cli 0.23.4 → 0.23.6

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 (51) hide show
  1. package/assets/bundle/google-aistudio.node.js +2 -2
  2. package/bundle/index.js +665 -852
  3. package/dist/cli.d.ts +2 -0
  4. package/dist/cli.d.ts.map +1 -0
  5. package/dist/cli.js +83 -0
  6. package/dist/cli.js.map +1 -0
  7. package/dist/commands/daemon.d.ts +5 -0
  8. package/dist/commands/daemon.d.ts.map +1 -0
  9. package/dist/commands/daemon.js +20 -0
  10. package/dist/commands/daemon.js.map +1 -0
  11. package/dist/commands/doctor/config.d.ts +3 -0
  12. package/dist/commands/doctor/config.d.ts.map +1 -0
  13. package/dist/commands/doctor/config.js +17 -0
  14. package/dist/commands/doctor/config.js.map +1 -0
  15. package/dist/commands/doctor/doctor.d.ts +3 -0
  16. package/dist/commands/doctor/doctor.d.ts.map +1 -0
  17. package/dist/commands/doctor/doctor.js +158 -0
  18. package/dist/commands/doctor/doctor.js.map +1 -0
  19. package/dist/commands/doctor/doctor.test.d.ts +2 -0
  20. package/dist/commands/doctor/doctor.test.d.ts.map +1 -0
  21. package/dist/commands/doctor/doctor.test.js +14 -0
  22. package/dist/commands/doctor/doctor.test.js.map +1 -0
  23. package/dist/commands/doctor/index.d.ts +2 -0
  24. package/dist/commands/doctor/index.d.ts.map +1 -0
  25. package/dist/commands/doctor/index.js +8 -0
  26. package/dist/commands/doctor/index.js.map +1 -0
  27. package/dist/commands/doctor/types.d.ts +45 -0
  28. package/dist/commands/doctor/types.d.ts.map +1 -0
  29. package/dist/commands/doctor/types.js +3 -0
  30. package/dist/commands/doctor/types.js.map +1 -0
  31. package/dist/commands/google-aistudio.d.ts.map +1 -1
  32. package/dist/commands/google-aistudio.js +12 -3
  33. package/dist/commands/google-aistudio.js.map +1 -1
  34. package/dist/commands/init.d.ts +2 -0
  35. package/dist/commands/init.d.ts.map +1 -0
  36. package/dist/commands/init.js +40 -0
  37. package/dist/commands/init.js.map +1 -0
  38. package/dist/commands/tasks/run.d.ts +10 -0
  39. package/dist/commands/tasks/run.d.ts.map +1 -0
  40. package/dist/commands/tasks/run.js +44 -0
  41. package/dist/commands/tasks/run.js.map +1 -0
  42. package/dist/config.d.ts +15 -0
  43. package/dist/config.d.ts.map +1 -0
  44. package/dist/config.js +23 -0
  45. package/dist/config.js.map +1 -0
  46. package/dist/env.d.ts +6 -0
  47. package/dist/env.d.ts.map +1 -0
  48. package/dist/env.js +16 -0
  49. package/dist/env.js.map +1 -0
  50. package/dist/prompts.json +14 -2
  51. package/package.json +3 -3
package/bundle/index.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import { createRequire } from "node:module";
3
3
  import { URL as URL$1, fileURLToPath, pathToFileURL } from "node:url";
4
4
  import path, { dirname, join } from "node:path";
5
- import fs, { existsSync, mkdirSync, promises, readFileSync, readdirSync, realpathSync, statSync, watch, writeFileSync } from "node:fs";
5
+ import fs, { existsSync, mkdirSync, promises, readFileSync, readdirSync, realpathSync, statSync, watchFile, writeFileSync } from "node:fs";
6
6
  import assert3, { notStrictEqual, strictEqual } from "assert";
7
7
  import * as path$1 from "path";
8
8
  import path10, { basename, dirname as dirname$1, extname, join as join$1, normalize, relative, resolve } from "path";
@@ -13,7 +13,7 @@ import url2, { URL as URL$2, fileURLToPath as fileURLToPath$1, pathToFileURL as
13
13
  import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
14
14
  import process$1 from "node:process";
15
15
  import { execFile, spawn } from "node:child_process";
16
- import * as fs$2 from "fs/promises";
16
+ import * as fs$1 from "fs/promises";
17
17
  import fs2 from "fs/promises";
18
18
  import process2 from "process";
19
19
  import { spawn as spawn$1 } from "child_process";
@@ -23,7 +23,7 @@ import * as readline from "node:readline";
23
23
  import { promisify, stripVTControlCharacters } from "node:util";
24
24
  import { EventEmitter, on, once } from "node:events";
25
25
  import { finished } from "node:stream/promises";
26
- import fs$1, { copyFile, mkdir, rm, writeFile as writeFile$1 } from "node:fs/promises";
26
+ import fsPromises, { copyFile, mkdir, rm, writeFile as writeFile$1 } from "node:fs/promises";
27
27
  import { Buffer as Buffer$1 } from "node:buffer";
28
28
  import { builtinModules, createRequire as createRequire$1 } from "module";
29
29
  import v8 from "v8";
@@ -32,7 +32,7 @@ import { createHash } from "node:crypto";
32
32
 
33
33
  //#region rolldown:runtime
34
34
  var __create$1 = Object.create;
35
- var __defProp$4 = Object.defineProperty;
35
+ var __defProp$3 = Object.defineProperty;
36
36
  var __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor;
37
37
  var __getOwnPropNames$2 = Object.getOwnPropertyNames;
38
38
  var __getProtoOf$1 = Object.getPrototypeOf;
@@ -41,7 +41,7 @@ var __commonJS$2 = (cb, mod) => function() {
41
41
  return mod || (0, cb[__getOwnPropNames$2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
42
42
  };
43
43
  var __export$4 = (target, all$1) => {
44
- for (var name$1 in all$1) __defProp$4(target, name$1, {
44
+ for (var name$1 in all$1) __defProp$3(target, name$1, {
45
45
  get: all$1[name$1],
46
46
  enumerable: true
47
47
  });
@@ -49,14 +49,14 @@ var __export$4 = (target, all$1) => {
49
49
  var __copyProps$2 = (to, from, except, desc) => {
50
50
  if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames$2(from), i$2 = 0, n$1 = keys.length, key$1; i$2 < n$1; i$2++) {
51
51
  key$1 = keys[i$2];
52
- if (!__hasOwnProp$2.call(to, key$1) && key$1 !== except) __defProp$4(to, key$1, {
52
+ if (!__hasOwnProp$2.call(to, key$1) && key$1 !== except) __defProp$3(to, key$1, {
53
53
  get: ((k$1) => from[k$1]).bind(null, key$1),
54
54
  enumerable: !(desc = __getOwnPropDesc$2(from, key$1)) || desc.enumerable
55
55
  });
56
56
  }
57
57
  return to;
58
58
  };
59
- var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$2(isNodeMode || !mod || !mod.__esModule ? __defProp$4(target, "default", {
59
+ var __toESM$1 = (mod, isNodeMode, target) => (target = mod != null ? __create$1(__getProtoOf$1(mod)) : {}, __copyProps$2(isNodeMode || !mod || !mod.__esModule ? __defProp$3(target, "default", {
60
60
  value: mod,
61
61
  enumerable: true
62
62
  }) : target, mod));
@@ -1275,14 +1275,14 @@ var YargsParser = class {
1275
1275
  function applyEnvVars(argv$1, configOnly) {
1276
1276
  if (typeof envPrefix === "undefined") return;
1277
1277
  const prefix = typeof envPrefix === "string" ? envPrefix : "";
1278
- const env$2 = mixin.env();
1279
- Object.keys(env$2).forEach(function(envVar) {
1278
+ const env$1 = mixin.env();
1279
+ Object.keys(env$1).forEach(function(envVar) {
1280
1280
  if (prefix === "" || envVar.lastIndexOf(prefix, 0) === 0) {
1281
1281
  const keys = envVar.split("__").map(function(key$1, i$2) {
1282
1282
  if (i$2 === 0) key$1 = key$1.substring(prefix.length);
1283
1283
  return camelCase(key$1);
1284
1284
  });
1285
- if ((configOnly && flags.configs[keys.join(".")] || !configOnly) && !hasKey(argv$1, keys)) setArg(keys.join("."), env$2[envVar]);
1285
+ if ((configOnly && flags.configs[keys.join(".")] || !configOnly) && !hasKey(argv$1, keys)) setArg(keys.join("."), env$1[envVar]);
1286
1286
  }
1287
1287
  });
1288
1288
  }
@@ -1544,12 +1544,12 @@ if (nodeVersion) {
1544
1544
  const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
1545
1545
  if (major < minNodeVersion) throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
1546
1546
  }
1547
- const env$1 = process ? process.env : {};
1547
+ const env = process ? process.env : {};
1548
1548
  const require$3 = createRequire ? createRequire(import.meta.url) : void 0;
1549
1549
  const parser$1 = new YargsParser({
1550
1550
  cwd: process.cwd,
1551
1551
  env: () => {
1552
- return env$1;
1552
+ return env;
1553
1553
  },
1554
1554
  format,
1555
1555
  normalize,
@@ -1770,7 +1770,7 @@ var import_get_caller_file = __toESM$1(require_get_caller_file(), 1);
1770
1770
  const __dirname$1 = fileURLToPath$1(import.meta.url);
1771
1771
  const mainFilename = __dirname$1.substring(0, __dirname$1.lastIndexOf("node_modules"));
1772
1772
  const require$2 = createRequire(import.meta.url);
1773
- var esm_default$3 = {
1773
+ var esm_default$4 = {
1774
1774
  assert: {
1775
1775
  notStrictEqual,
1776
1776
  strictEqual
@@ -4682,13 +4682,13 @@ function isYargsInstance(y$2) {
4682
4682
 
4683
4683
  //#endregion
4684
4684
  //#region ../../node_modules/.pnpm/yargs@18.0.0/node_modules/yargs/index.mjs
4685
- const Yargs = YargsFactory(esm_default$3);
4685
+ const Yargs = YargsFactory(esm_default$4);
4686
4686
  var yargs_default = Yargs;
4687
4687
 
4688
4688
  //#endregion
4689
4689
  //#region package.json
4690
4690
  var name = "@jixo/cli";
4691
- var version$1 = "0.23.3";
4691
+ var version$1 = "0.23.6";
4692
4692
  var type = "module";
4693
4693
  var bin = { "jixo": "./bundle/index.js" };
4694
4694
  var files = [
@@ -4757,7 +4757,7 @@ var package_default = {
4757
4757
  };
4758
4758
 
4759
4759
  //#endregion
4760
- //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gaubee+node@0.4.0_@gaubee+util@0.34.2__@gaubee+util@0.34.2_@types+node@24.1.0/node_modules/@gaubee/nodekit/esm/_dnt.shims.js
4760
+ //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gau_ac796b2c5c73dab9bab91ba9e75b6834/node_modules/@gaubee/nodekit/esm/_dnt.shims.js
4761
4761
  const dntGlobals = {};
4762
4762
  const dntGlobalThis = createMergeProxy(globalThis, dntGlobals);
4763
4763
  function createMergeProxy(baseObj, extObj) {
@@ -4805,7 +4805,7 @@ function createMergeProxy(baseObj, extObj) {
4805
4805
  }
4806
4806
 
4807
4807
  //#endregion
4808
- //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gaubee+node@0.4.0_@gaubee+util@0.34.2__@gaubee+util@0.34.2_@types+node@24.1.0/node_modules/@gaubee/nodekit/esm/deps/jsr.io/@std/fmt/1.0.8/colors.js
4808
+ //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gau_ac796b2c5c73dab9bab91ba9e75b6834/node_modules/@gaubee/nodekit/esm/deps/jsr.io/@std/fmt/1.0.8/colors.js
4809
4809
  const { Deno } = dntGlobalThis;
4810
4810
  const noColor = typeof Deno?.noColor === "boolean" ? Deno.noColor : false;
4811
4811
  let enabled = !noColor;
@@ -5084,10 +5084,33 @@ const createAcontext = (name$1, default_fn) => {
5084
5084
  };
5085
5085
  return handle;
5086
5086
  };
5087
+ const useAcontexts = (ctxs) => {
5088
+ return (values, run$1) => {
5089
+ const runner = async (index$1) => {
5090
+ if (index$1 >= ctxs.length) return run$1();
5091
+ const context = ctxs[index$1];
5092
+ const value = values[index$1];
5093
+ return context.run(value, () => runner(index$1 + 1));
5094
+ };
5095
+ return runner(0);
5096
+ };
5097
+ };
5087
5098
 
5088
5099
  //#endregion
5089
5100
  //#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/map.js
5090
5101
  /**
5102
+ * 读取一个map中的值,如果没有,就创建它
5103
+ */
5104
+ const map_get_or_put = (map$1, key$1, put) => {
5105
+ let value;
5106
+ if (map$1.has(key$1)) value = map$1.get(key$1);
5107
+ else {
5108
+ value = put(key$1, map$1);
5109
+ map$1.set(key$1, value);
5110
+ }
5111
+ return value;
5112
+ };
5113
+ /**
5091
5114
  * 读取一个map中的值,如果没有,就异步地创建它
5092
5115
  * 使用该函数进行异步创建是会互斥上锁的(如果外部修改了map,写入了值,那么最终会以外部修改为准)
5093
5116
  */
@@ -5113,6 +5136,22 @@ const map_get_or_put_async = async (map$1, key$1, put) => {
5113
5136
  };
5114
5137
  const locks_keys = /* @__PURE__ */ Symbol.for("map_get_or_put_async-locks");
5115
5138
 
5139
+ //#endregion
5140
+ //#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/event_target.js
5141
+ /**
5142
+ * 一个更加易用的 eventTarget.addEventListener 附加监听函数,返回一个 off 函数,用于 removeEventListener 移除监听
5143
+ * @example
5144
+ * ```ts
5145
+ * event_target_on(abort_signal, 'abort', ()=>{})
5146
+ * ```
5147
+ */
5148
+ const event_target_on = (target, type$1, handler, options$1) => {
5149
+ target.addEventListener(type$1, handler, options$1);
5150
+ return () => {
5151
+ target.removeEventListener(type$1, handler);
5152
+ };
5153
+ };
5154
+
5116
5155
  //#endregion
5117
5156
  //#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/object.js
5118
5157
  /**
@@ -5460,9 +5499,9 @@ var PureEvent = class {
5460
5499
  };
5461
5500
  const pureEvent = () => {
5462
5501
  const pe = new PureEvent();
5463
- const watch$1 = pe.watch;
5464
- Object.setPrototypeOf(watch$1, pe);
5465
- return watch$1;
5502
+ const watch = pe.watch;
5503
+ Object.setPrototypeOf(watch, pe);
5504
+ return watch;
5466
5505
  };
5467
5506
  /**
5468
5507
  * PureEvent 的委托类,基于委托,可以实现更新委托内核
@@ -5552,6 +5591,22 @@ const func_remember = /* @__NO_SIDE_EFFECTS__ */ (func, key$1) => {
5552
5591
  });
5553
5592
  return once_fn_mix;
5554
5593
  };
5594
+ /**
5595
+ * 包裹一个“目标函数”,将它的执行权交给“包裹函数”。
5596
+ * 包裹函数可以在目标函数执行之前或者执行之后做一些工作,比如参数检查,比如返回值修改
5597
+ * @param func 目标函数
5598
+ * @param wrapper 包裹函数,第一个参数是 context,可以获得详细的上下文;第二个参数是 next,可以用于快速执行“目标函数”
5599
+ */
5600
+ const func_wrap = /* @__NO_SIDE_EFFECTS__ */ (func, wrapper) => {
5601
+ return function(...args) {
5602
+ const context = {
5603
+ target: func,
5604
+ this: this,
5605
+ arguments: args
5606
+ };
5607
+ return wrapper(context, () => Reflect.apply(func, context.this, context.arguments));
5608
+ };
5609
+ };
5555
5610
  const wrapSuccess = (result) => {
5556
5611
  return Object.defineProperties([void 0, result], {
5557
5612
  success: {
@@ -5696,6 +5751,54 @@ const timmers = {
5696
5751
  return typeof ms === "number" ? ms <= 0 ? timmers.microtask : timmers.timeout(ms) : ms;
5697
5752
  }
5698
5753
  };
5754
+ /**
5755
+ * setTimeout/clearTimeout 的 promise 版本
5756
+ * @example
5757
+ * ```ts
5758
+ * const d = delay(1000)
5759
+ *
5760
+ * await d; // is promise
5761
+ *
5762
+ * d.cancel(); // clearTimeout
5763
+ *
5764
+ * d.cancel('some reason'); // clearTimeout and reject promise
5765
+ *
5766
+ * const ac = new AbortController()
5767
+ * const d = delay(1000, { signal: ac.signal }) // with AbortSignal
5768
+ * ac.abort('some reason'); // clearTimeout and reject promise
5769
+ * ```
5770
+ *
5771
+ * 如果 ms = 0,那么会使用 queueMicrotask 而不是setTimeot,当然cancel仍然是可以工作的
5772
+ */
5773
+ const delay = (ms, options$1) => {
5774
+ const signal = options$1?.signal;
5775
+ signal?.throwIfAborted();
5776
+ const job = Promise.withResolvers();
5777
+ let resolve$1 = job.resolve;
5778
+ let reject = job.reject;
5779
+ const timmer = timmers.from(ms);
5780
+ const clear = timmer(resolve$1, reject);
5781
+ const result = Object.assign(job.promise, { cancel(cause) {
5782
+ clear();
5783
+ reject(cause);
5784
+ } });
5785
+ if (signal != null) {
5786
+ const off = event_target_on(signal, "abort", () => {
5787
+ result.cancel(signal.reason);
5788
+ }, { once: true });
5789
+ resolve$1 = func_wrap(resolve$1, (_$1, next) => {
5790
+ off();
5791
+ next();
5792
+ });
5793
+ reject = func_wrap(reject, (_$1, next) => {
5794
+ off();
5795
+ next();
5796
+ });
5797
+ }
5798
+ const disposer = options$1?.disposer;
5799
+ if (disposer != null) disposer.watch(result.cancel);
5800
+ return result;
5801
+ };
5699
5802
  const promise_try = async (fn) => {
5700
5803
  try {
5701
5804
  const value = await fn();
@@ -5710,6 +5813,120 @@ const promise_try = async (fn) => {
5710
5813
  };
5711
5814
  }
5712
5815
  };
5816
+ const _pot = /* @__PURE__ */ new WeakMap();
5817
+ /**
5818
+ * 一个内存安全的、只专注于执行回调 promise then 方法。
5819
+ * 因为 promise.then 是会创建一个新的 promise 的,在某些场景下,这会带来严重的内存问题,比如说,如果你将一个 promise 作为一个锁
5820
+ * 而如果你只是想进行回调注册,使用这个方法。
5821
+ *
5822
+ * @param promise
5823
+ * @param onfulfilled
5824
+ * @param onrejected
5825
+ * @returns
5826
+ */
5827
+ const promise_once_then = (promise$2, task) => {
5828
+ const state = map_get_or_put(_pot, promise$2, () => {
5829
+ const pending_state = {
5830
+ state: "pending",
5831
+ tasks: /* @__PURE__ */ new Map()
5832
+ };
5833
+ promise$2.then((value) => {
5834
+ _pot.set(promise$2, {
5835
+ state: "resolved",
5836
+ value
5837
+ });
5838
+ _promise_once_then_onfulfilled(value, pending_state.tasks.values());
5839
+ }, (err) => {
5840
+ _pot.set(promise$2, {
5841
+ state: "rejected",
5842
+ err
5843
+ });
5844
+ _promise_once_then_onrejected(err, pending_state.tasks.values());
5845
+ });
5846
+ return pending_state;
5847
+ });
5848
+ if (state.state === "pending") {
5849
+ state.tasks.set(task.key ?? task.resolve ?? task.reject, task);
5850
+ return () => promise_once_then_cancel(promise$2, task);
5851
+ } else if (state.state === "resolved") _promise_once_then_onfulfilled(state.value, [task]);
5852
+ else if (state.state === "rejected") _promise_once_then_onrejected(state.err, [task]);
5853
+ return () => {};
5854
+ };
5855
+ const promise_once_then_cancel = (promise$2, task) => {
5856
+ const state = _pot.get(promise$2);
5857
+ if (state?.state === "pending") state.tasks.delete(task.key ?? task.resolve ?? task.reject);
5858
+ };
5859
+ const _promise_once_then_onfulfilled = (value, tasks) => {
5860
+ for (const task of tasks) {
5861
+ if (task.resolve == null) continue;
5862
+ try {
5863
+ const res = task.resolve(value);
5864
+ if (isPromiseLike(res) && task.reject) res.then(null, task.reject);
5865
+ } catch (err) {
5866
+ task.reject?.(err, value);
5867
+ }
5868
+ }
5869
+ };
5870
+ const _promise_once_then_onrejected = (err, tasks) => {
5871
+ for (const task of tasks) {
5872
+ if (task.reject == null) continue;
5873
+ task.reject(err);
5874
+ }
5875
+ };
5876
+ const promise_safe_race = (values, options$1 = {}) => {
5877
+ const promises$1 = Array.isArray(values) ? values : [];
5878
+ for (const item of values) {
5879
+ if (!isPromiseLike(item)) return item;
5880
+ if (promises$1 !== values) promises$1.push(item);
5881
+ }
5882
+ const { promise: promise$2, resolve: resolve$1, reject } = Promise.withResolvers();
5883
+ const registeredTasks = /* @__PURE__ */ new Map();
5884
+ let settled = false;
5885
+ const cleanup = () => {
5886
+ settled = true;
5887
+ for (const cancel of registeredTasks.values()) cancel();
5888
+ registeredTasks.clear();
5889
+ };
5890
+ const settle = (result, isError$1) => {
5891
+ if (settled) return;
5892
+ cleanup();
5893
+ isError$1 ? reject(result) : resolve$1(result);
5894
+ };
5895
+ for (const value of promises$1) {
5896
+ if (settled) break;
5897
+ registeredTasks.set(value, promise_once_then(value, {
5898
+ resolve: (val) => settle(val, false),
5899
+ reject: (err) => settle(err, true)
5900
+ }));
5901
+ }
5902
+ if (!settled && registeredTasks.size === 0) {
5903
+ const { ifEmpty = () => {
5904
+ reject(/* @__PURE__ */ new TypeError("Argument is empty iterable"));
5905
+ return promise$2;
5906
+ } } = options$1;
5907
+ return ifEmpty();
5908
+ }
5909
+ return promise$2;
5910
+ };
5911
+
5912
+ //#endregion
5913
+ //#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/abort.js
5914
+ const signal_promise_cache = /* @__PURE__ */ new Map();
5915
+ const abort_signal_promisify = (input) => {
5916
+ const signal = input instanceof AbortSignal ? input : input.signal;
5917
+ return map_get_or_put(signal_promise_cache, signal, () => {
5918
+ const job = Promise.withResolvers();
5919
+ signal.addEventListener("abort", (reason) => {
5920
+ job.reject(reason);
5921
+ }, { once: true });
5922
+ return job.promise;
5923
+ });
5924
+ };
5925
+ const abort_signal_race = (signal, fn_or_promise) => {
5926
+ signal.throwIfAborted();
5927
+ fn_or_promise = typeof fn_or_promise === "function" ? fn_or_promise() : fn_or_promise;
5928
+ return promise_safe_race([abort_signal_promisify(signal), fn_or_promise]);
5929
+ };
5713
5930
 
5714
5931
  //#endregion
5715
5932
  //#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/debounce.js
@@ -5797,7 +6014,7 @@ const createResolverByRootFile = (fromPath = process$1.cwd(), rootFilename = "pa
5797
6014
  };
5798
6015
 
5799
6016
  //#endregion
5800
- //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gaubee+node@0.4.0_@gaubee+util@0.34.2__@gaubee+util@0.34.2_@types+node@24.1.0/node_modules/@gaubee/nodekit/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.js
6017
+ //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gau_ac796b2c5c73dab9bab91ba9e75b6834/node_modules/@gaubee/nodekit/esm/deps/jsr.io/@std/jsonc/1.0.2/parse.js
5801
6018
  /**
5802
6019
  * Converts a JSON with Comments (JSONC) string into an object.
5803
6020
  *
@@ -6023,7 +6240,7 @@ function buildErrorMessage({ type: type$1, sourceText, position: position$1 }) {
6023
6240
  }
6024
6241
 
6025
6242
  //#endregion
6026
- //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gaubee+node@0.4.0_@gaubee+util@0.34.2__@gaubee+util@0.34.2_@types+node@24.1.0/node_modules/@gaubee/nodekit/esm/config_file.js
6243
+ //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gau_ac796b2c5c73dab9bab91ba9e75b6834/node_modules/@gaubee/nodekit/esm/config_file.js
6027
6244
  /**
6028
6245
  * read json or jsonc file
6029
6246
  */
@@ -8759,7 +8976,7 @@ var require_parse$3 = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4.0.3
8759
8976
  //#endregion
8760
8977
  //#region ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js
8761
8978
  var require_gray_matter = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports, module) {
8762
- const fs$10 = __require$1("fs");
8979
+ const fs$9 = __require$1("fs");
8763
8980
  const sections = require_section_matter();
8764
8981
  const defaults = require_defaults();
8765
8982
  const stringify$4 = require_stringify$2();
@@ -8884,7 +9101,7 @@ var require_gray_matter = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4
8884
9101
  * @api public
8885
9102
  */
8886
9103
  matter$2.read = function(filepath, options$1) {
8887
- const str = fs$10.readFileSync(filepath, "utf8");
9104
+ const str = fs$9.readFileSync(filepath, "utf8");
8888
9105
  const file$1 = matter$2(str, options$1);
8889
9106
  file$1.path = filepath;
8890
9107
  return file$1;
@@ -8927,7 +9144,7 @@ var require_gray_matter = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4
8927
9144
  } });
8928
9145
 
8929
9146
  //#endregion
8930
- //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gaubee+node@0.4.0_@gaubee+util@0.34.2__@gaubee+util@0.34.2_@types+node@24.1.0/node_modules/@gaubee/nodekit/esm/markdown_file.js
9147
+ //#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gau_ac796b2c5c73dab9bab91ba9e75b6834/node_modules/@gaubee/nodekit/esm/markdown_file.js
8931
9148
  var import_gray_matter = __toESM$1(require_gray_matter(), 1);
8932
9149
 
8933
9150
  //#endregion
@@ -9178,6 +9395,7 @@ var require_ignore$1 = __commonJS$2({ "../../node_modules/.pnpm/ignore@7.0.5/nod
9178
9395
  const isUpKey = (key$1) => key$1.name === "up" || key$1.name === "k" || key$1.ctrl && key$1.name === "p";
9179
9396
  const isDownKey = (key$1) => key$1.name === "down" || key$1.name === "j" || key$1.ctrl && key$1.name === "n";
9180
9397
  const isSpaceKey = (key$1) => key$1.name === "space";
9398
+ const isBackspaceKey = (key$1) => key$1.name === "backspace";
9181
9399
  const isNumberKey = (key$1) => "1234567890".includes(key$1.name);
9182
9400
  const isEnterKey = (key$1) => key$1.name === "enter" || key$1.name === "return";
9183
9401
 
@@ -9288,8 +9506,8 @@ const effectScheduler = {
9288
9506
  run() {
9289
9507
  const store = getStore();
9290
9508
  withUpdates(() => {
9291
- store.hooksEffect.forEach((effect$1) => {
9292
- effect$1();
9509
+ store.hooksEffect.forEach((effect) => {
9510
+ effect();
9293
9511
  });
9294
9512
  store.hooksEffect.length = 0;
9295
9513
  })();
@@ -9335,8 +9553,8 @@ function useEffect(cb, depArray) {
9335
9553
  //#endregion
9336
9554
  //#region ../../node_modules/.pnpm/yoctocolors-cjs@2.1.2/node_modules/yoctocolors-cjs/index.js
9337
9555
  var require_yoctocolors_cjs = __commonJS$2({ "../../node_modules/.pnpm/yoctocolors-cjs@2.1.2/node_modules/yoctocolors-cjs/index.js"(exports, module) {
9338
- const tty$2 = __require$1("node:tty");
9339
- const hasColors = tty$2?.WriteStream?.prototype?.hasColors?.() ?? false;
9556
+ const tty$1 = __require$1("node:tty");
9557
+ const hasColors = tty$1?.WriteStream?.prototype?.hasColors?.() ?? false;
9340
9558
  const format$1 = (open, close) => {
9341
9559
  if (!hasColors) return (input) => input;
9342
9560
  const openCode = `\u001B[${open}m`;
@@ -9685,7 +9903,7 @@ const fallbackSymbols = {
9685
9903
  };
9686
9904
  const shouldUseMain = isUnicodeSupported();
9687
9905
  const figures = shouldUseMain ? mainSymbols : fallbackSymbols;
9688
- var esm_default$1 = figures;
9906
+ var esm_default$2 = figures;
9689
9907
  const replacements = Object.entries(specialMainSymbols);
9690
9908
 
9691
9909
  //#endregion
@@ -9694,7 +9912,7 @@ var import_yoctocolors_cjs$2 = __toESM$1(require_yoctocolors_cjs(), 1);
9694
9912
  const defaultTheme = {
9695
9913
  prefix: {
9696
9914
  idle: import_yoctocolors_cjs$2.default.blue("?"),
9697
- done: import_yoctocolors_cjs$2.default.green(esm_default$1.tick)
9915
+ done: import_yoctocolors_cjs$2.default.green(esm_default$2.tick)
9698
9916
  },
9699
9917
  spinner: {
9700
9918
  interval: 80,
@@ -12504,7 +12722,7 @@ var import_yoctocolors_cjs$1 = __toESM$1(require_yoctocolors_cjs(), 1);
12504
12722
  * Used to space/separate choices group
12505
12723
  */
12506
12724
  var Separator = class {
12507
- separator = import_yoctocolors_cjs$1.default.dim(Array.from({ length: 15 }).join(esm_default$1.line));
12725
+ separator = import_yoctocolors_cjs$1.default.dim(Array.from({ length: 15 }).join(esm_default$2.line));
12508
12726
  type = "separator";
12509
12727
  constructor(separator) {
12510
12728
  if (separator) this.separator = separator;
@@ -12520,9 +12738,9 @@ var import_yoctocolors_cjs = __toESM$1(require_yoctocolors_cjs(), 1);
12520
12738
  var import_ansi_escapes = __toESM$1(require_ansi_escapes(), 1);
12521
12739
  const checkboxTheme = {
12522
12740
  icon: {
12523
- checked: import_yoctocolors_cjs.default.green(esm_default$1.circleFilled),
12524
- unchecked: esm_default$1.circle,
12525
- cursor: esm_default$1.pointer
12741
+ checked: import_yoctocolors_cjs.default.green(esm_default$2.circleFilled),
12742
+ unchecked: esm_default$2.circle,
12743
+ cursor: esm_default$2.pointer
12526
12744
  },
12527
12745
  style: {
12528
12746
  disabledChoice: (text$2) => import_yoctocolors_cjs.default.dim(`- ${text$2}`),
@@ -12573,7 +12791,7 @@ function normalizeChoices(choices) {
12573
12791
  return normalizedChoice;
12574
12792
  });
12575
12793
  }
12576
- var esm_default$2 = createPrompt((config$1, done) => {
12794
+ var esm_default$3 = createPrompt((config$1, done) => {
12577
12795
  const { instructions, pageSize = 7, loop = true, required: required$1, validate: validate$1 = () => true } = config$1;
12578
12796
  const shortcuts = {
12579
12797
  all: "a",
@@ -12701,7 +12919,7 @@ function getBooleanValue(value, defaultValue) {
12701
12919
  function boolToString(value) {
12702
12920
  return value ? "Yes" : "No";
12703
12921
  }
12704
- var esm_default = createPrompt((config$1, done) => {
12922
+ var esm_default$1 = createPrompt((config$1, done) => {
12705
12923
  const { transformer = boolToString } = config$1;
12706
12924
  const [status, setStatus] = useState("idle");
12707
12925
  const [value, setValue] = useState("");
@@ -12731,6 +12949,69 @@ var esm_default = createPrompt((config$1, done) => {
12731
12949
  return `${prefix} ${message}${defaultValue} ${formattedValue}`;
12732
12950
  });
12733
12951
 
12952
+ //#endregion
12953
+ //#region ../../node_modules/.pnpm/@inquirer+input@4.2.1_@types+node@24.1.0/node_modules/@inquirer/input/dist/esm/index.js
12954
+ const inputTheme = { validationFailureMode: "keep" };
12955
+ var esm_default = createPrompt((config$1, done) => {
12956
+ const { required: required$1, validate: validate$1 = () => true, prefill = "tab" } = config$1;
12957
+ const theme = makeTheme(inputTheme, config$1.theme);
12958
+ const [status, setStatus] = useState("idle");
12959
+ const [defaultValue = "", setDefaultValue] = useState(config$1.default);
12960
+ const [errorMsg, setError] = useState();
12961
+ const [value, setValue] = useState("");
12962
+ const prefix = usePrefix({
12963
+ status,
12964
+ theme
12965
+ });
12966
+ useKeypress(async (key$1, rl) => {
12967
+ if (status !== "idle") return;
12968
+ if (isEnterKey(key$1)) {
12969
+ const answer = value || defaultValue;
12970
+ setStatus("loading");
12971
+ const isValid = required$1 && !answer ? "You must provide a value" : await validate$1(answer);
12972
+ if (isValid === true) {
12973
+ setValue(answer);
12974
+ setStatus("done");
12975
+ done(answer);
12976
+ } else {
12977
+ if (theme.validationFailureMode === "clear") setValue("");
12978
+ else rl.write(value);
12979
+ setError(isValid || "You must provide a valid value");
12980
+ setStatus("idle");
12981
+ }
12982
+ } else if (isBackspaceKey(key$1) && !value) setDefaultValue(void 0);
12983
+ else if (key$1.name === "tab" && !value) {
12984
+ setDefaultValue(void 0);
12985
+ rl.clearLine(0);
12986
+ rl.write(defaultValue);
12987
+ setValue(defaultValue);
12988
+ } else {
12989
+ setValue(rl.line);
12990
+ setError(void 0);
12991
+ }
12992
+ });
12993
+ useEffect((rl) => {
12994
+ if (prefill === "editable" && defaultValue) {
12995
+ rl.write(defaultValue);
12996
+ setValue(defaultValue);
12997
+ }
12998
+ }, []);
12999
+ const message = theme.style.message(config$1.message, status);
13000
+ let formattedValue = value;
13001
+ if (typeof config$1.transformer === "function") formattedValue = config$1.transformer(value, { isFinal: status === "done" });
13002
+ else if (status === "done") formattedValue = theme.style.answer(value);
13003
+ let defaultStr;
13004
+ if (defaultValue && status !== "done" && !value) defaultStr = theme.style.defaultAnswer(defaultValue);
13005
+ let error$41 = "";
13006
+ if (errorMsg) error$41 = theme.style.error(errorMsg);
13007
+ return [[
13008
+ prefix,
13009
+ message,
13010
+ defaultStr,
13011
+ formattedValue
13012
+ ].filter((v$1) => v$1 !== void 0).join(" "), error$41];
13013
+ });
13014
+
12734
13015
  //#endregion
12735
13016
  //#region ../../node_modules/.pnpm/@sindresorhus+merge-streams@2.3.0/node_modules/@sindresorhus/merge-streams/index.js
12736
13017
  function mergeStreams(streams) {
@@ -12942,9 +13223,9 @@ var require_fs$4 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/node
12942
13223
  var require_path$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/path.js"(exports) {
12943
13224
  Object.defineProperty(exports, "__esModule", { value: true });
12944
13225
  exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
12945
- const os$2 = __require$1("os");
13226
+ const os$1 = __require$1("os");
12946
13227
  const path$11 = __require$1("path");
12947
- const IS_WINDOWS_PLATFORM = os$2.platform() === "win32";
13228
+ const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
12948
13229
  const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
12949
13230
  /**
12950
13231
  * All non-escaped special characters.
@@ -16616,8 +16897,8 @@ var require_utils$2 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/n
16616
16897
  exports.array = array$3;
16617
16898
  const errno = require_errno$1();
16618
16899
  exports.errno = errno;
16619
- const fs$9 = require_fs$4();
16620
- exports.fs = fs$9;
16900
+ const fs$8 = require_fs$4();
16901
+ exports.fs = fs$8;
16621
16902
  const path$6 = require_path$1();
16622
16903
  exports.path = path$6;
16623
16904
  const pattern = require_pattern$1();
@@ -16789,12 +17070,12 @@ var require_sync$6 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.stat@2
16789
17070
  var require_fs$3 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/adapters/fs.js"(exports) {
16790
17071
  Object.defineProperty(exports, "__esModule", { value: true });
16791
17072
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
16792
- const fs$8 = __require$1("fs");
17073
+ const fs$7 = __require$1("fs");
16793
17074
  exports.FILE_SYSTEM_ADAPTER = {
16794
- lstat: fs$8.lstat,
16795
- stat: fs$8.stat,
16796
- lstatSync: fs$8.lstatSync,
16797
- statSync: fs$8.statSync
17075
+ lstat: fs$7.lstat,
17076
+ stat: fs$7.stat,
17077
+ lstatSync: fs$7.lstatSync,
17078
+ statSync: fs$7.statSync
16798
17079
  };
16799
17080
  function createFileSystemAdapter$1(fsMethods) {
16800
17081
  if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
@@ -16807,12 +17088,12 @@ var require_fs$3 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0
16807
17088
  //#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js
16808
17089
  var require_settings$4 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
16809
17090
  Object.defineProperty(exports, "__esModule", { value: true });
16810
- const fs$7 = require_fs$3();
17091
+ const fs$6 = require_fs$3();
16811
17092
  var Settings$3 = class {
16812
17093
  constructor(_options = {}) {
16813
17094
  this._options = _options;
16814
17095
  this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
16815
- this.fs = fs$7.createFileSystemAdapter(this._options.fs);
17096
+ this.fs = fs$6.createFileSystemAdapter(this._options.fs);
16816
17097
  this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
16817
17098
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
16818
17099
  }
@@ -16868,15 +17149,15 @@ var require_run_parallel$1 = __commonJS$2({ "../../node_modules/.pnpm/run-parall
16868
17149
  module.exports = runParallel;
16869
17150
  const queueMicrotask$1 = require_queue_microtask$1();
16870
17151
  function runParallel(tasks, cb) {
16871
- let results, pending$1, keys;
17152
+ let results, pending, keys;
16872
17153
  let isSync = true;
16873
17154
  if (Array.isArray(tasks)) {
16874
17155
  results = [];
16875
- pending$1 = tasks.length;
17156
+ pending = tasks.length;
16876
17157
  } else {
16877
17158
  keys = Object.keys(tasks);
16878
17159
  results = {};
16879
- pending$1 = keys.length;
17160
+ pending = keys.length;
16880
17161
  }
16881
17162
  function done(err) {
16882
17163
  function end() {
@@ -16888,9 +17169,9 @@ var require_run_parallel$1 = __commonJS$2({ "../../node_modules/.pnpm/run-parall
16888
17169
  }
16889
17170
  function each(i$2, err, result) {
16890
17171
  results[i$2] = result;
16891
- if (--pending$1 === 0 || err) done(err);
17172
+ if (--pending === 0 || err) done(err);
16892
17173
  }
16893
- if (!pending$1) done(null);
17174
+ if (!pending) done(null);
16894
17175
  else if (keys) keys.forEach(function(key$1) {
16895
17176
  tasks[key$1](function(err, result) {
16896
17177
  each(key$1, err, result);
@@ -16952,8 +17233,8 @@ var require_fs$2 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.scandir@
16952
17233
  var require_utils$1 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/utils/index.js"(exports) {
16953
17234
  Object.defineProperty(exports, "__esModule", { value: true });
16954
17235
  exports.fs = void 0;
16955
- const fs$6 = require_fs$2();
16956
- exports.fs = fs$6;
17236
+ const fs$5 = require_fs$2();
17237
+ exports.fs = fs$5;
16957
17238
  } });
16958
17239
 
16959
17240
  //#endregion
@@ -17131,14 +17412,14 @@ var require_sync$5 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.scandi
17131
17412
  var require_fs$1 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.scandir@2.1.5/node_modules/@nodelib/fs.scandir/out/adapters/fs.js"(exports) {
17132
17413
  Object.defineProperty(exports, "__esModule", { value: true });
17133
17414
  exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
17134
- const fs$5 = __require$1("fs");
17415
+ const fs$4 = __require$1("fs");
17135
17416
  exports.FILE_SYSTEM_ADAPTER = {
17136
- lstat: fs$5.lstat,
17137
- stat: fs$5.stat,
17138
- lstatSync: fs$5.lstatSync,
17139
- statSync: fs$5.statSync,
17140
- readdir: fs$5.readdir,
17141
- readdirSync: fs$5.readdirSync
17417
+ lstat: fs$4.lstat,
17418
+ stat: fs$4.stat,
17419
+ lstatSync: fs$4.lstatSync,
17420
+ statSync: fs$4.statSync,
17421
+ readdir: fs$4.readdir,
17422
+ readdirSync: fs$4.readdirSync
17142
17423
  };
17143
17424
  function createFileSystemAdapter(fsMethods) {
17144
17425
  if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
@@ -17153,12 +17434,12 @@ var require_settings$3 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.sc
17153
17434
  Object.defineProperty(exports, "__esModule", { value: true });
17154
17435
  const path$5 = __require$1("path");
17155
17436
  const fsStat$3 = require_out$4();
17156
- const fs$4 = require_fs$1();
17437
+ const fs$3 = require_fs$1();
17157
17438
  var Settings$2 = class {
17158
17439
  constructor(_options = {}) {
17159
17440
  this._options = _options;
17160
17441
  this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
17161
- this.fs = fs$4.createFileSystemAdapter(this._options.fs);
17442
+ this.fs = fs$3.createFileSystemAdapter(this._options.fs);
17162
17443
  this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$5.sep);
17163
17444
  this.stats = this._getValue(this._options.stats, false);
17164
17445
  this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
@@ -18351,20 +18632,20 @@ var require_sync$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/no
18351
18632
  var require_settings$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/settings.js"(exports) {
18352
18633
  Object.defineProperty(exports, "__esModule", { value: true });
18353
18634
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
18354
- const fs$3 = __require$1("fs");
18355
- const os$1 = __require$1("os");
18635
+ const fs$2 = __require$1("fs");
18636
+ const os = __require$1("os");
18356
18637
  /**
18357
18638
  * The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
18358
18639
  * https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
18359
18640
  */
18360
- const CPU_COUNT = Math.max(os$1.cpus().length, 1);
18641
+ const CPU_COUNT = Math.max(os.cpus().length, 1);
18361
18642
  exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
18362
- lstat: fs$3.lstat,
18363
- lstatSync: fs$3.lstatSync,
18364
- stat: fs$3.stat,
18365
- statSync: fs$3.statSync,
18366
- readdir: fs$3.readdir,
18367
- readdirSync: fs$3.readdirSync
18643
+ lstat: fs$2.lstat,
18644
+ lstatSync: fs$2.lstatSync,
18645
+ stat: fs$2.stat,
18646
+ statSync: fs$2.statSync,
18647
+ readdir: fs$2.readdir,
18648
+ readdirSync: fs$2.readdirSync
18368
18649
  };
18369
18650
  var Settings = class {
18370
18651
  constructor(_options = {}) {
@@ -18511,7 +18792,7 @@ var require_out$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/nod
18511
18792
  async function isType(fsStatType, statsMethodName, filePath) {
18512
18793
  if (typeof filePath !== "string") throw new TypeError(`Expected a string, got ${typeof filePath}`);
18513
18794
  try {
18514
- const stats = await fs$1[fsStatType](filePath);
18795
+ const stats = await fsPromises[fsStatType](filePath);
18515
18796
  return stats[statsMethodName]();
18516
18797
  } catch (error$41) {
18517
18798
  if (error$41.code === "ENOENT") return false;
@@ -18608,7 +18889,7 @@ const isIgnoredByIgnoreFiles = async (patterns, options$1) => {
18608
18889
  });
18609
18890
  const files$1 = await Promise.all(paths.map(async (filePath) => ({
18610
18891
  filePath,
18611
- content: await fs$1.readFile(filePath, "utf8")
18892
+ content: await fsPromises.readFile(filePath, "utf8")
18612
18893
  })));
18613
18894
  return getIsIgnoredPredicate(files$1, cwd);
18614
18895
  };
@@ -18913,7 +19194,7 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
18913
19194
  * This is the common logic for both the Node.js and web browser
18914
19195
  * implementations of `debug()`.
18915
19196
  */
18916
- function setup(env$2) {
19197
+ function setup(env$1) {
18917
19198
  createDebug.debug = createDebug;
18918
19199
  createDebug.default = createDebug;
18919
19200
  createDebug.coerce = coerce;
@@ -18922,8 +19203,8 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
18922
19203
  createDebug.enabled = enabled$1;
18923
19204
  createDebug.humanize = require_ms();
18924
19205
  createDebug.destroy = destroy;
18925
- Object.keys(env$2).forEach((key$1) => {
18926
- createDebug[key$1] = env$2[key$1];
19206
+ Object.keys(env$1).forEach((key$1) => {
19207
+ createDebug[key$1] = env$1[key$1];
18927
19208
  });
18928
19209
  /**
18929
19210
  * The currently active debug mode names, and names to skip.
@@ -18963,9 +19244,9 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
18963
19244
  let enableOverride = null;
18964
19245
  let namespacesCache;
18965
19246
  let enabledCache;
18966
- function debug$2(...args) {
18967
- if (!debug$2.enabled) return;
18968
- const self = debug$2;
19247
+ function debug$5(...args) {
19248
+ if (!debug$5.enabled) return;
19249
+ const self = debug$5;
18969
19250
  const curr = Number(/* @__PURE__ */ new Date());
18970
19251
  const ms = curr - (prevTime || curr);
18971
19252
  self.diff = ms;
@@ -18991,12 +19272,12 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
18991
19272
  const logFn = self.log || createDebug.log;
18992
19273
  logFn.apply(self, args);
18993
19274
  }
18994
- debug$2.namespace = namespace;
18995
- debug$2.useColors = createDebug.useColors();
18996
- debug$2.color = createDebug.selectColor(namespace);
18997
- debug$2.extend = extend$3;
18998
- debug$2.destroy = createDebug.destroy;
18999
- Object.defineProperty(debug$2, "enabled", {
19275
+ debug$5.namespace = namespace;
19276
+ debug$5.useColors = createDebug.useColors();
19277
+ debug$5.color = createDebug.selectColor(namespace);
19278
+ debug$5.extend = extend$3;
19279
+ debug$5.destroy = createDebug.destroy;
19280
+ Object.defineProperty(debug$5, "enabled", {
19000
19281
  enumerable: true,
19001
19282
  configurable: false,
19002
19283
  get: () => {
@@ -19011,8 +19292,8 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
19011
19292
  enableOverride = v$1;
19012
19293
  }
19013
19294
  });
19014
- if (typeof createDebug.init === "function") createDebug.init(debug$2);
19015
- return debug$2;
19295
+ if (typeof createDebug.init === "function") createDebug.init(debug$5);
19296
+ return debug$5;
19016
19297
  }
19017
19298
  function extend$3(namespace, delimiter) {
19018
19299
  const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
@@ -19308,87 +19589,6 @@ var require_browser = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node_
19308
19589
  };
19309
19590
  } });
19310
19591
 
19311
- //#endregion
19312
- //#region ../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
19313
- var require_has_flag = __commonJS$2({ "../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module) {
19314
- module.exports = (flag, argv = process.argv) => {
19315
- const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
19316
- const position$1 = argv.indexOf(prefix + flag);
19317
- const terminatorPosition = argv.indexOf("--");
19318
- return position$1 !== -1 && (terminatorPosition === -1 || position$1 < terminatorPosition);
19319
- };
19320
- } });
19321
-
19322
- //#endregion
19323
- //#region ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
19324
- var require_supports_color = __commonJS$2({ "../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
19325
- const os = __require$1("os");
19326
- const tty$1 = __require$1("tty");
19327
- const hasFlag = require_has_flag();
19328
- const { env } = process;
19329
- let forceColor;
19330
- if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
19331
- else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
19332
- if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
19333
- else if (env.FORCE_COLOR === "false") forceColor = 0;
19334
- else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
19335
- function translateLevel(level) {
19336
- if (level === 0) return false;
19337
- return {
19338
- level,
19339
- hasBasic: true,
19340
- has256: level >= 2,
19341
- has16m: level >= 3
19342
- };
19343
- }
19344
- function supportsColor(haveStream, streamIsTTY) {
19345
- if (forceColor === 0) return 0;
19346
- if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
19347
- if (hasFlag("color=256")) return 2;
19348
- if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
19349
- const min = forceColor || 0;
19350
- if (env.TERM === "dumb") return min;
19351
- if (process.platform === "win32") {
19352
- const osRelease = os.release().split(".");
19353
- if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
19354
- return 1;
19355
- }
19356
- if ("CI" in env) {
19357
- if ([
19358
- "TRAVIS",
19359
- "CIRCLECI",
19360
- "APPVEYOR",
19361
- "GITLAB_CI",
19362
- "GITHUB_ACTIONS",
19363
- "BUILDKITE"
19364
- ].some((sign$1) => sign$1 in env) || env.CI_NAME === "codeship") return 1;
19365
- return min;
19366
- }
19367
- if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
19368
- if (env.COLORTERM === "truecolor") return 3;
19369
- if ("TERM_PROGRAM" in env) {
19370
- const version$2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
19371
- switch (env.TERM_PROGRAM) {
19372
- case "iTerm.app": return version$2 >= 3 ? 3 : 2;
19373
- case "Apple_Terminal": return 2;
19374
- }
19375
- }
19376
- if (/-256(color)?$/i.test(env.TERM)) return 2;
19377
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
19378
- if ("COLORTERM" in env) return 1;
19379
- return min;
19380
- }
19381
- function getSupportLevel(stream$1) {
19382
- const level = supportsColor(stream$1, stream$1 && stream$1.isTTY);
19383
- return translateLevel(level);
19384
- }
19385
- module.exports = {
19386
- supportsColor: getSupportLevel,
19387
- stdout: translateLevel(supportsColor(true, tty$1.isatty(1))),
19388
- stderr: translateLevel(supportsColor(true, tty$1.isatty(2)))
19389
- };
19390
- } });
19391
-
19392
19592
  //#endregion
19393
19593
  //#region ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js
19394
19594
  var require_node = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js"(exports, module) {
@@ -19419,8 +19619,8 @@ var require_node = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node_mod
19419
19619
  1
19420
19620
  ];
19421
19621
  try {
19422
- const supportsColor$1 = require_supports_color();
19423
- if (supportsColor$1 && (supportsColor$1.stderr || supportsColor$1).level >= 2) exports.colors = [
19622
+ const supportsColor = __require$1("supports-color");
19623
+ if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
19424
19624
  20,
19425
19625
  21,
19426
19626
  26,
@@ -19574,10 +19774,10 @@ var require_node = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node_mod
19574
19774
  * Create a new `inspectOpts` object in case `useColors` is set
19575
19775
  * differently for a particular `debug` instance.
19576
19776
  */
19577
- function init(debug$2) {
19578
- debug$2.inspectOpts = {};
19777
+ function init(debug$5) {
19778
+ debug$5.inspectOpts = {};
19579
19779
  const keys = Object.keys(exports.inspectOpts);
19580
- for (let i$2 = 0; i$2 < keys.length; i$2++) debug$2.inspectOpts[keys[i$2]] = exports.inspectOpts[keys[i$2]];
19780
+ for (let i$2 = 0; i$2 < keys.length; i$2++) debug$5.inspectOpts[keys[i$2]] = exports.inspectOpts[keys[i$2]];
19581
19781
  }
19582
19782
  module.exports = require_common$1()(exports);
19583
19783
  const { formatters } = module.exports;
@@ -19740,10 +19940,10 @@ var require_dist = __commonJS$2({ "../../node_modules/.pnpm/@kwsites+promise-def
19740
19940
  //#endregion
19741
19941
  //#region ../../node_modules/.pnpm/simple-git@3.28.0/node_modules/simple-git/dist/esm/index.js
19742
19942
  var import_dist = __toESM$1(require_dist$1(), 1);
19743
- var import_src$1 = __toESM$1(require_src$2(), 1);
19943
+ var import_src$4 = __toESM$1(require_src$2(), 1);
19744
19944
  var import_dist$1 = __toESM$1(require_dist(), 1);
19745
19945
  var import_dist$2 = __toESM$1(require_dist(), 1);
19746
- var __defProp$3 = Object.defineProperty;
19946
+ var __defProp$2 = Object.defineProperty;
19747
19947
  var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
19748
19948
  var __getOwnPropNames$1 = Object.getOwnPropertyNames;
19749
19949
  var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
@@ -19754,21 +19954,21 @@ var __commonJS$1 = (cb, mod) => function __require$2() {
19754
19954
  return mod || (0, cb[__getOwnPropNames$1(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
19755
19955
  };
19756
19956
  var __export$2 = (target, all$1) => {
19757
- for (var name$1 in all$1) __defProp$3(target, name$1, {
19957
+ for (var name$1 in all$1) __defProp$2(target, name$1, {
19758
19958
  get: all$1[name$1],
19759
19959
  enumerable: true
19760
19960
  });
19761
19961
  };
19762
19962
  var __copyProps$1 = (to, from, except, desc) => {
19763
19963
  if (from && typeof from === "object" || typeof from === "function") {
19764
- for (let key$1 of __getOwnPropNames$1(from)) if (!__hasOwnProp$1.call(to, key$1) && key$1 !== except) __defProp$3(to, key$1, {
19964
+ for (let key$1 of __getOwnPropNames$1(from)) if (!__hasOwnProp$1.call(to, key$1) && key$1 !== except) __defProp$2(to, key$1, {
19765
19965
  get: () => from[key$1],
19766
19966
  enumerable: !(desc = __getOwnPropDesc$1(from, key$1)) || desc.enumerable
19767
19967
  });
19768
19968
  }
19769
19969
  return to;
19770
19970
  };
19771
- var __toCommonJS = (mod) => __copyProps$1(__defProp$3({}, "__esModule", { value: true }), mod);
19971
+ var __toCommonJS = (mod) => __copyProps$1(__defProp$2({}, "__esModule", { value: true }), mod);
19772
19972
  function pathspec(...paths) {
19773
19973
  const key$1 = new String(paths);
19774
19974
  cache$1.set(key$1, paths);
@@ -19895,7 +20095,7 @@ function bufferToString(input) {
19895
20095
  function pick$1(source$1, properties) {
19896
20096
  return Object.assign({}, ...properties.map((property) => property in source$1 ? { [property]: source$1[property] } : {}));
19897
20097
  }
19898
- function delay(duration$2 = 0) {
20098
+ function delay$1(duration$2 = 0) {
19899
20099
  return new Promise((done) => setTimeout(done, duration$2));
19900
20100
  }
19901
20101
  function orVoid(input) {
@@ -20104,7 +20304,7 @@ __export$2(utils_exports, {
20104
20304
  bufferToString: () => bufferToString,
20105
20305
  callTaskParser: () => callTaskParser,
20106
20306
  createInstanceConfig: () => createInstanceConfig,
20107
- delay: () => delay,
20307
+ delay: () => delay$1,
20108
20308
  filterArray: () => filterArray,
20109
20309
  filterFunction: () => filterFunction,
20110
20310
  filterHasLength: () => filterHasLength,
@@ -20647,7 +20847,7 @@ var init_reset = __esm({ "src/lib/tasks/reset.ts"() {
20647
20847
  ResetModes = Array.from(Object.values(ResetMode));
20648
20848
  } });
20649
20849
  function createLog() {
20650
- return (0, import_src$1.default)("simple-git");
20850
+ return (0, import_src$4.default)("simple-git");
20651
20851
  }
20652
20852
  function prefixedLogger(to, prefix, forward) {
20653
20853
  if (!prefix || !String(prefix).replace(/\s*/, "")) return !forward ? to : (message, ...args) => {
@@ -20689,8 +20889,8 @@ function createLogger(label$1, verbose, initialStep, infoDebugger = createLog())
20689
20889
  var init_git_logger = __esm({ "src/lib/git-logger.ts"() {
20690
20890
  "use strict";
20691
20891
  init_utils();
20692
- import_src$1.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
20693
- import_src$1.default.formatters.B = (value) => {
20892
+ import_src$4.default.formatters.L = (value) => String(filterHasLength(value) ? value.length : "-");
20893
+ import_src$4.default.formatters.B = (value) => {
20694
20894
  if (Buffer.isBuffer(value)) return value.toString("utf8");
20695
20895
  return objectToString(value);
20696
20896
  };
@@ -23082,7 +23282,7 @@ function completionDetectionPlugin({ onClose = true, onExit: onExit$1 = 50 } = {
23082
23282
  }
23083
23283
  function configureTimeout(flag, event, timeout) {
23084
23284
  if (flag === false) return;
23085
- (flag === true ? event.promise : event.promise.then(() => delay(flag))).then(timeout.done);
23285
+ (flag === true ? event.promise : event.promise.then(() => delay$1(flag))).then(timeout.done);
23086
23286
  }
23087
23287
  return {
23088
23288
  type: "spawn.after",
@@ -23097,7 +23297,7 @@ function completionDetectionPlugin({ onClose = true, onExit: onExit$1 = 50 } = {
23097
23297
  spawned.on("exit", (code$1) => events.exit(code$1));
23098
23298
  try {
23099
23299
  await events.result;
23100
- if (deferClose) await delay(50);
23300
+ if (deferClose) await delay$1(50);
23101
23301
  close(events.exitCode);
23102
23302
  } catch (err) {
23103
23303
  close(events.exitCode, err);
@@ -23335,9 +23535,9 @@ __export$4(doc_exports, {
23335
23535
  printer: () => printer,
23336
23536
  utils: () => utils
23337
23537
  });
23338
- var __defProp$2 = Object.defineProperty;
23538
+ var __defProp$1 = Object.defineProperty;
23339
23539
  var __export$1 = (target, all$1) => {
23340
- for (var name$1 in all$1) __defProp$2(target, name$1, {
23540
+ for (var name$1 in all$1) __defProp$1(target, name$1, {
23341
23541
  get: all$1[name$1],
23342
23542
  enumerable: true
23343
23543
  });
@@ -24338,7 +24538,7 @@ const require$1 = createRequire$1(import.meta.url);
24338
24538
  const __filename = fileURLToPath$1(import.meta.url);
24339
24539
  const __dirname = dirname$1(__filename);
24340
24540
  var __create = Object.create;
24341
- var __defProp$1 = Object.defineProperty;
24541
+ var __defProp = Object.defineProperty;
24342
24542
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
24343
24543
  var __getOwnPropNames = Object.getOwnPropertyNames;
24344
24544
  var __getProtoOf = Object.getPrototypeOf;
@@ -24346,7 +24546,7 @@ var __hasOwnProp = Object.prototype.hasOwnProperty;
24346
24546
  var __typeError = (msg) => {
24347
24547
  throw TypeError(msg);
24348
24548
  };
24349
- var __defNormalProp$1 = (obj, key2, value) => key2 in obj ? __defProp$1(obj, key2, {
24549
+ var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, {
24350
24550
  enumerable: true,
24351
24551
  configurable: true,
24352
24552
  writable: true,
@@ -24360,30 +24560,30 @@ var __commonJS = (cb, mod) => function __require2() {
24360
24560
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24361
24561
  };
24362
24562
  var __export = (target, all$1) => {
24363
- for (var name$1 in all$1) __defProp$1(target, name$1, {
24563
+ for (var name$1 in all$1) __defProp(target, name$1, {
24364
24564
  get: all$1[name$1],
24365
24565
  enumerable: true
24366
24566
  });
24367
24567
  };
24368
24568
  var __copyProps = (to, from, except, desc) => {
24369
24569
  if (from && typeof from === "object" || typeof from === "function") {
24370
- for (let key2 of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key2) && key2 !== except) __defProp$1(to, key2, {
24570
+ for (let key2 of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key2) && key2 !== except) __defProp(to, key2, {
24371
24571
  get: () => from[key2],
24372
24572
  enumerable: !(desc = __getOwnPropDesc(from, key2)) || desc.enumerable
24373
24573
  });
24374
24574
  }
24375
24575
  return to;
24376
24576
  };
24377
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
24577
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
24378
24578
  value: mod,
24379
24579
  enumerable: true
24380
24580
  }) : target, mod));
24381
- var __publicField$1 = (obj, key2, value) => __defNormalProp$1(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
24382
- var __accessCheck$1 = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
24383
- var __privateGet = (obj, member, getter) => (__accessCheck$1(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
24384
- var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
24385
- var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
24386
- var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
24581
+ var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "symbol" ? key2 + "" : key2, value);
24582
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
24583
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
24584
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
24585
+ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
24586
+ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
24387
24587
  var require_array = __commonJS({ "node_modules/fast-glob/out/utils/array.js"(exports$2) {
24388
24588
  "use strict";
24389
24589
  Object.defineProperty(exports$2, "__esModule", { value: true });
@@ -24437,9 +24637,9 @@ var require_path = __commonJS({ "node_modules/fast-glob/out/utils/path.js"(expor
24437
24637
  "use strict";
24438
24638
  Object.defineProperty(exports$2, "__esModule", { value: true });
24439
24639
  exports$2.convertPosixPathToPattern = exports$2.convertWindowsPathToPattern = exports$2.convertPathToPattern = exports$2.escapePosixPath = exports$2.escapeWindowsPath = exports$2.escape = exports$2.removeLeadingDotSegment = exports$2.makeAbsolute = exports$2.unixify = void 0;
24440
- var os$3 = __require("os");
24640
+ var os$2 = __require("os");
24441
24641
  var path14 = __require("path");
24442
- var IS_WINDOWS_PLATFORM$1 = os$3.platform() === "win32";
24642
+ var IS_WINDOWS_PLATFORM$1 = os$2.platform() === "win32";
24443
24643
  var LEADING_DOT_SEGMENT_CHARACTERS_COUNT$1 = 2;
24444
24644
  var POSIX_UNESCAPED_GLOB_SYMBOLS_RE$1 = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
24445
24645
  var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE$1 = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
@@ -27488,15 +27688,15 @@ var require_run_parallel = __commonJS({ "node_modules/run-parallel/index.js"(exp
27488
27688
  module$1.exports = runParallel$1;
27489
27689
  var queueMicrotask2 = require_queue_microtask();
27490
27690
  function runParallel$1(tasks, cb) {
27491
- let results, pending$1, keys;
27691
+ let results, pending, keys;
27492
27692
  let isSync = true;
27493
27693
  if (Array.isArray(tasks)) {
27494
27694
  results = [];
27495
- pending$1 = tasks.length;
27695
+ pending = tasks.length;
27496
27696
  } else {
27497
27697
  keys = Object.keys(tasks);
27498
27698
  results = {};
27499
- pending$1 = keys.length;
27699
+ pending = keys.length;
27500
27700
  }
27501
27701
  function done(err) {
27502
27702
  function end() {
@@ -27508,9 +27708,9 @@ var require_run_parallel = __commonJS({ "node_modules/run-parallel/index.js"(exp
27508
27708
  }
27509
27709
  function each(i$2, err, result) {
27510
27710
  results[i$2] = result;
27511
- if (--pending$1 === 0 || err) done(err);
27711
+ if (--pending === 0 || err) done(err);
27512
27712
  }
27513
- if (!pending$1) done(null);
27713
+ if (!pending) done(null);
27514
27714
  else if (keys) keys.forEach(function(key2) {
27515
27715
  tasks[key2](function(err, result) {
27516
27716
  each(key2, err, result);
@@ -28883,8 +29083,8 @@ var require_settings4 = __commonJS({ "node_modules/fast-glob/out/settings.js"(ex
28883
29083
  Object.defineProperty(exports$2, "__esModule", { value: true });
28884
29084
  exports$2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
28885
29085
  var fs4 = __require("fs");
28886
- var os$3 = __require("os");
28887
- var CPU_COUNT$1 = Math.max(os$3.cpus().length, 1);
29086
+ var os$2 = __require("os");
29087
+ var CPU_COUNT$1 = Math.max(os$2.cpus().length, 1);
28888
29088
  exports$2.DEFAULT_FILE_SYSTEM_ADAPTER = {
28889
29089
  lstat: fs4.lstat,
28890
29090
  lstatSync: fs4.lstatSync,
@@ -29028,8 +29228,8 @@ var require_out4 = __commonJS({ "node_modules/fast-glob/out/index.js"(exports$2,
29028
29228
  var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(exports$2, module$1) {
29029
29229
  var p$1 = process || {};
29030
29230
  var argv = p$1.argv || [];
29031
- var env$2 = p$1.env || {};
29032
- var isColorSupported = !(!!env$2.NO_COLOR || argv.includes("--no-color")) && (!!env$2.FORCE_COLOR || argv.includes("--color") || p$1.platform === "win32" || (p$1.stdout || {}).isTTY && env$2.TERM !== "dumb" || !!env$2.CI);
29231
+ var env$1 = p$1.env || {};
29232
+ var isColorSupported = !(!!env$1.NO_COLOR || argv.includes("--no-color")) && (!!env$1.FORCE_COLOR || argv.includes("--color") || p$1.platform === "win32" || (p$1.stdout || {}).isTTY && env$1.TERM !== "dumb" || !!env$1.CI);
29033
29233
  var formatter = (open, close, replace = open) => (input) => {
29034
29234
  let string$7 = "" + input, index$1 = string$7.indexOf(close, open.length);
29035
29235
  return ~index$1 ? open + replaceClose(string$7, close, replace, index$1) + close : open + string$7 + close;
@@ -29095,8 +29295,8 @@ var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(ex
29095
29295
  } });
29096
29296
  var require_debug = __commonJS({ "node_modules/semver/internal/debug.js"(exports$2, module$1) {
29097
29297
  "use strict";
29098
- var debug$2 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
29099
- module$1.exports = debug$2;
29298
+ var debug$5 = typeof process === "object" && process.env && process.env.NODE_DEBUG && /\bsemver\b/i.test(process.env.NODE_DEBUG) ? (...args) => console.error("SEMVER", ...args) : () => {};
29299
+ module$1.exports = debug$5;
29100
29300
  } });
29101
29301
  var require_constants4 = __commonJS({ "node_modules/semver/internal/constants.js"(exports$2, module$1) {
29102
29302
  "use strict";
@@ -29128,7 +29328,7 @@ var require_constants4 = __commonJS({ "node_modules/semver/internal/constants.js
29128
29328
  var require_re = __commonJS({ "node_modules/semver/internal/re.js"(exports$2, module$1) {
29129
29329
  "use strict";
29130
29330
  var { MAX_SAFE_COMPONENT_LENGTH, MAX_SAFE_BUILD_LENGTH, MAX_LENGTH: MAX_LENGTH$2 } = require_constants4();
29131
- var debug$2 = require_debug();
29331
+ var debug$5 = require_debug();
29132
29332
  exports$2 = module$1.exports = {};
29133
29333
  var re = exports$2.re = [];
29134
29334
  var safeRe = exports$2.safeRe = [];
@@ -29149,7 +29349,7 @@ var require_re = __commonJS({ "node_modules/semver/internal/re.js"(exports$2, mo
29149
29349
  var createToken = (name$1, value, isGlobal) => {
29150
29350
  const safe = makeSafeRegex(value);
29151
29351
  const index$1 = R++;
29152
- debug$2(name$1, index$1, value);
29352
+ debug$5(name$1, index$1, value);
29153
29353
  t$1[name$1] = index$1;
29154
29354
  src[index$1] = value;
29155
29355
  safeSrc[index$1] = safe;
@@ -29234,7 +29434,7 @@ var require_identifiers = __commonJS({ "node_modules/semver/internal/identifiers
29234
29434
  } });
29235
29435
  var require_semver = __commonJS({ "node_modules/semver/classes/semver.js"(exports$2, module$1) {
29236
29436
  "use strict";
29237
- var debug$2 = require_debug();
29437
+ var debug$5 = require_debug();
29238
29438
  var { MAX_LENGTH: MAX_LENGTH$2, MAX_SAFE_INTEGER } = require_constants4();
29239
29439
  var { safeRe: re, t: t$1 } = require_re();
29240
29440
  var parseOptions = require_parse_options();
@@ -29246,7 +29446,7 @@ var require_semver = __commonJS({ "node_modules/semver/classes/semver.js"(export
29246
29446
  else version$2 = version$2.version;
29247
29447
  else if (typeof version$2 !== "string") throw new TypeError(`Invalid version. Must be a string. Got type "${typeof version$2}".`);
29248
29448
  if (version$2.length > MAX_LENGTH$2) throw new TypeError(`version is longer than ${MAX_LENGTH$2} characters`);
29249
- debug$2("SemVer", version$2, options8);
29449
+ debug$5("SemVer", version$2, options8);
29250
29450
  this.options = options8;
29251
29451
  this.loose = !!options8.loose;
29252
29452
  this.includePrerelease = !!options8.includePrerelease;
@@ -29279,7 +29479,7 @@ var require_semver = __commonJS({ "node_modules/semver/classes/semver.js"(export
29279
29479
  return this.version;
29280
29480
  }
29281
29481
  compare(other) {
29282
- debug$2("SemVer.compare", this.version, this.options, other);
29482
+ debug$5("SemVer.compare", this.version, this.options, other);
29283
29483
  if (!(other instanceof _SemVer)) {
29284
29484
  if (typeof other === "string" && other === this.version) return 0;
29285
29485
  other = new _SemVer(other, this.options);
@@ -29300,7 +29500,7 @@ var require_semver = __commonJS({ "node_modules/semver/classes/semver.js"(export
29300
29500
  do {
29301
29501
  const a$1 = this.prerelease[i$2];
29302
29502
  const b$1 = other.prerelease[i$2];
29303
- debug$2("prerelease compare", i$2, a$1, b$1);
29503
+ debug$5("prerelease compare", i$2, a$1, b$1);
29304
29504
  if (a$1 === void 0 && b$1 === void 0) return 0;
29305
29505
  else if (b$1 === void 0) return 1;
29306
29506
  else if (a$1 === void 0) return -1;
@@ -29314,7 +29514,7 @@ var require_semver = __commonJS({ "node_modules/semver/classes/semver.js"(export
29314
29514
  do {
29315
29515
  const a$1 = this.build[i$2];
29316
29516
  const b$1 = other.build[i$2];
29317
- debug$2("build compare", i$2, a$1, b$1);
29517
+ debug$5("build compare", i$2, a$1, b$1);
29318
29518
  if (a$1 === void 0 && b$1 === void 0) return 0;
29319
29519
  else if (b$1 === void 0) return 1;
29320
29520
  else if (a$1 === void 0) return -1;
@@ -33746,7 +33946,7 @@ async function findInDirectory(nameOrNames, { typeCheck, cwd, allowSymlinks = tr
33746
33946
  }
33747
33947
  async function safeStat(path14, allowSymlinks = true) {
33748
33948
  try {
33749
- return await (allowSymlinks ? fs$2.stat : fs$2.lstat)(path14);
33949
+ return await (allowSymlinks ? fs$1.stat : fs$1.lstat)(path14);
33750
33950
  } catch {}
33751
33951
  }
33752
33952
  function findFile(nameOrNames, options8) {
@@ -33783,16 +33983,16 @@ var Searcher = class {
33783
33983
  @param {SearcherOptions} [options]
33784
33984
  */
33785
33985
  constructor(nameOrNames, { allowSymlinks, filter: filter2, stopDirectory, cache: cache3 } = {}) {
33786
- __privateAdd$1(this, _Searcher_instances);
33787
- __privateAdd$1(this, _stopDirectory);
33788
- __privateAdd$1(this, _cache);
33789
- __privateAdd$1(this, _resultCache, /* @__PURE__ */ new Map());
33790
- __privateAdd$1(this, _searchWithoutCache);
33986
+ __privateAdd(this, _Searcher_instances);
33987
+ __privateAdd(this, _stopDirectory);
33988
+ __privateAdd(this, _cache);
33989
+ __privateAdd(this, _resultCache, /* @__PURE__ */ new Map());
33990
+ __privateAdd(this, _searchWithoutCache);
33791
33991
  /**
33792
33992
  @protected
33793
33993
  @type {typeof findFile | typeof findDirectory}
33794
33994
  */
33795
- __publicField$1(this, "findInDirectory");
33995
+ __publicField(this, "findInDirectory");
33796
33996
  __privateSet(this, _stopDirectory, stopDirectory);
33797
33997
  __privateSet(this, _cache, cache3 ?? true);
33798
33998
  __privateSet(this, _searchWithoutCache, (directory) => this.findInDirectory(nameOrNames, {
@@ -33810,7 +34010,7 @@ var Searcher = class {
33810
34010
  */
33811
34011
  async search(startDirectory, options8) {
33812
34012
  for (const directory of iterate_directory_up_default(startDirectory, __privateGet(this, _stopDirectory))) {
33813
- const result = await __privateMethod$1(this, _Searcher_instances, search_fn).call(this, directory, (options8 == null ? void 0 : options8.cache) ?? __privateGet(this, _cache));
34013
+ const result = await __privateMethod(this, _Searcher_instances, search_fn).call(this, directory, (options8 == null ? void 0 : options8.cache) ?? __privateGet(this, _cache));
33814
34014
  if (result) return result;
33815
34015
  }
33816
34016
  }
@@ -34694,14 +34894,14 @@ var _JSONError = class _JSONError$1 extends Error {
34694
34894
  constructor(messageOrOptions) {
34695
34895
  var __super = (...args) => {
34696
34896
  super(...args);
34697
- __privateAdd$1(this, _JSONError_instances);
34698
- __publicField$1(this, "name", "JSONError");
34699
- __publicField$1(this, "fileName");
34700
- __privateAdd$1(this, _input);
34701
- __privateAdd$1(this, _jsonParseError);
34702
- __privateAdd$1(this, _message);
34703
- __privateAdd$1(this, _codeFrame);
34704
- __privateAdd$1(this, _rawCodeFrame);
34897
+ __privateAdd(this, _JSONError_instances);
34898
+ __publicField(this, "name", "JSONError");
34899
+ __publicField(this, "fileName");
34900
+ __privateAdd(this, _input);
34901
+ __privateAdd(this, _jsonParseError);
34902
+ __privateAdd(this, _message);
34903
+ __privateAdd(this, _codeFrame);
34904
+ __privateAdd(this, _rawCodeFrame);
34705
34905
  return this;
34706
34906
  };
34707
34907
  var _a$2;
@@ -34729,11 +34929,11 @@ ${codeFrame}
34729
34929
  __privateSet(this, _message, message);
34730
34930
  }
34731
34931
  get codeFrame() {
34732
- __privateGet(this, _codeFrame) ?? __privateSet(this, _codeFrame, __privateMethod$1(this, _JSONError_instances, getCodeFrame_fn).call(this, true));
34932
+ __privateGet(this, _codeFrame) ?? __privateSet(this, _codeFrame, __privateMethod(this, _JSONError_instances, getCodeFrame_fn).call(this, true));
34733
34933
  return __privateGet(this, _codeFrame);
34734
34934
  }
34735
34935
  get rawCodeFrame() {
34736
- __privateGet(this, _rawCodeFrame) ?? __privateSet(this, _rawCodeFrame, __privateMethod$1(this, _JSONError_instances, getCodeFrame_fn).call(this, false));
34936
+ __privateGet(this, _rawCodeFrame) ?? __privateSet(this, _rawCodeFrame, __privateMethod(this, _JSONError_instances, getCodeFrame_fn).call(this, false));
34737
34937
  return __privateGet(this, _rawCodeFrame);
34738
34938
  }
34739
34939
  };
@@ -34893,9 +35093,9 @@ var _TomlDate = class _TomlDate$1 extends Date {
34893
35093
  } else date$4 = "";
34894
35094
  }
34895
35095
  super(date$4);
34896
- __privateAdd$1(this, _hasDate, false);
34897
- __privateAdd$1(this, _hasTime, false);
34898
- __privateAdd$1(this, _offset, null);
35096
+ __privateAdd(this, _hasDate, false);
35097
+ __privateAdd(this, _hasTime, false);
35098
+ __privateAdd(this, _offset, null);
34899
35099
  if (!isNaN(this.getTime())) {
34900
35100
  __privateSet(this, _hasDate, hasDate);
34901
35101
  __privateSet(this, _hasTime, hasTime);
@@ -35359,7 +35559,7 @@ function parse4(toml, opts) {
35359
35559
  }
35360
35560
  return res;
35361
35561
  }
35362
- async function readFile(file$1) {
35562
+ async function readFile$1(file$1) {
35363
35563
  if (isUrlString(file$1)) file$1 = new URL(file$1);
35364
35564
  try {
35365
35565
  return await fs2.readFile(file$1, "utf8");
@@ -35368,7 +35568,7 @@ async function readFile(file$1) {
35368
35568
  throw new Error(`Unable to read '${file$1}': ${error$41.message}`);
35369
35569
  }
35370
35570
  }
35371
- var read_file_default = readFile;
35571
+ var read_file_default = readFile$1;
35372
35572
  async function readJson$1(file$1) {
35373
35573
  const content$2 = await read_file_default(file$1);
35374
35574
  try {
@@ -37468,7 +37668,7 @@ var get_alignment_size_default = getAlignmentSize;
37468
37668
  var _AstPath_instances, getNodeStackIndex_fn, getAncestors_fn;
37469
37669
  var AstPath = class {
37470
37670
  constructor(value) {
37471
- __privateAdd$1(this, _AstPath_instances);
37671
+ __privateAdd(this, _AstPath_instances);
37472
37672
  this.stack = [value];
37473
37673
  }
37474
37674
  /** @type {string | null} */
@@ -37531,7 +37731,7 @@ var AstPath = class {
37531
37731
  }
37532
37732
  /** @type {object[]} */
37533
37733
  get ancestors() {
37534
- return [...__privateMethod$1(this, _AstPath_instances, getAncestors_fn).call(this)];
37734
+ return [...__privateMethod(this, _AstPath_instances, getAncestors_fn).call(this)];
37535
37735
  }
37536
37736
  getName() {
37537
37737
  const { stack: stack2 } = this;
@@ -37543,7 +37743,7 @@ var AstPath = class {
37543
37743
  return at_default(false, this.stack, -1);
37544
37744
  }
37545
37745
  getNode(count = 0) {
37546
- const stackIndex = __privateMethod$1(this, _AstPath_instances, getNodeStackIndex_fn).call(this, count);
37746
+ const stackIndex = __privateMethod(this, _AstPath_instances, getNodeStackIndex_fn).call(this, count);
37547
37747
  return stackIndex === -1 ? null : this.stack[stackIndex];
37548
37748
  }
37549
37749
  getParentNode(count = 0) {
@@ -37570,7 +37770,7 @@ var AstPath = class {
37570
37770
  * @returns {ReturnType<T>}
37571
37771
  */
37572
37772
  callParent(callback, count = 0) {
37573
- const stackIndex = __privateMethod$1(this, _AstPath_instances, getNodeStackIndex_fn).call(this, count + 1);
37773
+ const stackIndex = __privateMethod(this, _AstPath_instances, getNodeStackIndex_fn).call(this, count + 1);
37574
37774
  const parentValues = this.stack.splice(stackIndex + 1);
37575
37775
  try {
37576
37776
  return callback(this);
@@ -37635,7 +37835,7 @@ var AstPath = class {
37635
37835
  * @internal Unstable API. Don't use in plugins for now.
37636
37836
  */
37637
37837
  findAncestor(predicate) {
37638
- for (const node$1 of __privateMethod$1(this, _AstPath_instances, getAncestors_fn).call(this)) if (predicate(node$1)) return node$1;
37838
+ for (const node$1 of __privateMethod(this, _AstPath_instances, getAncestors_fn).call(this)) if (predicate(node$1)) return node$1;
37639
37839
  }
37640
37840
  /**
37641
37841
  * Traverses the ancestors of the current node heading toward the tree root
@@ -37646,7 +37846,7 @@ var AstPath = class {
37646
37846
  * @internal Unstable API. Don't use in plugins for now.
37647
37847
  */
37648
37848
  hasAncestor(predicate) {
37649
- for (const node$1 of __privateMethod$1(this, _AstPath_instances, getAncestors_fn).call(this)) if (predicate(node$1)) return true;
37849
+ for (const node$1 of __privateMethod(this, _AstPath_instances, getAncestors_fn).call(this)) if (predicate(node$1)) return true;
37650
37850
  return false;
37651
37851
  }
37652
37852
  };
@@ -40808,7 +41008,7 @@ async function confirmAction(filesToUpdate, options$1) {
40808
41008
  checked: file$1.safe || !!options$1.allowUnsafe
40809
41009
  });
40810
41010
  }
40811
- const selectedFiles = await esm_default$2({
41011
+ const selectedFiles = await esm_default$3({
40812
41012
  message: [options$1.topMessage, "The following files will be overwritten:\n"].filter(Boolean).join("\n"),
40813
41013
  choices,
40814
41014
  pageSize: process.stdout.rows > 0 ? process.stdout.rows - 4 : filesToUpdate.length
@@ -41080,582 +41280,181 @@ function stringifySearchWith(stringify$6, parser$2) {
41080
41280
  }
41081
41281
 
41082
41282
  //#endregion
41083
- //#region ../../node_modules/.pnpm/signal-polyfill@0.2.2/node_modules/signal-polyfill/dist/index.js
41084
- var __defProp = Object.defineProperty;
41085
- var __defNormalProp = (obj, key$1, value) => key$1 in obj ? __defProp(obj, key$1, {
41086
- enumerable: true,
41087
- configurable: true,
41088
- writable: true,
41089
- value
41090
- }) : obj[key$1] = value;
41091
- var __publicField = (obj, key$1, value) => {
41092
- __defNormalProp(obj, typeof key$1 !== "symbol" ? key$1 + "" : key$1, value);
41093
- return value;
41094
- };
41095
- var __accessCheck = (obj, member, msg) => {
41096
- if (!member.has(obj)) throw TypeError("Cannot " + msg);
41097
- };
41098
- var __privateIn = (member, obj) => {
41099
- if (Object(obj) !== obj) throw TypeError("Cannot use the \"in\" operator on this value");
41100
- return member.has(obj);
41101
- };
41102
- var __privateAdd = (obj, member, value) => {
41103
- if (member.has(obj)) throw TypeError("Cannot add the same private member more than once");
41104
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
41105
- };
41106
- var __privateMethod = (obj, member, method) => {
41107
- __accessCheck(obj, member, "access private method");
41108
- return method;
41109
- };
41283
+ //#region ../dev/dist/reactive-fs/reactive-context.js
41284
+ var import_src$3 = __toESM$1(require_src$2(), 1);
41285
+ const debug$3 = (0, import_src$3.default)("jixo:reactive-fs-v2");
41286
+ const contextStorage = new AsyncLocalStorage();
41110
41287
  /**
41111
- * @license
41112
- * Copyright Google LLC All Rights Reserved.
41113
- *
41114
- * Use of this source code is governed by an MIT-style license that can be
41115
- * found in the LICENSE file at https://angular.io/license
41288
+ * Represents a single piece of reactive state that can be tracked by a ReactiveContext.
41289
+ * It's analogous to Signal.State.
41116
41290
  */
41117
- function defaultEquals(a$1, b$1) {
41118
- return Object.is(a$1, b$1);
41119
- }
41291
+ var ReactiveState = class {
41292
+ currentValue;
41293
+ equals;
41294
+ constructor(initialValue, options$1) {
41295
+ this.currentValue = initialValue;
41296
+ this.equals = options$1?.equals ?? ((a$1, b$1) => a$1 === b$1);
41297
+ }
41298
+ /**
41299
+ * Retrieves the current value of the state.
41300
+ * If called within a ReactiveContext task, it enables tracking.
41301
+ * @returns The current value.
41302
+ */
41303
+ get() {
41304
+ const context = contextStorage.getStore();
41305
+ if (context) return context.getOrPushCache(this, this.currentValue);
41306
+ return this.currentValue;
41307
+ }
41308
+ /**
41309
+ * Updates the value of the state.
41310
+ * If the new value is different from the old one, it notifies any active
41311
+ * ReactiveContext that it has become dirty.
41312
+ * @param newValue The new value.
41313
+ */
41314
+ set(newValue) {
41315
+ if (this.equals(this.currentValue, newValue)) return false;
41316
+ this.currentValue = newValue;
41317
+ const context = contextStorage.getStore();
41318
+ context?.notifyChange();
41319
+ return true;
41320
+ }
41321
+ };
41120
41322
  /**
41121
- * @license
41122
- * Copyright Google LLC All Rights Reserved.
41123
- *
41124
- * Use of this source code is governed by an MIT-style license that can be
41125
- * found in the LICENSE file at https://angular.io/license
41323
+ * Manages the execution of an asynchronous, reactive task.
41324
+ * It now works by tracking changes on ReactiveState instances used within its task.
41126
41325
  */
41127
- let activeConsumer = null;
41128
- let inNotificationPhase = false;
41129
- let epoch = 1;
41130
- const SIGNAL = /* @__PURE__ */ Symbol("SIGNAL");
41131
- function setActiveConsumer(consumer) {
41132
- const prev = activeConsumer;
41133
- activeConsumer = consumer;
41134
- return prev;
41135
- }
41136
- function getActiveConsumer() {
41137
- return activeConsumer;
41138
- }
41139
- function isInNotificationPhase() {
41140
- return inNotificationPhase;
41141
- }
41142
- const REACTIVE_NODE = {
41143
- version: 0,
41144
- lastCleanEpoch: 0,
41145
- dirty: false,
41146
- producerNode: void 0,
41147
- producerLastReadVersion: void 0,
41148
- producerIndexOfThis: void 0,
41149
- nextProducerIndex: 0,
41150
- liveConsumerNode: void 0,
41151
- liveConsumerIndexOfThis: void 0,
41152
- consumerAllowSignalWrites: false,
41153
- consumerIsAlwaysLive: false,
41154
- producerMustRecompute: () => false,
41155
- producerRecomputeValue: () => {},
41156
- consumerMarkedDirty: () => {},
41157
- consumerOnSignalRead: () => {}
41158
- };
41159
- function producerAccessed(node$1) {
41160
- if (inNotificationPhase) throw new Error(typeof ngDevMode !== "undefined" && ngDevMode ? `Assertion error: signal read during notification phase` : "");
41161
- if (activeConsumer === null) return;
41162
- activeConsumer.consumerOnSignalRead(node$1);
41163
- const idx = activeConsumer.nextProducerIndex++;
41164
- assertConsumerNode(activeConsumer);
41165
- if (idx < activeConsumer.producerNode.length && activeConsumer.producerNode[idx] !== node$1) {
41166
- if (consumerIsLive(activeConsumer)) {
41167
- const staleProducer = activeConsumer.producerNode[idx];
41168
- producerRemoveLiveConsumerAtIndex(staleProducer, activeConsumer.producerIndexOfThis[idx]);
41169
- }
41170
- }
41171
- if (activeConsumer.producerNode[idx] !== node$1) {
41172
- activeConsumer.producerNode[idx] = node$1;
41173
- activeConsumer.producerIndexOfThis[idx] = consumerIsLive(activeConsumer) ? producerAddLiveConsumer(node$1, activeConsumer, idx) : 0;
41174
- }
41175
- activeConsumer.producerLastReadVersion[idx] = node$1.version;
41176
- }
41177
- function producerIncrementEpoch() {
41178
- epoch++;
41179
- }
41180
- function producerUpdateValueVersion(node$1) {
41181
- if (!node$1.dirty && node$1.lastCleanEpoch === epoch) return;
41182
- if (!node$1.producerMustRecompute(node$1) && !consumerPollProducersForChange(node$1)) {
41183
- node$1.dirty = false;
41184
- node$1.lastCleanEpoch = epoch;
41185
- return;
41186
- }
41187
- node$1.producerRecomputeValue(node$1);
41188
- node$1.dirty = false;
41189
- node$1.lastCleanEpoch = epoch;
41190
- }
41191
- function producerNotifyConsumers(node$1) {
41192
- if (node$1.liveConsumerNode === void 0) return;
41193
- const prev = inNotificationPhase;
41194
- inNotificationPhase = true;
41195
- try {
41196
- for (const consumer of node$1.liveConsumerNode) if (!consumer.dirty) consumerMarkDirty(consumer);
41197
- } finally {
41198
- inNotificationPhase = prev;
41326
+ var ReactiveContext = class {
41327
+ watch;
41328
+ isRunning = false;
41329
+ hasChanged;
41330
+ caches = /* @__PURE__ */ new Map();
41331
+ task;
41332
+ constructor(task, watch = false) {
41333
+ this.watch = watch;
41334
+ if (typeof task !== "function") throw new TypeError("Task must be a function.");
41335
+ this.task = task;
41199
41336
  }
41200
- }
41201
- function producerUpdatesAllowed() {
41202
- return (activeConsumer == null ? void 0 : activeConsumer.consumerAllowSignalWrites) !== false;
41203
- }
41204
- function consumerMarkDirty(node$1) {
41205
- var _a$2;
41206
- node$1.dirty = true;
41207
- producerNotifyConsumers(node$1);
41208
- (_a$2 = node$1.consumerMarkedDirty) == null || _a$2.call(node$1.wrapper ?? node$1);
41209
- }
41210
- function consumerBeforeComputation(node$1) {
41211
- node$1 && (node$1.nextProducerIndex = 0);
41212
- return setActiveConsumer(node$1);
41213
- }
41214
- function consumerAfterComputation(node$1, prevConsumer) {
41215
- setActiveConsumer(prevConsumer);
41216
- if (!node$1 || node$1.producerNode === void 0 || node$1.producerIndexOfThis === void 0 || node$1.producerLastReadVersion === void 0) return;
41217
- if (consumerIsLive(node$1)) for (let i$2 = node$1.nextProducerIndex; i$2 < node$1.producerNode.length; i$2++) producerRemoveLiveConsumerAtIndex(node$1.producerNode[i$2], node$1.producerIndexOfThis[i$2]);
41218
- while (node$1.producerNode.length > node$1.nextProducerIndex) {
41219
- node$1.producerNode.pop();
41220
- node$1.producerLastReadVersion.pop();
41221
- node$1.producerIndexOfThis.pop();
41222
- }
41223
- }
41224
- function consumerPollProducersForChange(node$1) {
41225
- assertConsumerNode(node$1);
41226
- for (let i$2 = 0; i$2 < node$1.producerNode.length; i$2++) {
41227
- const producer = node$1.producerNode[i$2];
41228
- const seenVersion = node$1.producerLastReadVersion[i$2];
41229
- if (seenVersion !== producer.version) return true;
41230
- producerUpdateValueVersion(producer);
41231
- if (seenVersion !== producer.version) return true;
41337
+ /** @internal */
41338
+ getOrPushCache(state, value) {
41339
+ if (this.caches.has(state)) return this.caches.get(state);
41340
+ this.caches.set(state, value);
41341
+ return value;
41232
41342
  }
41233
- return false;
41234
- }
41235
- function producerAddLiveConsumer(node$1, consumer, indexOfThis) {
41236
- var _a$2;
41237
- assertProducerNode(node$1);
41238
- assertConsumerNode(node$1);
41239
- if (node$1.liveConsumerNode.length === 0) {
41240
- (_a$2 = node$1.watched) == null || _a$2.call(node$1.wrapper);
41241
- for (let i$2 = 0; i$2 < node$1.producerNode.length; i$2++) node$1.producerIndexOfThis[i$2] = producerAddLiveConsumer(node$1.producerNode[i$2], node$1, i$2);
41343
+ /** @internal */
41344
+ notifyChange() {
41345
+ debug$3("notifyChange", this.hasChanged);
41346
+ this.hasChanged?.resolve();
41242
41347
  }
41243
- node$1.liveConsumerIndexOfThis.push(indexOfThis);
41244
- return node$1.liveConsumerNode.push(consumer) - 1;
41245
- }
41246
- function producerRemoveLiveConsumerAtIndex(node$1, idx) {
41247
- var _a$2;
41248
- assertProducerNode(node$1);
41249
- assertConsumerNode(node$1);
41250
- if (typeof ngDevMode !== "undefined" && ngDevMode && idx >= node$1.liveConsumerNode.length) throw new Error(`Assertion error: active consumer index ${idx} is out of bounds of ${node$1.liveConsumerNode.length} consumers)`);
41251
- if (node$1.liveConsumerNode.length === 1) {
41252
- (_a$2 = node$1.unwatched) == null || _a$2.call(node$1.wrapper);
41253
- for (let i$2 = 0; i$2 < node$1.producerNode.length; i$2++) producerRemoveLiveConsumerAtIndex(node$1.producerNode[i$2], node$1.producerIndexOfThis[i$2]);
41254
- }
41255
- const lastIdx = node$1.liveConsumerNode.length - 1;
41256
- node$1.liveConsumerNode[idx] = node$1.liveConsumerNode[lastIdx];
41257
- node$1.liveConsumerIndexOfThis[idx] = node$1.liveConsumerIndexOfThis[lastIdx];
41258
- node$1.liveConsumerNode.length--;
41259
- node$1.liveConsumerIndexOfThis.length--;
41260
- if (idx < node$1.liveConsumerNode.length) {
41261
- const idxProducer = node$1.liveConsumerIndexOfThis[idx];
41262
- const consumer = node$1.liveConsumerNode[idx];
41263
- assertConsumerNode(consumer);
41264
- consumer.producerIndexOfThis[idxProducer] = idx;
41265
- }
41266
- }
41267
- function consumerIsLive(node$1) {
41268
- var _a$2;
41269
- return node$1.consumerIsAlwaysLive || (((_a$2 = node$1 == null ? void 0 : node$1.liveConsumerNode) == null ? void 0 : _a$2.length) ?? 0) > 0;
41270
- }
41271
- function assertConsumerNode(node$1) {
41272
- node$1.producerNode ?? (node$1.producerNode = []);
41273
- node$1.producerIndexOfThis ?? (node$1.producerIndexOfThis = []);
41274
- node$1.producerLastReadVersion ?? (node$1.producerLastReadVersion = []);
41275
- }
41276
- function assertProducerNode(node$1) {
41277
- node$1.liveConsumerNode ?? (node$1.liveConsumerNode = []);
41278
- node$1.liveConsumerIndexOfThis ?? (node$1.liveConsumerIndexOfThis = []);
41279
- }
41280
- /**
41281
- * @license
41282
- * Copyright Google LLC All Rights Reserved.
41283
- *
41284
- * Use of this source code is governed by an MIT-style license that can be
41285
- * found in the LICENSE file at https://angular.io/license
41286
- */
41287
- function computedGet(node$1) {
41288
- producerUpdateValueVersion(node$1);
41289
- producerAccessed(node$1);
41290
- if (node$1.value === ERRORED) throw node$1.error;
41291
- return node$1.value;
41292
- }
41293
- function createComputed(computation) {
41294
- const node$1 = Object.create(COMPUTED_NODE);
41295
- node$1.computation = computation;
41296
- const computed = () => computedGet(node$1);
41297
- computed[SIGNAL] = node$1;
41298
- return computed;
41299
- }
41300
- const UNSET = /* @__PURE__ */ Symbol("UNSET");
41301
- const COMPUTING = /* @__PURE__ */ Symbol("COMPUTING");
41302
- const ERRORED = /* @__PURE__ */ Symbol("ERRORED");
41303
- const COMPUTED_NODE = /* @__PURE__ */ (() => {
41304
- return {
41305
- ...REACTIVE_NODE,
41306
- value: UNSET,
41307
- dirty: true,
41308
- error: null,
41309
- equal: defaultEquals,
41310
- producerMustRecompute(node$1) {
41311
- return node$1.value === UNSET || node$1.value === COMPUTING;
41312
- },
41313
- producerRecomputeValue(node$1) {
41314
- if (node$1.value === COMPUTING) throw new Error("Detected cycle in computations.");
41315
- const oldValue = node$1.value;
41316
- node$1.value = COMPUTING;
41317
- const prevConsumer = consumerBeforeComputation(node$1);
41318
- let newValue;
41319
- let wasEqual = false;
41320
- try {
41321
- newValue = node$1.computation.call(node$1.wrapper);
41322
- const oldOk = oldValue !== UNSET && oldValue !== ERRORED;
41323
- wasEqual = oldOk && node$1.equal.call(node$1.wrapper, oldValue, newValue);
41324
- } catch (err) {
41325
- newValue = ERRORED;
41326
- node$1.error = err;
41327
- } finally {
41328
- consumerAfterComputation(node$1, prevConsumer);
41329
- }
41330
- if (wasEqual) {
41331
- node$1.value = oldValue;
41332
- return;
41333
- }
41334
- node$1.value = newValue;
41335
- node$1.version++;
41336
- }
41337
- };
41338
- })();
41339
- /**
41340
- * @license
41341
- * Copyright Google LLC All Rights Reserved.
41342
- *
41343
- * Use of this source code is governed by an MIT-style license that can be
41344
- * found in the LICENSE file at https://angular.io/license
41345
- */
41346
- function defaultThrowError() {
41347
- throw new Error();
41348
- }
41349
- let throwInvalidWriteToSignalErrorFn = defaultThrowError;
41350
- function throwInvalidWriteToSignalError() {
41351
- throwInvalidWriteToSignalErrorFn();
41352
- }
41353
- /**
41354
- * @license
41355
- * Copyright Google LLC All Rights Reserved.
41356
- *
41357
- * Use of this source code is governed by an MIT-style license that can be
41358
- * found in the LICENSE file at https://angular.io/license
41359
- */
41360
- function createSignal(initialValue) {
41361
- const node$1 = Object.create(SIGNAL_NODE);
41362
- node$1.value = initialValue;
41363
- const getter = () => {
41364
- producerAccessed(node$1);
41365
- return node$1.value;
41366
- };
41367
- getter[SIGNAL] = node$1;
41368
- return getter;
41369
- }
41370
- function signalGetFn() {
41371
- producerAccessed(this);
41372
- return this.value;
41373
- }
41374
- function signalSetFn(node$1, newValue) {
41375
- if (!producerUpdatesAllowed()) throwInvalidWriteToSignalError();
41376
- if (!node$1.equal.call(node$1.wrapper, node$1.value, newValue)) {
41377
- node$1.value = newValue;
41378
- signalValueChanged(node$1);
41379
- }
41380
- }
41381
- const SIGNAL_NODE = /* @__PURE__ */ (() => {
41382
- return {
41383
- ...REACTIVE_NODE,
41384
- equal: defaultEquals,
41385
- value: void 0
41386
- };
41387
- })();
41388
- function signalValueChanged(node$1) {
41389
- node$1.version++;
41390
- producerIncrementEpoch();
41391
- producerNotifyConsumers(node$1);
41392
- }
41393
- /**
41394
- * @license
41395
- * Copyright 2024 Bloomberg Finance L.P.
41396
- *
41397
- * Licensed under the Apache License, Version 2.0 (the "License");
41398
- * you may not use this file except in compliance with the License.
41399
- * You may obtain a copy of the License at
41400
- *
41401
- * http://www.apache.org/licenses/LICENSE-2.0
41402
- *
41403
- * Unless required by applicable law or agreed to in writing, software
41404
- * distributed under the License is distributed on an "AS IS" BASIS,
41405
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
41406
- * See the License for the specific language governing permissions and
41407
- * limitations under the License.
41408
- */
41409
- const NODE = Symbol("node");
41410
- var Signal;
41411
- ((Signal2) => {
41412
- var _a$2, _brand, brand_fn, _b$1, _brand2, brand_fn2;
41413
- class State$2 {
41414
- constructor(initialValue, options$1 = {}) {
41415
- __privateAdd(this, _brand);
41416
- __publicField(this, _a$2);
41417
- const ref = createSignal(initialValue);
41418
- const node$1 = ref[SIGNAL];
41419
- this[NODE] = node$1;
41420
- node$1.wrapper = this;
41421
- if (options$1) {
41422
- const equals = options$1.equals;
41423
- if (equals) node$1.equal = equals;
41424
- node$1.watched = options$1[Signal2.subtle.watched];
41425
- node$1.unwatched = options$1[Signal2.subtle.unwatched];
41426
- }
41427
- }
41428
- get() {
41429
- if (!(0, Signal2.isState)(this)) throw new TypeError("Wrong receiver type for Signal.State.prototype.get");
41430
- return signalGetFn.call(this[NODE]);
41431
- }
41432
- set(newValue) {
41433
- if (!(0, Signal2.isState)(this)) throw new TypeError("Wrong receiver type for Signal.State.prototype.set");
41434
- if (isInNotificationPhase()) throw new Error("Writes to signals not permitted during Watcher callback");
41435
- const ref = this[NODE];
41436
- signalSetFn(ref, newValue);
41437
- }
41438
- }
41439
- _a$2 = NODE;
41440
- _brand = /* @__PURE__ */ new WeakSet();
41441
- brand_fn = function() {};
41442
- Signal2.isState = (s$2) => typeof s$2 === "object" && __privateIn(_brand, s$2);
41443
- Signal2.State = State$2;
41444
- class Computed {
41445
- constructor(computation, options$1) {
41446
- __privateAdd(this, _brand2);
41447
- __publicField(this, _b$1);
41448
- const ref = createComputed(computation);
41449
- const node$1 = ref[SIGNAL];
41450
- node$1.consumerAllowSignalWrites = true;
41451
- this[NODE] = node$1;
41452
- node$1.wrapper = this;
41453
- if (options$1) {
41454
- const equals = options$1.equals;
41455
- if (equals) node$1.equal = equals;
41456
- node$1.watched = options$1[Signal2.subtle.watched];
41457
- node$1.unwatched = options$1[Signal2.subtle.unwatched];
41458
- }
41459
- }
41460
- get() {
41461
- if (!(0, Signal2.isComputed)(this)) throw new TypeError("Wrong receiver type for Signal.Computed.prototype.get");
41462
- return computedGet(this[NODE]);
41463
- }
41464
- }
41465
- _b$1 = NODE;
41466
- _brand2 = /* @__PURE__ */ new WeakSet();
41467
- brand_fn2 = function() {};
41468
- Signal2.isComputed = (c$2) => typeof c$2 === "object" && __privateIn(_brand2, c$2);
41469
- Signal2.Computed = Computed;
41470
- ((subtle2) => {
41471
- var _a2, _brand3, brand_fn3, _assertSignals, assertSignals_fn;
41472
- function untrack(cb) {
41473
- let output;
41474
- let prevActiveConsumer = null;
41475
- try {
41476
- prevActiveConsumer = setActiveConsumer(null);
41477
- output = cb();
41478
- } finally {
41479
- setActiveConsumer(prevActiveConsumer);
41480
- }
41481
- return output;
41348
+ /**
41349
+ * TODO 实现off
41350
+ * @param watch
41351
+ * @returns
41352
+ */
41353
+ async run({ signal } = {}) {
41354
+ if (this.isRunning) {
41355
+ console.warn("ReactiveContext.run() called while already running. Ignoring call.");
41356
+ return;
41482
41357
  }
41483
- subtle2.untrack = untrack;
41484
- function introspectSources(sink) {
41485
- var _a3;
41486
- if (!(0, Signal2.isComputed)(sink) && !(0, Signal2.isWatcher)(sink)) throw new TypeError("Called introspectSources without a Computed or Watcher argument");
41487
- return ((_a3 = sink[NODE].producerNode) == null ? void 0 : _a3.map((n$1) => n$1.wrapper)) ?? [];
41488
- }
41489
- subtle2.introspectSources = introspectSources;
41490
- function introspectSinks(signal) {
41491
- var _a3;
41492
- if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) throw new TypeError("Called introspectSinks without a Signal argument");
41493
- return ((_a3 = signal[NODE].liveConsumerNode) == null ? void 0 : _a3.map((n$1) => n$1.wrapper)) ?? [];
41494
- }
41495
- subtle2.introspectSinks = introspectSinks;
41496
- function hasSinks(signal) {
41497
- if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) throw new TypeError("Called hasSinks without a Signal argument");
41498
- const liveConsumerNode = signal[NODE].liveConsumerNode;
41499
- if (!liveConsumerNode) return false;
41500
- return liveConsumerNode.length > 0;
41501
- }
41502
- subtle2.hasSinks = hasSinks;
41503
- function hasSources(signal) {
41504
- if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isWatcher)(signal)) throw new TypeError("Called hasSources without a Computed or Watcher argument");
41505
- const producerNode = signal[NODE].producerNode;
41506
- if (!producerNode) return false;
41507
- return producerNode.length > 0;
41508
- }
41509
- subtle2.hasSources = hasSources;
41510
- class Watcher {
41511
- constructor(notify) {
41512
- __privateAdd(this, _brand3);
41513
- __privateAdd(this, _assertSignals);
41514
- __publicField(this, _a2);
41515
- let node$1 = Object.create(REACTIVE_NODE);
41516
- node$1.wrapper = this;
41517
- node$1.consumerMarkedDirty = notify;
41518
- node$1.consumerIsAlwaysLive = true;
41519
- node$1.consumerAllowSignalWrites = false;
41520
- node$1.producerNode = [];
41521
- this[NODE] = node$1;
41522
- }
41523
- watch(...signals$1) {
41524
- if (!(0, Signal2.isWatcher)(this)) throw new TypeError("Called unwatch without Watcher receiver");
41525
- __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals$1);
41526
- const node$1 = this[NODE];
41527
- node$1.dirty = false;
41528
- const prev = setActiveConsumer(node$1);
41529
- for (const signal of signals$1) producerAccessed(signal[NODE]);
41530
- setActiveConsumer(prev);
41531
- }
41532
- unwatch(...signals$1) {
41533
- if (!(0, Signal2.isWatcher)(this)) throw new TypeError("Called unwatch without Watcher receiver");
41534
- __privateMethod(this, _assertSignals, assertSignals_fn).call(this, signals$1);
41535
- const node$1 = this[NODE];
41536
- assertConsumerNode(node$1);
41537
- for (let i$2 = node$1.producerNode.length - 1; i$2 >= 0; i$2--) if (signals$1.includes(node$1.producerNode[i$2].wrapper)) {
41538
- producerRemoveLiveConsumerAtIndex(node$1.producerNode[i$2], node$1.producerIndexOfThis[i$2]);
41539
- const lastIdx = node$1.producerNode.length - 1;
41540
- node$1.producerNode[i$2] = node$1.producerNode[lastIdx];
41541
- node$1.producerIndexOfThis[i$2] = node$1.producerIndexOfThis[lastIdx];
41542
- node$1.producerNode.length--;
41543
- node$1.producerIndexOfThis.length--;
41544
- node$1.nextProducerIndex--;
41545
- if (i$2 < node$1.producerNode.length) {
41546
- const idxConsumer = node$1.producerIndexOfThis[i$2];
41547
- const producer = node$1.producerNode[i$2];
41548
- assertProducerNode(producer);
41549
- producer.liveConsumerIndexOfThis[idxConsumer] = i$2;
41550
- }
41551
- }
41552
- }
41553
- getPending() {
41554
- if (!(0, Signal2.isWatcher)(this)) throw new TypeError("Called getPending without Watcher receiver");
41555
- const node$1 = this[NODE];
41556
- return node$1.producerNode.filter((n$1) => n$1.dirty).map((n$1) => n$1.wrapper);
41358
+ this.isRunning = true;
41359
+ try {
41360
+ if (this.watch) while (!signal?.aborted) {
41361
+ const hasChanged = this.hasChanged = Promise.withResolvers();
41362
+ this.caches.clear();
41363
+ const runOnce = async () => {
41364
+ await contextStorage.run(this, this.task);
41365
+ await hasChanged.promise;
41366
+ };
41367
+ await (signal ? abort_signal_race(signal, runOnce) : runOnce());
41557
41368
  }
41369
+ else await contextStorage.run(this, this.task);
41370
+ } finally {
41371
+ this.hasChanged?.reject(/* @__PURE__ */ new Error("Context ended"));
41372
+ this.hasChanged = void 0;
41373
+ this.isRunning = false;
41558
41374
  }
41559
- _a2 = NODE;
41560
- _brand3 = /* @__PURE__ */ new WeakSet();
41561
- brand_fn3 = function() {};
41562
- _assertSignals = /* @__PURE__ */ new WeakSet();
41563
- assertSignals_fn = function(signals$1) {
41564
- for (const signal of signals$1) if (!(0, Signal2.isComputed)(signal) && !(0, Signal2.isState)(signal)) throw new TypeError("Called watch/unwatch without a Computed or State argument");
41565
- };
41566
- Signal2.isWatcher = (w$2) => __privateIn(_brand3, w$2);
41567
- subtle2.Watcher = Watcher;
41568
- function currentComputed() {
41569
- var _a3;
41570
- return (_a3 = getActiveConsumer()) == null ? void 0 : _a3.wrapper;
41571
- }
41572
- subtle2.currentComputed = currentComputed;
41573
- subtle2.watched = Symbol("watched");
41574
- subtle2.unwatched = Symbol("unwatched");
41575
- })(Signal2.subtle || (Signal2.subtle = {}));
41576
- })(Signal || (Signal = {}));
41577
-
41578
- //#endregion
41579
- //#region ../../node_modules/.pnpm/signal-utils@0.21.1_signal-polyfill@0.2.2/node_modules/signal-utils/dist/subtle/microtask-effect.ts.js
41580
- let pending = false;
41581
- let watcher = new Signal.subtle.Watcher(() => {
41582
- if (!pending) {
41583
- pending = true;
41584
- queueMicrotask(() => {
41585
- pending = false;
41586
- flushPending();
41587
- });
41588
41375
  }
41589
- });
41590
- function flushPending() {
41591
- for (const signal of watcher.getPending()) signal.get();
41592
- watcher.watch();
41593
- }
41594
- /**
41595
- * ⚠️ WARNING: Nothing unwatches ⚠️
41596
- * This will produce a memory leak.
41597
- */
41598
- function effect(cb) {
41599
- let c$2 = new Signal.Computed(() => cb());
41600
- watcher.watch(c$2);
41601
- c$2.get();
41602
- return () => {
41603
- watcher.unwatch(c$2);
41604
- };
41605
- }
41376
+ };
41606
41377
 
41607
41378
  //#endregion
41608
41379
  //#region ../dev/dist/reactive-fs/reactive-fs.js
41380
+ var import_src$2 = __toESM$1(require_src$2(), 1);
41609
41381
  const ONCE_AC = createAcontext("ONCE", () => false);
41610
- const getFileState = (filepath, once$1 = ONCE_AC.get()) => {
41611
- const fileState = new Signal.State(readFileSync(filepath, "utf-8"));
41612
- if (!once$1) {
41613
- const off = effect(() => {
41614
- const watcher$1 = watch(filepath, () => {
41615
- try {
41616
- fileState.set(readFileSync(filepath, "utf-8"));
41617
- } catch {
41618
- console.log(`File ${filepath} not found, stopping watcher.`);
41619
- watcher$1.close();
41620
- off();
41621
- }
41622
- });
41382
+ const FILE_WATCH_OPTIONS_AC = createAcontext("FILE_WATCH_OPTIONS", () => ({}));
41383
+ const DIR_WATCH_OPTIONS_AC = createAcontext("DIR_WATCH_OPTIONS", () => ({}));
41384
+ const stateCache = /* @__PURE__ */ new Map();
41385
+ const debug$2 = (0, import_src$2.default)("jixo:reactive-fs-v2");
41386
+ const readFile = (filepath) => {
41387
+ filepath = path.resolve(filepath);
41388
+ const key$1 = `file:${filepath}`;
41389
+ const getValue = () => existsSync(filepath) ? readFileSync(filepath, "utf-8") : "";
41390
+ const fileState = map_get_or_put(stateCache, key$1, () => new ReactiveState(getValue()));
41391
+ if (!ONCE_AC.get()) {
41392
+ debug$2("watch file", filepath);
41393
+ const fileWatchOptions = FILE_WATCH_OPTIONS_AC.get();
41394
+ const watcher = watchFile(filepath, {
41395
+ ...fileWatchOptions,
41396
+ bigint: false
41397
+ }, () => {
41398
+ try {
41399
+ const changed = fileState.set(getValue());
41400
+ if (changed) debug$2("file changed", filepath);
41401
+ } catch {
41402
+ console.log(`File ${filepath} not found, stopping watcher.`);
41403
+ watcher.unref();
41404
+ }
41623
41405
  });
41624
41406
  }
41625
- return fileState;
41407
+ return fileState.get();
41626
41408
  };
41627
- const dirGlobState = (dirname$2, glob, once$1 = ONCE_AC.get()) => {
41628
- const dirState = new Signal.State(globbySync(glob, { cwd: dirname$2 }), { equals(t$1, t2) {
41629
- return t$1.length === t2.length && t$1.every((file$1, i$2) => file$1 === t2[i$2]);
41630
- } });
41631
- if (!once$1) {
41632
- const off = effect(async () => {
41633
- const sub = await parcelWatcher.subscribe(dirname$2, (err, events) => {
41634
- if (events.some((event) => event.type === "create" || event.type === "delete")) try {
41635
- dirState.set(globbySync(glob, { cwd: dirname$2 }));
41636
- } catch {
41637
- sub.unsubscribe();
41638
- off();
41639
- }
41640
- });
41409
+ const readDirByGlob = (dirname$2, glob = "*", globbyOptions) => {
41410
+ dirname$2 = path.resolve(dirname$2);
41411
+ const getValue = () => {
41412
+ return globbySync(glob, {
41413
+ cwd: dirname$2,
41414
+ ...globbyOptions
41415
+ });
41416
+ };
41417
+ const key$1 = `glob:${dirname$2}:${JSON.stringify(Array.isArray(glob) ? glob : [glob])}`;
41418
+ const globState = map_get_or_put(stateCache, key$1, () => new ReactiveState(getValue(), { equals: (a$1, b$1) => a$1.length === b$1.length && a$1.every((v$1, i$2) => v$1 === b$1[i$2]) }));
41419
+ if (!ONCE_AC.get()) {
41420
+ const dirWatchOptions = DIR_WATCH_OPTIONS_AC.get();
41421
+ debug$2("watch dir", dirname$2);
41422
+ const subp = parcelWatcher.subscribe(dirname$2, (err, events) => {
41423
+ if (events.some((event) => event.type === "create" || event.type === "delete")) try {
41424
+ const changed = globState.set(getValue());
41425
+ if (changed) debug$2("dir changed", dirname$2);
41426
+ } catch {
41427
+ subp.then((sub) => sub.unsubscribe());
41428
+ }
41429
+ }, dirWatchOptions);
41430
+ const freshList = globbySync(glob, {
41431
+ cwd: dirname$2,
41432
+ ...globbyOptions
41641
41433
  });
41434
+ globState.set(freshList);
41642
41435
  }
41643
- return dirState;
41436
+ return globState.get();
41644
41437
  };
41645
- const useReactiveFs = (run$1, opts) => {
41438
+ const useReactiveFs = (run$1, opts = {}) => {
41646
41439
  const once$1 = opts?.once ?? ONCE_AC.get();
41647
- const off = effect(() => {
41648
- ONCE_AC.run(once$1, run$1);
41440
+ const fileWatchOptions = opts?.fileWatchOptions ?? FILE_WATCH_OPTIONS_AC.get();
41441
+ const dirWatchOptions = opts?.dirWatchOptions ?? DIR_WATCH_OPTIONS_AC.get();
41442
+ const context = new ReactiveContext(run$1, !once$1);
41443
+ return useAcontexts([
41444
+ ONCE_AC,
41445
+ FILE_WATCH_OPTIONS_AC,
41446
+ DIR_WATCH_OPTIONS_AC
41447
+ ])([
41448
+ once$1,
41449
+ fileWatchOptions,
41450
+ dirWatchOptions
41451
+ ], () => {
41452
+ return context.run();
41649
41453
  });
41650
- if (once$1) {
41651
- off();
41652
- return () => {};
41653
- }
41654
- return off;
41655
41454
  };
41656
41455
  const reactiveFs = {
41657
- getFile: getFileState,
41658
- readDir: dirGlobState,
41456
+ readFile,
41457
+ readDirByGlob,
41659
41458
  use: useReactiveFs
41660
41459
  };
41661
41460
 
@@ -41787,7 +41586,7 @@ function useFileOrInject$1(mode, filepath, filecontent, opts = {}) {
41787
41586
  /**
41788
41587
  * Handles replacements for file-based sources like local file system, URLs, and internal jixo protocol.
41789
41588
  */
41790
- const handleFileReplacement = async ({ globOrFilepath, mode, params, once: once$1, rootResolver, baseDir }) => {
41589
+ const handleFileReplacement = async ({ globOrFilepath, mode, params, rootResolver, baseDir }) => {
41791
41590
  if (globOrFilepath.startsWith("jixo:")) {
41792
41591
  const jixo_url = new URL(globOrFilepath);
41793
41592
  const filepath = (jixo_url.pathname || jixo_url.hostname).replace(/^\//, "");
@@ -41828,7 +41627,7 @@ const handleFileReplacement = async ({ globOrFilepath, mode, params, once: once$
41828
41627
  } else for (const filepath of files$1) {
41829
41628
  const fullFilepath = rootResolver(filepath);
41830
41629
  if (!fs.statSync(fullFilepath).isFile()) continue;
41831
- const fileContent = getFileState(fullFilepath, once$1).get();
41630
+ const fileContent = reactiveFs.readFile(fullFilepath);
41832
41631
  const ext = path.parse(filepath).ext.slice(1);
41833
41632
  lines.push(useFileOrInject$1(mode, filepath, fileContent, {
41834
41633
  prefix: params.prefix,
@@ -42074,7 +41873,7 @@ async function gitWorkingContents(repoPath, options$1) {
42074
41873
  return async () => {
42075
41874
  results.set(filepath, {
42076
41875
  path: filepath,
42077
- content: status === "D" ? void 0 : await fs$1.readFile(path.join(repoPath, filepath), "utf-8"),
41876
+ content: status === "D" ? void 0 : await fsPromises.readFile(path.join(repoPath, filepath), "utf-8"),
42078
41877
  status
42079
41878
  });
42080
41879
  };
@@ -52960,10 +52759,10 @@ function removeMarkdownComments(markdownContent) {
52960
52759
 
52961
52760
  //#endregion
52962
52761
  //#region ../dev/dist/gen-prompt.js
52963
- var import_src = __toESM$1(require_src$2(), 1);
52762
+ var import_src$1 = __toESM$1(require_src$2(), 1);
52964
52763
  process.removeAllListeners("warning");
52965
- const debug = (0, import_src.default)("gen-prompt");
52966
- async function processReplacement(globOrFilepath, mode, paramString, once$1, rootResolver, baseDir) {
52764
+ const debug$1 = (0, import_src$1.default)("gen-prompt");
52765
+ async function processReplacement(globOrFilepath, mode, paramString, rootResolver, baseDir) {
52967
52766
  if (globOrFilepath.startsWith("`") && globOrFilepath.endsWith("`")) globOrFilepath = globOrFilepath.replace(/^`+(.*)`+$/, "$1");
52968
52767
  globOrFilepath = normalizeFilePath(globOrFilepath);
52969
52768
  const normalizedMode = mode.toUpperCase().replaceAll("-", "_").trim();
@@ -52972,11 +52771,10 @@ async function processReplacement(globOrFilepath, mode, paramString, once$1, roo
52972
52771
  globOrFilepath,
52973
52772
  mode: normalizedMode,
52974
52773
  params,
52975
- once: once$1,
52976
52774
  rootResolver,
52977
52775
  baseDir
52978
52776
  };
52979
- debug("Dispatching replacement for:", {
52777
+ debug$1("Dispatching replacement for:", {
52980
52778
  globOrFilepath,
52981
52779
  mode: normalizedMode,
52982
52780
  params
@@ -52984,9 +52782,9 @@ async function processReplacement(globOrFilepath, mode, paramString, once$1, roo
52984
52782
  if (mode.startsWith("GIT")) return handleGitReplacement(options$1);
52985
52783
  return handleFileReplacement(options$1);
52986
52784
  }
52987
- async function gen_prompt(input, once$1, _output, cwd) {
52785
+ async function gen_prompt(input, _output, cwd) {
52988
52786
  console.log(blue("gen_prompt"), input);
52989
- const inputSource = getFileState(input, once$1).get();
52787
+ const inputSource = reactiveFs.readFile(input);
52990
52788
  let { data: inputData, content: inputContent } = (0, import_gray_matter.default)(inputSource);
52991
52789
  inputContent = removeMarkdownComments(inputContent).trim();
52992
52790
  const currentRootResolver = z(cwd).with(N.string, (c$2) => createResolver(c$2)).otherwise(() => z(inputData.cwd).with(N.when((p$1) => p$1 && path.isAbsolute(p$1)), (p$1) => createResolver(p$1)).with(N.string, (p$1) => createResolver(path.resolve(path.dirname(input), p$1))).otherwise(() => createResolverByRootFile(input, ".git", () => path.dirname(input))));
@@ -52995,7 +52793,7 @@ async function gen_prompt(input, once$1, _output, cwd) {
52995
52793
  const matches = [...inputContent.matchAll(regex$1)];
52996
52794
  const replacementPromises = matches.map((match) => {
52997
52795
  const [_$1, globOrFilepath, mode, paramString] = match;
52998
- return processReplacement(globOrFilepath, mode, paramString, once$1, currentRootResolver, currentRootResolver.dirname);
52796
+ return processReplacement(globOrFilepath, mode, paramString, currentRootResolver, currentRootResolver.dirname);
52999
52797
  });
53000
52798
  const replacements$1 = await Promise.all(replacementPromises);
53001
52799
  let outputContent = inputContent;
@@ -53011,34 +52809,29 @@ async function gen_prompt(input, once$1, _output, cwd) {
53011
52809
  const doGenPrompts = async (argv) => {
53012
52810
  const once$1 = !argv.watch;
53013
52811
  const CWD = argv.cwd || process.cwd();
53014
- for (const input of argv.inputs) {
53015
- const resolvedInput = path.resolve(CWD, input);
53016
- if (isDynamicPattern(input)) {
53017
- const files$1 = globbySync(input, { cwd: CWD });
53018
- console.log(`Glob pattern '${input}' matched ${files$1.length} files.`);
53019
- for (const file$1 of files$1) await gen_prompt(file$1, once$1, void 0, CWD);
53020
- } else if (fs.existsSync(resolvedInput)) {
53021
- const stat$1 = fs.statSync(resolvedInput);
53022
- if (stat$1.isFile()) {
53023
- const off = effect(() => {
53024
- gen_prompt(resolvedInput, once$1, argv.outFile, CWD);
53025
- });
53026
- if (once$1) off();
53027
- } else if (stat$1.isDirectory()) {
53028
- console.log(`Processing directory '${input}' with glob '${argv.glob}'...`);
53029
- const off = effect(() => {
53030
- for (const filename of dirGlobState(resolvedInput, argv.glob, once$1).get()) gen_prompt(path.join(resolvedInput, filename), once$1, void 0, CWD);
53031
- });
53032
- if (once$1) off();
52812
+ if (argv.watch) console.log(gray("\nWatching for file changes... Press Ctrl+C to exit."));
52813
+ await reactiveFs.use(async () => {
52814
+ for (const input of argv.inputs) {
52815
+ const resolvedInput = path.resolve(CWD, input);
52816
+ if (isDynamicPattern(input)) {
52817
+ const files$1 = globbySync(input, { cwd: CWD });
52818
+ console.log(`Glob pattern '${input}' matched ${files$1.length} files.`);
52819
+ for (const file$1 of files$1) await gen_prompt(file$1, void 0, CWD);
52820
+ } else if (fs.existsSync(resolvedInput)) {
52821
+ const stat$1 = fs.statSync(resolvedInput);
52822
+ if (stat$1.isFile()) gen_prompt(resolvedInput, argv.outFile, CWD);
52823
+ else if (stat$1.isDirectory()) {
52824
+ console.log(`Processing directory '${input}' with glob '${argv.glob}'...`);
52825
+ for (const filename of reactiveFs.readDirByGlob(resolvedInput, argv.glob)) gen_prompt(path.join(resolvedInput, filename), void 0, CWD);
52826
+ }
52827
+ } else {
52828
+ console.warn(`Warning: Input path does not exist, but treating as a potential glob: ${input}`);
52829
+ const files$1 = reactiveFs.readDirByGlob(CWD, input);
52830
+ if (files$1.length > 0) for (const file$1 of files$1) await gen_prompt(file$1, void 0, CWD);
52831
+ else console.error(`Error: Input '${input}' not found and did not match any files.`);
53033
52832
  }
53034
- } else {
53035
- console.warn(`Warning: Input path does not exist, but treating as a potential glob: ${input}`);
53036
- const files$1 = globbySync(input, { cwd: CWD });
53037
- if (files$1.length > 0) for (const file$1 of files$1) await gen_prompt(file$1, once$1, void 0, CWD);
53038
- else console.error(`Error: Input '${input}' not found and did not match any files.`);
53039
52833
  }
53040
- }
53041
- if (argv.watch) console.log(gray("\nWatching for file changes... Press Ctrl+C to exit."));
52834
+ }, { once: once$1 });
53042
52835
  };
53043
52836
 
53044
52837
  //#endregion
@@ -62371,7 +62164,6 @@ const zContentSchema = looseObject$1({
62371
62164
  contents: array$1(object$1({
62372
62165
  role: string$2(),
62373
62166
  parts: array$1(union$1([
62374
- object$1({ isLast: boolean$2() }),
62375
62167
  object$1({
62376
62168
  isLast: boolean$2(),
62377
62169
  text: string$2()
@@ -62402,7 +62194,8 @@ const zContentSchema = looseObject$1({
62402
62194
  fileIndex: number$2(),
62403
62195
  fileName: string$2()
62404
62196
  })
62405
- })
62197
+ }),
62198
+ object$1({ isLast: boolean$2() })
62406
62199
  ])),
62407
62200
  isLast: optional$1(boolean$2())
62408
62201
  })),
@@ -62429,7 +62222,7 @@ const zContentSchema = looseObject$1({
62429
62222
  //#endregion
62430
62223
  //#region ../dev/dist/google-aistudio/node/index.js
62431
62224
  const doGoogleAiStudioAutomation = (dir = process.cwd()) => {
62432
- const watcher$1 = fs.watch(dir);
62225
+ const watcher = fs.watch(dir);
62433
62226
  const handle = func_debounce(async () => {
62434
62227
  const names = fs.readdirSync(dir);
62435
62228
  const contentNames = names.filter((name$1) => name$1.endsWith(".contents.json"));
@@ -62482,7 +62275,7 @@ const doGoogleAiStudioAutomation = (dir = process.cwd()) => {
62482
62275
  }
62483
62276
  }
62484
62277
  };
62485
- watcher$1.on("change", (eventType) => {
62278
+ watcher.on("change", (eventType) => {
62486
62279
  if (eventType === "delete" || eventType === "unlink") return;
62487
62280
  handle();
62488
62281
  });
@@ -63780,13 +63573,16 @@ var zod_default = external_exports;
63780
63573
 
63781
63574
  //#endregion
63782
63575
  //#region ../dev/dist/google-aistudio/jixo/sync.js
63576
+ var import_src = __toESM$1(require_src$2(), 1);
63577
+ const debug = (0, import_src.default)("jixo:go-sync");
63783
63578
  const sync = async (basePath, outDir) => {
63784
63579
  const s$2 = statSync(basePath);
63785
63580
  if (s$2.isDirectory()) {
63786
- for (const contentsJsonFile of reactiveFs.readDir(basePath, "*.contents.json").get()) sync(path.join(basePath, contentsJsonFile), outDir);
63581
+ for (const contentsJsonFile of reactiveFs.readDirByGlob(basePath, "*.contents.json")) await sync(path.join(basePath, contentsJsonFile), outDir);
63787
63582
  return;
63788
63583
  }
63789
- const rawContents = reactiveFs.getFile(basePath).get();
63584
+ debug("发现contents.json文件", basePath);
63585
+ const rawContents = reactiveFs.readFile(basePath);
63790
63586
  const safeContents = await zContentSchema.safeParseAsync((() => {
63791
63587
  try {
63792
63588
  return JSON.parse(rawContents);
@@ -63796,10 +63592,11 @@ const sync = async (basePath, outDir) => {
63796
63592
  console.error(safeContents.error.message);
63797
63593
  return;
63798
63594
  }
63799
- const contents = safeContents.data;
63595
+ const contentsData = safeContents.data;
63596
+ const { contents } = contentsData.generateContentParameters;
63800
63597
  let first_index = 0;
63801
63598
  let second_index = -1;
63802
- const modelHistory = iter_map_not_null(contents.generateContentParameters.contents, (content$2) => {
63599
+ const modelHistory = iter_map_not_null(contents, (content$2) => {
63803
63600
  if (content$2.role === "model") {
63804
63601
  const textParts = content$2.parts.filter((p$1) => "text" in p$1);
63805
63602
  return textParts.at(-1)?.text;
@@ -63835,10 +63632,19 @@ const sync = async (basePath, outDir) => {
63835
63632
  * @param args - 命令行参数,符合 yargs 解析后的结构
63836
63633
  */
63837
63634
  const doSync = (args) => {
63635
+ const targetPath = zod_default.string().safeParse(args._[0]).data ?? process.cwd();
63838
63636
  reactiveFs.use(async () => {
63839
- const targetPath = zod_default.string().safeParse(args._[0]).data ?? process.cwd();
63637
+ console.log(red("start"));
63638
+ await (async () => {
63639
+ await delay(100);
63640
+ console.log(reactiveFs.readFile(path.resolve(targetPath, "../package.json")).length);
63641
+ })();
63840
63642
  await sync(targetPath, args.outDir);
63841
- }, { once: !args.watch });
63643
+ console.log(red("end"));
63644
+ }, {
63645
+ once: !args.watch,
63646
+ fileWatchOptions: { interval: 500 }
63647
+ });
63842
63648
  if (args.watch) console.log(gray("\nWatching for file changes... Press Ctrl+C to exit."));
63843
63649
  };
63844
63650
 
@@ -63862,7 +63668,7 @@ const doInit = async ({ dir, force }) => {
63862
63668
  return;
63863
63669
  }
63864
63670
  if (force == null) {
63865
- const overwrite = await esm_default({
63671
+ const overwrite = await esm_default$1({
63866
63672
  message: [`the same file(s) name already exists. Are you sure you want to overwrite?`, ...logPaths()].join("\n"),
63867
63673
  default: false
63868
63674
  });
@@ -63924,15 +63730,22 @@ const initCommand = {
63924
63730
  describe: "init an browser-kit directory for aistudio.google.com",
63925
63731
  builder: (yargs) => yargs.positional("dir", {
63926
63732
  describe: "Directory for aistudio input/output contents",
63927
- type: "string",
63928
- default: path.resolve(process.cwd(), ".ai")
63733
+ type: "string"
63929
63734
  }).option("force", {
63930
63735
  alias: "F",
63931
63736
  type: "boolean",
63932
63737
  describe: "override exits files"
63933
63738
  }),
63934
63739
  handler: async (argv) => {
63935
- doInit(argv);
63740
+ let { dir } = argv;
63741
+ if (dir == null) dir = await esm_default({
63742
+ message: "No directory specified. Do you want to use the default '.ai' directory?",
63743
+ default: ".ai"
63744
+ });
63745
+ doInit({
63746
+ ...argv,
63747
+ dir
63748
+ });
63936
63749
  }
63937
63750
  };
63938
63751
  /**