@jixo/cli 0.23.5 → 0.23.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundle/index.js +398 -278
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +83 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/daemon.d.ts +5 -0
- package/dist/commands/daemon.d.ts.map +1 -0
- package/dist/commands/daemon.js +20 -0
- package/dist/commands/daemon.js.map +1 -0
- package/dist/commands/doctor/config.d.ts +3 -0
- package/dist/commands/doctor/config.d.ts.map +1 -0
- package/dist/commands/doctor/config.js +17 -0
- package/dist/commands/doctor/config.js.map +1 -0
- package/dist/commands/doctor/doctor.d.ts +3 -0
- package/dist/commands/doctor/doctor.d.ts.map +1 -0
- package/dist/commands/doctor/doctor.js +158 -0
- package/dist/commands/doctor/doctor.js.map +1 -0
- package/dist/commands/doctor/doctor.test.d.ts +2 -0
- package/dist/commands/doctor/doctor.test.d.ts.map +1 -0
- package/dist/commands/doctor/doctor.test.js +14 -0
- package/dist/commands/doctor/doctor.test.js.map +1 -0
- package/dist/commands/doctor/index.d.ts +2 -0
- package/dist/commands/doctor/index.d.ts.map +1 -0
- package/dist/commands/doctor/index.js +8 -0
- package/dist/commands/doctor/index.js.map +1 -0
- package/dist/commands/doctor/types.d.ts +45 -0
- package/dist/commands/doctor/types.d.ts.map +1 -0
- package/dist/commands/doctor/types.js +3 -0
- package/dist/commands/doctor/types.js.map +1 -0
- package/dist/commands/google-aistudio.d.ts.map +1 -1
- package/dist/commands/google-aistudio.js +21 -5
- package/dist/commands/google-aistudio.js.map +1 -1
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +40 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/tasks/run.d.ts +10 -0
- package/dist/commands/tasks/run.d.ts.map +1 -0
- package/dist/commands/tasks/run.js +44 -0
- package/dist/commands/tasks/run.js.map +1 -0
- package/dist/config.d.ts +15 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +23 -0
- package/dist/config.js.map +1 -0
- package/dist/env.d.ts +6 -0
- package/dist/env.d.ts.map +1 -0
- package/dist/env.js +16 -0
- package/dist/env.js.map +1 -0
- package/dist/prompts.json +14 -2
- package/package.json +3 -3
- package/assets/bundle/google-aistudio.node.js +0 -1192
package/bundle/index.js
CHANGED
|
@@ -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$
|
|
16
|
+
import * as fs$2 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
|
|
26
|
+
import fs$1, { 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";
|
|
@@ -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$
|
|
1279
|
-
Object.keys(env$
|
|
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$
|
|
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
|
|
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
|
|
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$
|
|
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$
|
|
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.
|
|
4691
|
+
var version$1 = "0.23.7";
|
|
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_@
|
|
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_@
|
|
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;
|
|
@@ -5281,19 +5281,6 @@ const iter_map_not_null = (values, callbackfn) => {
|
|
|
5281
5281
|
else for (const value of values) if (value != null) result.push(value);
|
|
5282
5282
|
return result;
|
|
5283
5283
|
};
|
|
5284
|
-
/**
|
|
5285
|
-
* 类似与 map not null,但只取第一个
|
|
5286
|
-
*
|
|
5287
|
-
* 支持任何可迭代的对象
|
|
5288
|
-
*/
|
|
5289
|
-
const iter_first_not_null = (values, callbackfn) => {
|
|
5290
|
-
let index$1 = 0;
|
|
5291
|
-
if (callbackfn) for (const value of values) {
|
|
5292
|
-
const r$1 = callbackfn(value, index$1++, values);
|
|
5293
|
-
if (r$1 != null) return r$1;
|
|
5294
|
-
}
|
|
5295
|
-
else for (const value of values) if (value != null) return value;
|
|
5296
|
-
};
|
|
5297
5284
|
|
|
5298
5285
|
//#endregion
|
|
5299
5286
|
//#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/pure_event.js
|
|
@@ -5929,31 +5916,33 @@ const abort_signal_race = (signal, fn_or_promise) => {
|
|
|
5929
5916
|
};
|
|
5930
5917
|
|
|
5931
5918
|
//#endregion
|
|
5932
|
-
//#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/
|
|
5933
|
-
const
|
|
5934
|
-
if (!Number.isFinite(wait)) throw new TypeError("Expected `wait` to be a finite number");
|
|
5919
|
+
//#region ../../node_modules/.pnpm/@gaubee+util@0.34.2/node_modules/@gaubee/util/esm/throttle.js
|
|
5920
|
+
const func_throttle = (fn, wait = 0, options$1 = {}) => {
|
|
5935
5921
|
const timmer = timmers.from(wait);
|
|
5936
|
-
let leadingValue;
|
|
5937
5922
|
let clear;
|
|
5938
|
-
let
|
|
5939
|
-
let
|
|
5940
|
-
return obj_assign_props(function(...args) {
|
|
5923
|
+
let jobs = [];
|
|
5924
|
+
let target;
|
|
5925
|
+
return obj_assign_props(function throttled(...args) {
|
|
5941
5926
|
const job = Promise.withResolvers();
|
|
5942
|
-
|
|
5943
|
-
|
|
5944
|
-
|
|
5945
|
-
|
|
5946
|
-
|
|
5947
|
-
|
|
5948
|
-
|
|
5949
|
-
|
|
5950
|
-
|
|
5951
|
-
|
|
5952
|
-
|
|
5953
|
-
|
|
5954
|
-
|
|
5955
|
-
|
|
5956
|
-
|
|
5927
|
+
if (clear == null) {
|
|
5928
|
+
clear = timmer(target = async () => {
|
|
5929
|
+
target = void 0;
|
|
5930
|
+
if (!options$1.waitPromise) clear = void 0;
|
|
5931
|
+
const res = await func_catch(() => fn.apply(this, args))();
|
|
5932
|
+
if (options$1.waitPromise) clear = void 0;
|
|
5933
|
+
if (res.success) for (const job$1 of jobs) job$1.resolve(res.result);
|
|
5934
|
+
else for (const job$1 of jobs) job$1.reject(res.error);
|
|
5935
|
+
jobs = [];
|
|
5936
|
+
}, (reason) => {
|
|
5937
|
+
for (const job$1 of jobs) job$1.reject(reason);
|
|
5938
|
+
});
|
|
5939
|
+
if (options$1.before) (async () => {
|
|
5940
|
+
const res = await func_catch(() => fn.apply(this, args))();
|
|
5941
|
+
if (res.success) job.resolve(res.result);
|
|
5942
|
+
else job.reject(res.error);
|
|
5943
|
+
})();
|
|
5944
|
+
else jobs.push(job);
|
|
5945
|
+
} else jobs.push(job);
|
|
5957
5946
|
return job.promise;
|
|
5958
5947
|
}, {
|
|
5959
5948
|
get isPending() {
|
|
@@ -5961,13 +5950,13 @@ const func_debounce = (fn, wait = 0, options$1 = {}) => {
|
|
|
5961
5950
|
},
|
|
5962
5951
|
cancel() {
|
|
5963
5952
|
clear?.();
|
|
5953
|
+
clear = void 0;
|
|
5964
5954
|
},
|
|
5965
5955
|
source: fn,
|
|
5966
5956
|
flush() {
|
|
5967
|
-
|
|
5968
|
-
|
|
5969
|
-
|
|
5970
|
-
}
|
|
5957
|
+
clear?.();
|
|
5958
|
+
clear = void 0;
|
|
5959
|
+
target?.();
|
|
5971
5960
|
}
|
|
5972
5961
|
});
|
|
5973
5962
|
};
|
|
@@ -6014,7 +6003,7 @@ const createResolverByRootFile = (fromPath = process$1.cwd(), rootFilename = "pa
|
|
|
6014
6003
|
};
|
|
6015
6004
|
|
|
6016
6005
|
//#endregion
|
|
6017
|
-
//#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@
|
|
6006
|
+
//#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
|
|
6018
6007
|
/**
|
|
6019
6008
|
* Converts a JSON with Comments (JSONC) string into an object.
|
|
6020
6009
|
*
|
|
@@ -6240,7 +6229,7 @@ function buildErrorMessage({ type: type$1, sourceText, position: position$1 }) {
|
|
|
6240
6229
|
}
|
|
6241
6230
|
|
|
6242
6231
|
//#endregion
|
|
6243
|
-
//#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@
|
|
6232
|
+
//#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gau_ac796b2c5c73dab9bab91ba9e75b6834/node_modules/@gaubee/nodekit/esm/config_file.js
|
|
6244
6233
|
/**
|
|
6245
6234
|
* read json or jsonc file
|
|
6246
6235
|
*/
|
|
@@ -6354,7 +6343,7 @@ var require_is_extendable = __commonJS$2({ "../../node_modules/.pnpm/is-extendab
|
|
|
6354
6343
|
//#region ../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js
|
|
6355
6344
|
var require_extend_shallow = __commonJS$2({ "../../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js"(exports, module) {
|
|
6356
6345
|
var isObject$5 = require_is_extendable();
|
|
6357
|
-
module.exports = function extend$
|
|
6346
|
+
module.exports = function extend$4(o$1) {
|
|
6358
6347
|
if (!isObject$5(o$1)) o$1 = {};
|
|
6359
6348
|
var len = arguments.length;
|
|
6360
6349
|
for (var i$2 = 1; i$2 < len; i$2++) {
|
|
@@ -6378,7 +6367,7 @@ var require_extend_shallow = __commonJS$2({ "../../node_modules/.pnpm/extend-sha
|
|
|
6378
6367
|
//#region ../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js
|
|
6379
6368
|
var require_section_matter = __commonJS$2({ "../../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js"(exports, module) {
|
|
6380
6369
|
var typeOf$3 = require_kind_of();
|
|
6381
|
-
var extend$
|
|
6370
|
+
var extend$3 = require_extend_shallow();
|
|
6382
6371
|
/**
|
|
6383
6372
|
* Parse sections in `input` with the given `options`.
|
|
6384
6373
|
*
|
|
@@ -6399,7 +6388,7 @@ var require_section_matter = __commonJS$2({ "../../node_modules/.pnpm/section-ma
|
|
|
6399
6388
|
section_delimiter: "---",
|
|
6400
6389
|
parse: identity
|
|
6401
6390
|
};
|
|
6402
|
-
var opts = extend$
|
|
6391
|
+
var opts = extend$3({}, defaults$4, options$1);
|
|
6403
6392
|
var delim = opts.section_delimiter;
|
|
6404
6393
|
var lines = file$1.content.split(/\r?\n/);
|
|
6405
6394
|
var sections$1 = null;
|
|
@@ -6494,7 +6483,7 @@ var require_common$4 = __commonJS$2({ "../../node_modules/.pnpm/js-yaml@3.14.1/n
|
|
|
6494
6483
|
else if (isNothing(sequence)) return [];
|
|
6495
6484
|
return [sequence];
|
|
6496
6485
|
}
|
|
6497
|
-
function extend$
|
|
6486
|
+
function extend$2(target, source$1) {
|
|
6498
6487
|
var index$1, length, key$1, sourceKeys;
|
|
6499
6488
|
if (source$1) {
|
|
6500
6489
|
sourceKeys = Object.keys(source$1);
|
|
@@ -6518,7 +6507,7 @@ var require_common$4 = __commonJS$2({ "../../node_modules/.pnpm/js-yaml@3.14.1/n
|
|
|
6518
6507
|
module.exports.toArray = toArray;
|
|
6519
6508
|
module.exports.repeat = repeat;
|
|
6520
6509
|
module.exports.isNegativeZero = isNegativeZero;
|
|
6521
|
-
module.exports.extend = extend$
|
|
6510
|
+
module.exports.extend = extend$2;
|
|
6522
6511
|
} });
|
|
6523
6512
|
|
|
6524
6513
|
//#endregion
|
|
@@ -8976,7 +8965,7 @@ var require_parse$3 = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4.0.3
|
|
|
8976
8965
|
//#endregion
|
|
8977
8966
|
//#region ../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js
|
|
8978
8967
|
var require_gray_matter = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports, module) {
|
|
8979
|
-
const fs$
|
|
8968
|
+
const fs$10 = __require$1("fs");
|
|
8980
8969
|
const sections = require_section_matter();
|
|
8981
8970
|
const defaults = require_defaults();
|
|
8982
8971
|
const stringify$4 = require_stringify$2();
|
|
@@ -9101,7 +9090,7 @@ var require_gray_matter = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4
|
|
|
9101
9090
|
* @api public
|
|
9102
9091
|
*/
|
|
9103
9092
|
matter$2.read = function(filepath, options$1) {
|
|
9104
|
-
const str = fs$
|
|
9093
|
+
const str = fs$10.readFileSync(filepath, "utf8");
|
|
9105
9094
|
const file$1 = matter$2(str, options$1);
|
|
9106
9095
|
file$1.path = filepath;
|
|
9107
9096
|
return file$1;
|
|
@@ -9144,7 +9133,7 @@ var require_gray_matter = __commonJS$2({ "../../node_modules/.pnpm/gray-matter@4
|
|
|
9144
9133
|
} });
|
|
9145
9134
|
|
|
9146
9135
|
//#endregion
|
|
9147
|
-
//#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@
|
|
9136
|
+
//#region ../../node_modules/.pnpm/@gaubee+nodekit@0.12.0_@gau_ac796b2c5c73dab9bab91ba9e75b6834/node_modules/@gaubee/nodekit/esm/markdown_file.js
|
|
9148
9137
|
var import_gray_matter = __toESM$1(require_gray_matter(), 1);
|
|
9149
9138
|
|
|
9150
9139
|
//#endregion
|
|
@@ -9395,6 +9384,7 @@ var require_ignore$1 = __commonJS$2({ "../../node_modules/.pnpm/ignore@7.0.5/nod
|
|
|
9395
9384
|
const isUpKey = (key$1) => key$1.name === "up" || key$1.name === "k" || key$1.ctrl && key$1.name === "p";
|
|
9396
9385
|
const isDownKey = (key$1) => key$1.name === "down" || key$1.name === "j" || key$1.ctrl && key$1.name === "n";
|
|
9397
9386
|
const isSpaceKey = (key$1) => key$1.name === "space";
|
|
9387
|
+
const isBackspaceKey = (key$1) => key$1.name === "backspace";
|
|
9398
9388
|
const isNumberKey = (key$1) => "1234567890".includes(key$1.name);
|
|
9399
9389
|
const isEnterKey = (key$1) => key$1.name === "enter" || key$1.name === "return";
|
|
9400
9390
|
|
|
@@ -9552,8 +9542,8 @@ function useEffect(cb, depArray) {
|
|
|
9552
9542
|
//#endregion
|
|
9553
9543
|
//#region ../../node_modules/.pnpm/yoctocolors-cjs@2.1.2/node_modules/yoctocolors-cjs/index.js
|
|
9554
9544
|
var require_yoctocolors_cjs = __commonJS$2({ "../../node_modules/.pnpm/yoctocolors-cjs@2.1.2/node_modules/yoctocolors-cjs/index.js"(exports, module) {
|
|
9555
|
-
const tty$
|
|
9556
|
-
const hasColors = tty$
|
|
9545
|
+
const tty$1 = __require$1("node:tty");
|
|
9546
|
+
const hasColors = tty$1?.WriteStream?.prototype?.hasColors?.() ?? false;
|
|
9557
9547
|
const format$1 = (open, close) => {
|
|
9558
9548
|
if (!hasColors) return (input) => input;
|
|
9559
9549
|
const openCode = `\u001B[${open}m`;
|
|
@@ -9902,7 +9892,7 @@ const fallbackSymbols = {
|
|
|
9902
9892
|
};
|
|
9903
9893
|
const shouldUseMain = isUnicodeSupported();
|
|
9904
9894
|
const figures = shouldUseMain ? mainSymbols : fallbackSymbols;
|
|
9905
|
-
var esm_default$
|
|
9895
|
+
var esm_default$2 = figures;
|
|
9906
9896
|
const replacements = Object.entries(specialMainSymbols);
|
|
9907
9897
|
|
|
9908
9898
|
//#endregion
|
|
@@ -9911,7 +9901,7 @@ var import_yoctocolors_cjs$2 = __toESM$1(require_yoctocolors_cjs(), 1);
|
|
|
9911
9901
|
const defaultTheme = {
|
|
9912
9902
|
prefix: {
|
|
9913
9903
|
idle: import_yoctocolors_cjs$2.default.blue("?"),
|
|
9914
|
-
done: import_yoctocolors_cjs$2.default.green(esm_default$
|
|
9904
|
+
done: import_yoctocolors_cjs$2.default.green(esm_default$2.tick)
|
|
9915
9905
|
},
|
|
9916
9906
|
spinner: {
|
|
9917
9907
|
interval: 80,
|
|
@@ -12721,7 +12711,7 @@ var import_yoctocolors_cjs$1 = __toESM$1(require_yoctocolors_cjs(), 1);
|
|
|
12721
12711
|
* Used to space/separate choices group
|
|
12722
12712
|
*/
|
|
12723
12713
|
var Separator = class {
|
|
12724
|
-
separator = import_yoctocolors_cjs$1.default.dim(Array.from({ length: 15 }).join(esm_default$
|
|
12714
|
+
separator = import_yoctocolors_cjs$1.default.dim(Array.from({ length: 15 }).join(esm_default$2.line));
|
|
12725
12715
|
type = "separator";
|
|
12726
12716
|
constructor(separator) {
|
|
12727
12717
|
if (separator) this.separator = separator;
|
|
@@ -12737,9 +12727,9 @@ var import_yoctocolors_cjs = __toESM$1(require_yoctocolors_cjs(), 1);
|
|
|
12737
12727
|
var import_ansi_escapes = __toESM$1(require_ansi_escapes(), 1);
|
|
12738
12728
|
const checkboxTheme = {
|
|
12739
12729
|
icon: {
|
|
12740
|
-
checked: import_yoctocolors_cjs.default.green(esm_default$
|
|
12741
|
-
unchecked: esm_default$
|
|
12742
|
-
cursor: esm_default$
|
|
12730
|
+
checked: import_yoctocolors_cjs.default.green(esm_default$2.circleFilled),
|
|
12731
|
+
unchecked: esm_default$2.circle,
|
|
12732
|
+
cursor: esm_default$2.pointer
|
|
12743
12733
|
},
|
|
12744
12734
|
style: {
|
|
12745
12735
|
disabledChoice: (text$2) => import_yoctocolors_cjs.default.dim(`- ${text$2}`),
|
|
@@ -12790,7 +12780,7 @@ function normalizeChoices(choices) {
|
|
|
12790
12780
|
return normalizedChoice;
|
|
12791
12781
|
});
|
|
12792
12782
|
}
|
|
12793
|
-
var esm_default$
|
|
12783
|
+
var esm_default$3 = createPrompt((config$1, done) => {
|
|
12794
12784
|
const { instructions, pageSize = 7, loop = true, required: required$1, validate: validate$1 = () => true } = config$1;
|
|
12795
12785
|
const shortcuts = {
|
|
12796
12786
|
all: "a",
|
|
@@ -12918,7 +12908,7 @@ function getBooleanValue(value, defaultValue) {
|
|
|
12918
12908
|
function boolToString(value) {
|
|
12919
12909
|
return value ? "Yes" : "No";
|
|
12920
12910
|
}
|
|
12921
|
-
var esm_default = createPrompt((config$1, done) => {
|
|
12911
|
+
var esm_default$1 = createPrompt((config$1, done) => {
|
|
12922
12912
|
const { transformer = boolToString } = config$1;
|
|
12923
12913
|
const [status, setStatus] = useState("idle");
|
|
12924
12914
|
const [value, setValue] = useState("");
|
|
@@ -12948,6 +12938,69 @@ var esm_default = createPrompt((config$1, done) => {
|
|
|
12948
12938
|
return `${prefix} ${message}${defaultValue} ${formattedValue}`;
|
|
12949
12939
|
});
|
|
12950
12940
|
|
|
12941
|
+
//#endregion
|
|
12942
|
+
//#region ../../node_modules/.pnpm/@inquirer+input@4.2.1_@types+node@24.1.0/node_modules/@inquirer/input/dist/esm/index.js
|
|
12943
|
+
const inputTheme = { validationFailureMode: "keep" };
|
|
12944
|
+
var esm_default = createPrompt((config$1, done) => {
|
|
12945
|
+
const { required: required$1, validate: validate$1 = () => true, prefill = "tab" } = config$1;
|
|
12946
|
+
const theme = makeTheme(inputTheme, config$1.theme);
|
|
12947
|
+
const [status, setStatus] = useState("idle");
|
|
12948
|
+
const [defaultValue = "", setDefaultValue] = useState(config$1.default);
|
|
12949
|
+
const [errorMsg, setError] = useState();
|
|
12950
|
+
const [value, setValue] = useState("");
|
|
12951
|
+
const prefix = usePrefix({
|
|
12952
|
+
status,
|
|
12953
|
+
theme
|
|
12954
|
+
});
|
|
12955
|
+
useKeypress(async (key$1, rl) => {
|
|
12956
|
+
if (status !== "idle") return;
|
|
12957
|
+
if (isEnterKey(key$1)) {
|
|
12958
|
+
const answer = value || defaultValue;
|
|
12959
|
+
setStatus("loading");
|
|
12960
|
+
const isValid = required$1 && !answer ? "You must provide a value" : await validate$1(answer);
|
|
12961
|
+
if (isValid === true) {
|
|
12962
|
+
setValue(answer);
|
|
12963
|
+
setStatus("done");
|
|
12964
|
+
done(answer);
|
|
12965
|
+
} else {
|
|
12966
|
+
if (theme.validationFailureMode === "clear") setValue("");
|
|
12967
|
+
else rl.write(value);
|
|
12968
|
+
setError(isValid || "You must provide a valid value");
|
|
12969
|
+
setStatus("idle");
|
|
12970
|
+
}
|
|
12971
|
+
} else if (isBackspaceKey(key$1) && !value) setDefaultValue(void 0);
|
|
12972
|
+
else if (key$1.name === "tab" && !value) {
|
|
12973
|
+
setDefaultValue(void 0);
|
|
12974
|
+
rl.clearLine(0);
|
|
12975
|
+
rl.write(defaultValue);
|
|
12976
|
+
setValue(defaultValue);
|
|
12977
|
+
} else {
|
|
12978
|
+
setValue(rl.line);
|
|
12979
|
+
setError(void 0);
|
|
12980
|
+
}
|
|
12981
|
+
});
|
|
12982
|
+
useEffect((rl) => {
|
|
12983
|
+
if (prefill === "editable" && defaultValue) {
|
|
12984
|
+
rl.write(defaultValue);
|
|
12985
|
+
setValue(defaultValue);
|
|
12986
|
+
}
|
|
12987
|
+
}, []);
|
|
12988
|
+
const message = theme.style.message(config$1.message, status);
|
|
12989
|
+
let formattedValue = value;
|
|
12990
|
+
if (typeof config$1.transformer === "function") formattedValue = config$1.transformer(value, { isFinal: status === "done" });
|
|
12991
|
+
else if (status === "done") formattedValue = theme.style.answer(value);
|
|
12992
|
+
let defaultStr;
|
|
12993
|
+
if (defaultValue && status !== "done" && !value) defaultStr = theme.style.defaultAnswer(defaultValue);
|
|
12994
|
+
let error$41 = "";
|
|
12995
|
+
if (errorMsg) error$41 = theme.style.error(errorMsg);
|
|
12996
|
+
return [[
|
|
12997
|
+
prefix,
|
|
12998
|
+
message,
|
|
12999
|
+
defaultStr,
|
|
13000
|
+
formattedValue
|
|
13001
|
+
].filter((v$1) => v$1 !== void 0).join(" "), error$41];
|
|
13002
|
+
});
|
|
13003
|
+
|
|
12951
13004
|
//#endregion
|
|
12952
13005
|
//#region ../../node_modules/.pnpm/@sindresorhus+merge-streams@2.3.0/node_modules/@sindresorhus/merge-streams/index.js
|
|
12953
13006
|
function mergeStreams(streams) {
|
|
@@ -13159,9 +13212,9 @@ var require_fs$4 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/node
|
|
|
13159
13212
|
var require_path$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/utils/path.js"(exports) {
|
|
13160
13213
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13161
13214
|
exports.convertPosixPathToPattern = exports.convertWindowsPathToPattern = exports.convertPathToPattern = exports.escapePosixPath = exports.escapeWindowsPath = exports.escape = exports.removeLeadingDotSegment = exports.makeAbsolute = exports.unixify = void 0;
|
|
13162
|
-
const os$
|
|
13215
|
+
const os$1 = __require$1("os");
|
|
13163
13216
|
const path$11 = __require$1("path");
|
|
13164
|
-
const IS_WINDOWS_PLATFORM = os$
|
|
13217
|
+
const IS_WINDOWS_PLATFORM = os$1.platform() === "win32";
|
|
13165
13218
|
const LEADING_DOT_SEGMENT_CHARACTERS_COUNT = 2;
|
|
13166
13219
|
/**
|
|
13167
13220
|
* All non-escaped special characters.
|
|
@@ -16833,8 +16886,8 @@ var require_utils$2 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/n
|
|
|
16833
16886
|
exports.array = array$3;
|
|
16834
16887
|
const errno = require_errno$1();
|
|
16835
16888
|
exports.errno = errno;
|
|
16836
|
-
const fs$
|
|
16837
|
-
exports.fs = fs$
|
|
16889
|
+
const fs$9 = require_fs$4();
|
|
16890
|
+
exports.fs = fs$9;
|
|
16838
16891
|
const path$6 = require_path$1();
|
|
16839
16892
|
exports.path = path$6;
|
|
16840
16893
|
const pattern = require_pattern$1();
|
|
@@ -17006,12 +17059,12 @@ var require_sync$6 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.stat@2
|
|
|
17006
17059
|
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) {
|
|
17007
17060
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17008
17061
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
17009
|
-
const fs$
|
|
17062
|
+
const fs$8 = __require$1("fs");
|
|
17010
17063
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
17011
|
-
lstat: fs$
|
|
17012
|
-
stat: fs$
|
|
17013
|
-
lstatSync: fs$
|
|
17014
|
-
statSync: fs$
|
|
17064
|
+
lstat: fs$8.lstat,
|
|
17065
|
+
stat: fs$8.stat,
|
|
17066
|
+
lstatSync: fs$8.lstatSync,
|
|
17067
|
+
statSync: fs$8.statSync
|
|
17015
17068
|
};
|
|
17016
17069
|
function createFileSystemAdapter$1(fsMethods) {
|
|
17017
17070
|
if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
|
|
@@ -17024,12 +17077,12 @@ var require_fs$3 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0
|
|
|
17024
17077
|
//#region ../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js
|
|
17025
17078
|
var require_settings$4 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.stat@2.0.5/node_modules/@nodelib/fs.stat/out/settings.js"(exports) {
|
|
17026
17079
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17027
|
-
const fs$
|
|
17080
|
+
const fs$7 = require_fs$3();
|
|
17028
17081
|
var Settings$3 = class {
|
|
17029
17082
|
constructor(_options = {}) {
|
|
17030
17083
|
this._options = _options;
|
|
17031
17084
|
this.followSymbolicLink = this._getValue(this._options.followSymbolicLink, true);
|
|
17032
|
-
this.fs = fs$
|
|
17085
|
+
this.fs = fs$7.createFileSystemAdapter(this._options.fs);
|
|
17033
17086
|
this.markSymbolicLink = this._getValue(this._options.markSymbolicLink, false);
|
|
17034
17087
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
17035
17088
|
}
|
|
@@ -17169,8 +17222,8 @@ var require_fs$2 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.scandir@
|
|
|
17169
17222
|
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) {
|
|
17170
17223
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17171
17224
|
exports.fs = void 0;
|
|
17172
|
-
const fs$
|
|
17173
|
-
exports.fs = fs$
|
|
17225
|
+
const fs$6 = require_fs$2();
|
|
17226
|
+
exports.fs = fs$6;
|
|
17174
17227
|
} });
|
|
17175
17228
|
|
|
17176
17229
|
//#endregion
|
|
@@ -17348,14 +17401,14 @@ var require_sync$5 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.scandi
|
|
|
17348
17401
|
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) {
|
|
17349
17402
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17350
17403
|
exports.createFileSystemAdapter = exports.FILE_SYSTEM_ADAPTER = void 0;
|
|
17351
|
-
const fs$
|
|
17404
|
+
const fs$5 = __require$1("fs");
|
|
17352
17405
|
exports.FILE_SYSTEM_ADAPTER = {
|
|
17353
|
-
lstat: fs$
|
|
17354
|
-
stat: fs$
|
|
17355
|
-
lstatSync: fs$
|
|
17356
|
-
statSync: fs$
|
|
17357
|
-
readdir: fs$
|
|
17358
|
-
readdirSync: fs$
|
|
17406
|
+
lstat: fs$5.lstat,
|
|
17407
|
+
stat: fs$5.stat,
|
|
17408
|
+
lstatSync: fs$5.lstatSync,
|
|
17409
|
+
statSync: fs$5.statSync,
|
|
17410
|
+
readdir: fs$5.readdir,
|
|
17411
|
+
readdirSync: fs$5.readdirSync
|
|
17359
17412
|
};
|
|
17360
17413
|
function createFileSystemAdapter(fsMethods) {
|
|
17361
17414
|
if (fsMethods === void 0) return exports.FILE_SYSTEM_ADAPTER;
|
|
@@ -17370,12 +17423,12 @@ var require_settings$3 = __commonJS$2({ "../../node_modules/.pnpm/@nodelib+fs.sc
|
|
|
17370
17423
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17371
17424
|
const path$5 = __require$1("path");
|
|
17372
17425
|
const fsStat$3 = require_out$4();
|
|
17373
|
-
const fs$
|
|
17426
|
+
const fs$4 = require_fs$1();
|
|
17374
17427
|
var Settings$2 = class {
|
|
17375
17428
|
constructor(_options = {}) {
|
|
17376
17429
|
this._options = _options;
|
|
17377
17430
|
this.followSymbolicLinks = this._getValue(this._options.followSymbolicLinks, false);
|
|
17378
|
-
this.fs = fs$
|
|
17431
|
+
this.fs = fs$4.createFileSystemAdapter(this._options.fs);
|
|
17379
17432
|
this.pathSegmentSeparator = this._getValue(this._options.pathSegmentSeparator, path$5.sep);
|
|
17380
17433
|
this.stats = this._getValue(this._options.stats, false);
|
|
17381
17434
|
this.throwErrorOnBrokenSymbolicLink = this._getValue(this._options.throwErrorOnBrokenSymbolicLink, true);
|
|
@@ -18568,20 +18621,20 @@ var require_sync$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/no
|
|
|
18568
18621
|
var require_settings$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/node_modules/fast-glob/out/settings.js"(exports) {
|
|
18569
18622
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18570
18623
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
18571
|
-
const fs$
|
|
18572
|
-
const os
|
|
18624
|
+
const fs$3 = __require$1("fs");
|
|
18625
|
+
const os = __require$1("os");
|
|
18573
18626
|
/**
|
|
18574
18627
|
* The `os.cpus` method can return zero. We expect the number of cores to be greater than zero.
|
|
18575
18628
|
* https://github.com/nodejs/node/blob/7faeddf23a98c53896f8b574a6e66589e8fb1eb8/lib/os.js#L106-L107
|
|
18576
18629
|
*/
|
|
18577
|
-
const CPU_COUNT = Math.max(os
|
|
18630
|
+
const CPU_COUNT = Math.max(os.cpus().length, 1);
|
|
18578
18631
|
exports.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
18579
|
-
lstat: fs$
|
|
18580
|
-
lstatSync: fs$
|
|
18581
|
-
stat: fs$
|
|
18582
|
-
statSync: fs$
|
|
18583
|
-
readdir: fs$
|
|
18584
|
-
readdirSync: fs$
|
|
18632
|
+
lstat: fs$3.lstat,
|
|
18633
|
+
lstatSync: fs$3.lstatSync,
|
|
18634
|
+
stat: fs$3.stat,
|
|
18635
|
+
statSync: fs$3.statSync,
|
|
18636
|
+
readdir: fs$3.readdir,
|
|
18637
|
+
readdirSync: fs$3.readdirSync
|
|
18585
18638
|
};
|
|
18586
18639
|
var Settings = class {
|
|
18587
18640
|
constructor(_options = {}) {
|
|
@@ -18728,7 +18781,7 @@ var require_out$1 = __commonJS$2({ "../../node_modules/.pnpm/fast-glob@3.3.3/nod
|
|
|
18728
18781
|
async function isType(fsStatType, statsMethodName, filePath) {
|
|
18729
18782
|
if (typeof filePath !== "string") throw new TypeError(`Expected a string, got ${typeof filePath}`);
|
|
18730
18783
|
try {
|
|
18731
|
-
const stats = await
|
|
18784
|
+
const stats = await fs$1[fsStatType](filePath);
|
|
18732
18785
|
return stats[statsMethodName]();
|
|
18733
18786
|
} catch (error$41) {
|
|
18734
18787
|
if (error$41.code === "ENOENT") return false;
|
|
@@ -18825,7 +18878,7 @@ const isIgnoredByIgnoreFiles = async (patterns, options$1) => {
|
|
|
18825
18878
|
});
|
|
18826
18879
|
const files$1 = await Promise.all(paths.map(async (filePath) => ({
|
|
18827
18880
|
filePath,
|
|
18828
|
-
content: await
|
|
18881
|
+
content: await fs$1.readFile(filePath, "utf8")
|
|
18829
18882
|
})));
|
|
18830
18883
|
return getIsIgnoredPredicate(files$1, cwd);
|
|
18831
18884
|
};
|
|
@@ -19130,7 +19183,7 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
|
|
|
19130
19183
|
* This is the common logic for both the Node.js and web browser
|
|
19131
19184
|
* implementations of `debug()`.
|
|
19132
19185
|
*/
|
|
19133
|
-
function setup(env$
|
|
19186
|
+
function setup(env$1) {
|
|
19134
19187
|
createDebug.debug = createDebug;
|
|
19135
19188
|
createDebug.default = createDebug;
|
|
19136
19189
|
createDebug.coerce = coerce;
|
|
@@ -19139,8 +19192,8 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
|
|
|
19139
19192
|
createDebug.enabled = enabled$1;
|
|
19140
19193
|
createDebug.humanize = require_ms();
|
|
19141
19194
|
createDebug.destroy = destroy;
|
|
19142
|
-
Object.keys(env$
|
|
19143
|
-
createDebug[key$1] = env$
|
|
19195
|
+
Object.keys(env$1).forEach((key$1) => {
|
|
19196
|
+
createDebug[key$1] = env$1[key$1];
|
|
19144
19197
|
});
|
|
19145
19198
|
/**
|
|
19146
19199
|
* The currently active debug mode names, and names to skip.
|
|
@@ -19211,7 +19264,7 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
|
|
|
19211
19264
|
debug$5.namespace = namespace;
|
|
19212
19265
|
debug$5.useColors = createDebug.useColors();
|
|
19213
19266
|
debug$5.color = createDebug.selectColor(namespace);
|
|
19214
|
-
debug$5.extend = extend$
|
|
19267
|
+
debug$5.extend = extend$4;
|
|
19215
19268
|
debug$5.destroy = createDebug.destroy;
|
|
19216
19269
|
Object.defineProperty(debug$5, "enabled", {
|
|
19217
19270
|
enumerable: true,
|
|
@@ -19231,7 +19284,7 @@ var require_common$1 = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node
|
|
|
19231
19284
|
if (typeof createDebug.init === "function") createDebug.init(debug$5);
|
|
19232
19285
|
return debug$5;
|
|
19233
19286
|
}
|
|
19234
|
-
function extend$
|
|
19287
|
+
function extend$4(namespace, delimiter) {
|
|
19235
19288
|
const newDebug = createDebug(this.namespace + (typeof delimiter === "undefined" ? ":" : delimiter) + namespace);
|
|
19236
19289
|
newDebug.log = this.log;
|
|
19237
19290
|
return newDebug;
|
|
@@ -19525,87 +19578,6 @@ var require_browser = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node_
|
|
|
19525
19578
|
};
|
|
19526
19579
|
} });
|
|
19527
19580
|
|
|
19528
|
-
//#endregion
|
|
19529
|
-
//#region ../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js
|
|
19530
|
-
var require_has_flag = __commonJS$2({ "../../node_modules/.pnpm/has-flag@4.0.0/node_modules/has-flag/index.js"(exports, module) {
|
|
19531
|
-
module.exports = (flag, argv = process.argv) => {
|
|
19532
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
19533
|
-
const position$1 = argv.indexOf(prefix + flag);
|
|
19534
|
-
const terminatorPosition = argv.indexOf("--");
|
|
19535
|
-
return position$1 !== -1 && (terminatorPosition === -1 || position$1 < terminatorPosition);
|
|
19536
|
-
};
|
|
19537
|
-
} });
|
|
19538
|
-
|
|
19539
|
-
//#endregion
|
|
19540
|
-
//#region ../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js
|
|
19541
|
-
var require_supports_color = __commonJS$2({ "../../node_modules/.pnpm/supports-color@7.2.0/node_modules/supports-color/index.js"(exports, module) {
|
|
19542
|
-
const os = __require$1("os");
|
|
19543
|
-
const tty$1 = __require$1("tty");
|
|
19544
|
-
const hasFlag = require_has_flag();
|
|
19545
|
-
const { env } = process;
|
|
19546
|
-
let forceColor;
|
|
19547
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) forceColor = 0;
|
|
19548
|
-
else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) forceColor = 1;
|
|
19549
|
-
if ("FORCE_COLOR" in env) if (env.FORCE_COLOR === "true") forceColor = 1;
|
|
19550
|
-
else if (env.FORCE_COLOR === "false") forceColor = 0;
|
|
19551
|
-
else forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
19552
|
-
function translateLevel(level) {
|
|
19553
|
-
if (level === 0) return false;
|
|
19554
|
-
return {
|
|
19555
|
-
level,
|
|
19556
|
-
hasBasic: true,
|
|
19557
|
-
has256: level >= 2,
|
|
19558
|
-
has16m: level >= 3
|
|
19559
|
-
};
|
|
19560
|
-
}
|
|
19561
|
-
function supportsColor(haveStream, streamIsTTY) {
|
|
19562
|
-
if (forceColor === 0) return 0;
|
|
19563
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) return 3;
|
|
19564
|
-
if (hasFlag("color=256")) return 2;
|
|
19565
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) return 0;
|
|
19566
|
-
const min = forceColor || 0;
|
|
19567
|
-
if (env.TERM === "dumb") return min;
|
|
19568
|
-
if (process.platform === "win32") {
|
|
19569
|
-
const osRelease = os.release().split(".");
|
|
19570
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
19571
|
-
return 1;
|
|
19572
|
-
}
|
|
19573
|
-
if ("CI" in env) {
|
|
19574
|
-
if ([
|
|
19575
|
-
"TRAVIS",
|
|
19576
|
-
"CIRCLECI",
|
|
19577
|
-
"APPVEYOR",
|
|
19578
|
-
"GITLAB_CI",
|
|
19579
|
-
"GITHUB_ACTIONS",
|
|
19580
|
-
"BUILDKITE"
|
|
19581
|
-
].some((sign$1) => sign$1 in env) || env.CI_NAME === "codeship") return 1;
|
|
19582
|
-
return min;
|
|
19583
|
-
}
|
|
19584
|
-
if ("TEAMCITY_VERSION" in env) return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
19585
|
-
if (env.COLORTERM === "truecolor") return 3;
|
|
19586
|
-
if ("TERM_PROGRAM" in env) {
|
|
19587
|
-
const version$2 = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
19588
|
-
switch (env.TERM_PROGRAM) {
|
|
19589
|
-
case "iTerm.app": return version$2 >= 3 ? 3 : 2;
|
|
19590
|
-
case "Apple_Terminal": return 2;
|
|
19591
|
-
}
|
|
19592
|
-
}
|
|
19593
|
-
if (/-256(color)?$/i.test(env.TERM)) return 2;
|
|
19594
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) return 1;
|
|
19595
|
-
if ("COLORTERM" in env) return 1;
|
|
19596
|
-
return min;
|
|
19597
|
-
}
|
|
19598
|
-
function getSupportLevel(stream$1) {
|
|
19599
|
-
const level = supportsColor(stream$1, stream$1 && stream$1.isTTY);
|
|
19600
|
-
return translateLevel(level);
|
|
19601
|
-
}
|
|
19602
|
-
module.exports = {
|
|
19603
|
-
supportsColor: getSupportLevel,
|
|
19604
|
-
stdout: translateLevel(supportsColor(true, tty$1.isatty(1))),
|
|
19605
|
-
stderr: translateLevel(supportsColor(true, tty$1.isatty(2)))
|
|
19606
|
-
};
|
|
19607
|
-
} });
|
|
19608
|
-
|
|
19609
19581
|
//#endregion
|
|
19610
19582
|
//#region ../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js
|
|
19611
19583
|
var require_node = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/node.js"(exports, module) {
|
|
@@ -19636,8 +19608,8 @@ var require_node = __commonJS$2({ "../../node_modules/.pnpm/debug@4.4.1/node_mod
|
|
|
19636
19608
|
1
|
|
19637
19609
|
];
|
|
19638
19610
|
try {
|
|
19639
|
-
const supportsColor
|
|
19640
|
-
if (supportsColor
|
|
19611
|
+
const supportsColor = __require$1("supports-color");
|
|
19612
|
+
if (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) exports.colors = [
|
|
19641
19613
|
20,
|
|
19642
19614
|
21,
|
|
19643
19615
|
26,
|
|
@@ -24654,9 +24626,9 @@ var require_path = __commonJS({ "node_modules/fast-glob/out/utils/path.js"(expor
|
|
|
24654
24626
|
"use strict";
|
|
24655
24627
|
Object.defineProperty(exports$2, "__esModule", { value: true });
|
|
24656
24628
|
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;
|
|
24657
|
-
var os$
|
|
24629
|
+
var os$2 = __require("os");
|
|
24658
24630
|
var path14 = __require("path");
|
|
24659
|
-
var IS_WINDOWS_PLATFORM$1 = os$
|
|
24631
|
+
var IS_WINDOWS_PLATFORM$1 = os$2.platform() === "win32";
|
|
24660
24632
|
var LEADING_DOT_SEGMENT_CHARACTERS_COUNT$1 = 2;
|
|
24661
24633
|
var POSIX_UNESCAPED_GLOB_SYMBOLS_RE$1 = /(\\?)([()*?[\]{|}]|^!|[!+@](?=\()|\\(?![!()*+?@[\]{|}]))/g;
|
|
24662
24634
|
var WINDOWS_UNESCAPED_GLOB_SYMBOLS_RE$1 = /(\\?)([()[\]{}]|^!|[!+@](?=\())/g;
|
|
@@ -29100,8 +29072,8 @@ var require_settings4 = __commonJS({ "node_modules/fast-glob/out/settings.js"(ex
|
|
|
29100
29072
|
Object.defineProperty(exports$2, "__esModule", { value: true });
|
|
29101
29073
|
exports$2.DEFAULT_FILE_SYSTEM_ADAPTER = void 0;
|
|
29102
29074
|
var fs4 = __require("fs");
|
|
29103
|
-
var os$
|
|
29104
|
-
var CPU_COUNT$1 = Math.max(os$
|
|
29075
|
+
var os$2 = __require("os");
|
|
29076
|
+
var CPU_COUNT$1 = Math.max(os$2.cpus().length, 1);
|
|
29105
29077
|
exports$2.DEFAULT_FILE_SYSTEM_ADAPTER = {
|
|
29106
29078
|
lstat: fs4.lstat,
|
|
29107
29079
|
lstatSync: fs4.lstatSync,
|
|
@@ -29245,8 +29217,8 @@ var require_out4 = __commonJS({ "node_modules/fast-glob/out/index.js"(exports$2,
|
|
|
29245
29217
|
var require_picocolors = __commonJS({ "node_modules/picocolors/picocolors.js"(exports$2, module$1) {
|
|
29246
29218
|
var p$1 = process || {};
|
|
29247
29219
|
var argv = p$1.argv || [];
|
|
29248
|
-
var env$
|
|
29249
|
-
var isColorSupported = !(!!env$
|
|
29220
|
+
var env$1 = p$1.env || {};
|
|
29221
|
+
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);
|
|
29250
29222
|
var formatter = (open, close, replace = open) => (input) => {
|
|
29251
29223
|
let string$7 = "" + input, index$1 = string$7.indexOf(close, open.length);
|
|
29252
29224
|
return ~index$1 ? open + replaceClose(string$7, close, replace, index$1) + close : open + string$7 + close;
|
|
@@ -30697,10 +30669,10 @@ var require_fnmatch = __commonJS({ "node_modules/editorconfig/src/lib/fnmatch.js
|
|
|
30697
30669
|
return list$1;
|
|
30698
30670
|
};
|
|
30699
30671
|
Minimatch.prototype.match = match;
|
|
30700
|
-
function match(f$1, partial$
|
|
30672
|
+
function match(f$1, partial$2) {
|
|
30701
30673
|
if (this.comment) return false;
|
|
30702
30674
|
if (this.empty) return f$1 === "";
|
|
30703
|
-
if (f$1 === "/" && partial$
|
|
30675
|
+
if (f$1 === "/" && partial$2) return true;
|
|
30704
30676
|
var options8 = this.options;
|
|
30705
30677
|
if (platform === "win32") f$1 = f$1.split("\\").join("/");
|
|
30706
30678
|
f$1 = f$1.split(slashSplit);
|
|
@@ -30708,7 +30680,7 @@ var require_fnmatch = __commonJS({ "node_modules/editorconfig/src/lib/fnmatch.js
|
|
|
30708
30680
|
var set$1 = this.set;
|
|
30709
30681
|
for (var i$2 = 0, l$1 = set$1.length; i$2 < l$1; i$2++) {
|
|
30710
30682
|
var pattern$1 = set$1[i$2];
|
|
30711
|
-
var hit = this.matchOne(f$1, pattern$1, partial$
|
|
30683
|
+
var hit = this.matchOne(f$1, pattern$1, partial$2);
|
|
30712
30684
|
if (hit) {
|
|
30713
30685
|
if (options8.flipNegate) return true;
|
|
30714
30686
|
return !this.negate;
|
|
@@ -30717,7 +30689,7 @@ var require_fnmatch = __commonJS({ "node_modules/editorconfig/src/lib/fnmatch.js
|
|
|
30717
30689
|
if (options8.flipNegate) return false;
|
|
30718
30690
|
return this.negate;
|
|
30719
30691
|
}
|
|
30720
|
-
Minimatch.prototype.matchOne = function(file$1, pattern$1, partial$
|
|
30692
|
+
Minimatch.prototype.matchOne = function(file$1, pattern$1, partial$2) {
|
|
30721
30693
|
var options8 = this.options;
|
|
30722
30694
|
if (options8.debug) console.error("matchOne", {
|
|
30723
30695
|
"this": this,
|
|
@@ -30746,7 +30718,7 @@ var require_fnmatch = __commonJS({ "node_modules/editorconfig/src/lib/fnmatch.js
|
|
|
30746
30718
|
WHILE: while (fr < fl) {
|
|
30747
30719
|
var swallowee = file$1[fr];
|
|
30748
30720
|
if (options8.debug) console.error("\nglobstar while", file$1, fr, pattern$1, pr, swallowee);
|
|
30749
|
-
if (this.matchOne(file$1.slice(fr), pattern$1.slice(pr), partial$
|
|
30721
|
+
if (this.matchOne(file$1.slice(fr), pattern$1.slice(pr), partial$2)) {
|
|
30750
30722
|
if (options8.debug) console.error("globstar found match!", fr, fl, swallowee);
|
|
30751
30723
|
return true;
|
|
30752
30724
|
} else {
|
|
@@ -30758,7 +30730,7 @@ var require_fnmatch = __commonJS({ "node_modules/editorconfig/src/lib/fnmatch.js
|
|
|
30758
30730
|
fr++;
|
|
30759
30731
|
}
|
|
30760
30732
|
}
|
|
30761
|
-
if (partial$
|
|
30733
|
+
if (partial$2) {
|
|
30762
30734
|
if (fr === fl) return true;
|
|
30763
30735
|
}
|
|
30764
30736
|
return false;
|
|
@@ -30775,7 +30747,7 @@ var require_fnmatch = __commonJS({ "node_modules/editorconfig/src/lib/fnmatch.js
|
|
|
30775
30747
|
if (!hit) return false;
|
|
30776
30748
|
}
|
|
30777
30749
|
if (fi === fl && pi === pl) return true;
|
|
30778
|
-
else if (fi === fl) return partial$
|
|
30750
|
+
else if (fi === fl) return partial$2;
|
|
30779
30751
|
else if (pi === pl) {
|
|
30780
30752
|
var emptyFileEnd = fi === fl - 1 && file$1[fi] === "";
|
|
30781
30753
|
return emptyFileEnd;
|
|
@@ -33963,7 +33935,7 @@ async function findInDirectory(nameOrNames, { typeCheck, cwd, allowSymlinks = tr
|
|
|
33963
33935
|
}
|
|
33964
33936
|
async function safeStat(path14, allowSymlinks = true) {
|
|
33965
33937
|
try {
|
|
33966
|
-
return await (allowSymlinks ? fs$
|
|
33938
|
+
return await (allowSymlinks ? fs$2.stat : fs$2.lstat)(path14);
|
|
33967
33939
|
} catch {}
|
|
33968
33940
|
}
|
|
33969
33941
|
function findFile(nameOrNames, options8) {
|
|
@@ -41025,7 +40997,7 @@ async function confirmAction(filesToUpdate, options$1) {
|
|
|
41025
40997
|
checked: file$1.safe || !!options$1.allowUnsafe
|
|
41026
40998
|
});
|
|
41027
40999
|
}
|
|
41028
|
-
const selectedFiles = await esm_default$
|
|
41000
|
+
const selectedFiles = await esm_default$3({
|
|
41029
41001
|
message: [options$1.topMessage, "The following files will be overwritten:\n"].filter(Boolean).join("\n"),
|
|
41030
41002
|
choices,
|
|
41031
41003
|
pageSize: process.stdout.rows > 0 ? process.stdout.rows - 4 : filesToUpdate.length
|
|
@@ -41890,7 +41862,7 @@ async function gitWorkingContents(repoPath, options$1) {
|
|
|
41890
41862
|
return async () => {
|
|
41891
41863
|
results.set(filepath, {
|
|
41892
41864
|
path: filepath,
|
|
41893
|
-
content: status === "D" ? void 0 : await
|
|
41865
|
+
content: status === "D" ? void 0 : await fs$1.readFile(path.join(repoPath, filepath), "utf-8"),
|
|
41894
41866
|
status
|
|
41895
41867
|
});
|
|
41896
41868
|
};
|
|
@@ -52963,7 +52935,7 @@ __export$4(util_exports, {
|
|
|
52963
52935
|
defineLazy: () => defineLazy,
|
|
52964
52936
|
esc: () => esc,
|
|
52965
52937
|
escapeRegex: () => escapeRegex,
|
|
52966
|
-
extend: () => extend,
|
|
52938
|
+
extend: () => extend$1,
|
|
52967
52939
|
finalizeIssue: () => finalizeIssue,
|
|
52968
52940
|
floatSafeRemainder: () => floatSafeRemainder,
|
|
52969
52941
|
getElementAtPath: () => getElementAtPath,
|
|
@@ -52983,7 +52955,7 @@ __export$4(util_exports, {
|
|
|
52983
52955
|
numKeys: () => numKeys,
|
|
52984
52956
|
omit: () => omit,
|
|
52985
52957
|
optionalKeys: () => optionalKeys,
|
|
52986
|
-
partial: () => partial,
|
|
52958
|
+
partial: () => partial$1,
|
|
52987
52959
|
pick: () => pick,
|
|
52988
52960
|
prefixIssues: () => prefixIssues,
|
|
52989
52961
|
primitiveTypes: () => primitiveTypes,
|
|
@@ -53274,7 +53246,7 @@ function omit(schema, mask) {
|
|
|
53274
53246
|
});
|
|
53275
53247
|
return clone(schema, def);
|
|
53276
53248
|
}
|
|
53277
|
-
function extend(schema, shape) {
|
|
53249
|
+
function extend$1(schema, shape) {
|
|
53278
53250
|
if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
|
|
53279
53251
|
const def = mergeDefs(schema._zod.def, {
|
|
53280
53252
|
get shape() {
|
|
@@ -53306,7 +53278,7 @@ function merge(a$1, b$1) {
|
|
|
53306
53278
|
});
|
|
53307
53279
|
return clone(a$1, def);
|
|
53308
53280
|
}
|
|
53309
|
-
function partial(Class$1, schema, mask) {
|
|
53281
|
+
function partial$1(Class$1, schema, mask) {
|
|
53310
53282
|
const def = mergeDefs(schema._zod.def, {
|
|
53311
53283
|
get shape() {
|
|
53312
53284
|
const oldShape = schema._zod.def.shape;
|
|
@@ -62140,6 +62112,12 @@ function looseObject$1(shape, params) {
|
|
|
62140
62112
|
...normalizeParams(params)
|
|
62141
62113
|
});
|
|
62142
62114
|
}
|
|
62115
|
+
function extend(schema, shape) {
|
|
62116
|
+
return extend$1(schema, shape);
|
|
62117
|
+
}
|
|
62118
|
+
function partial(schema, mask) {
|
|
62119
|
+
return partial$1(ZodMiniOptional, schema, mask);
|
|
62120
|
+
}
|
|
62143
62121
|
const ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
|
|
62144
62122
|
$ZodUnion.init(inst, def);
|
|
62145
62123
|
ZodMiniType.init(inst, def);
|
|
@@ -62161,6 +62139,108 @@ function optional$1(innerType) {
|
|
|
62161
62139
|
innerType
|
|
62162
62140
|
});
|
|
62163
62141
|
}
|
|
62142
|
+
const ZodMiniCustom = /* @__PURE__ */ $constructor("ZodMiniCustom", (inst, def) => {
|
|
62143
|
+
$ZodCustom.init(inst, def);
|
|
62144
|
+
ZodMiniType.init(inst, def);
|
|
62145
|
+
});
|
|
62146
|
+
function custom$1(fn, _params) {
|
|
62147
|
+
return _custom(ZodMiniCustom, fn ?? (() => true), _params);
|
|
62148
|
+
}
|
|
62149
|
+
function _instanceof$1(cls, params = { error: `Input not instance of ${cls.name}` }) {
|
|
62150
|
+
const inst = custom$1((data) => data instanceof cls, params);
|
|
62151
|
+
inst._zod.bag.Class = cls;
|
|
62152
|
+
return inst;
|
|
62153
|
+
}
|
|
62154
|
+
|
|
62155
|
+
//#endregion
|
|
62156
|
+
//#region ../dev/dist/google-aistudio/node/function_call.js
|
|
62157
|
+
const zFunctionCallConfig = object$1({
|
|
62158
|
+
name: string$2(),
|
|
62159
|
+
description: optional$1(string$2()),
|
|
62160
|
+
safeDescription: string$2(),
|
|
62161
|
+
paramsSchema: optional$1(unknown$1())
|
|
62162
|
+
});
|
|
62163
|
+
const zFunctionCallFn = _instanceof$1(Function);
|
|
62164
|
+
/**
|
|
62165
|
+
* 标准版本
|
|
62166
|
+
*/
|
|
62167
|
+
const zFunctionCallStandardModule = looseObject$1({
|
|
62168
|
+
...zFunctionCallConfig.shape,
|
|
62169
|
+
name: optional$1(string$2()),
|
|
62170
|
+
functionCall: zFunctionCallFn
|
|
62171
|
+
});
|
|
62172
|
+
/**
|
|
62173
|
+
* 极简版本,只导出一个 functionCall 函数即可
|
|
62174
|
+
* name 默认使用 `${infer name}.function.ts`
|
|
62175
|
+
* description 默认使用 functionCall.toString() 可以由AI猜测生成对应的params
|
|
62176
|
+
*/
|
|
62177
|
+
const zFunctionCallMiniModule = extend(partial(zFunctionCallConfig), { functionCall: zFunctionCallFn });
|
|
62178
|
+
const safeParseModule = (unsafeModule) => {
|
|
62179
|
+
if (unsafeModule.default) {
|
|
62180
|
+
const safeModule = zFunctionCallStandardModule.safeParse(unsafeModule.default);
|
|
62181
|
+
if (safeModule.success) return safeModule.data;
|
|
62182
|
+
}
|
|
62183
|
+
if (unsafeModule.functionCall) {
|
|
62184
|
+
const safeModule = zFunctionCallMiniModule.safeParse(unsafeModule);
|
|
62185
|
+
if (safeModule.success) return safeModule.data;
|
|
62186
|
+
}
|
|
62187
|
+
};
|
|
62188
|
+
const esmImporter = async (codeEntry) => {
|
|
62189
|
+
const unsafeModule = await import(`${pathToFileURL(codeEntry.fullpath).href}?_=${codeEntry.stat.mtime}`);
|
|
62190
|
+
const safeModule = safeParseModule(unsafeModule);
|
|
62191
|
+
if (!safeModule) {
|
|
62192
|
+
console.warn(`无法解析 ${codeEntry.filename} 做为 functionCall 模块。`);
|
|
62193
|
+
return;
|
|
62194
|
+
}
|
|
62195
|
+
return {
|
|
62196
|
+
name: safeModule.name ?? codeEntry.filename,
|
|
62197
|
+
description: safeModule.description,
|
|
62198
|
+
safeDescription: safeModule.description ?? String(safeModule.functionCall),
|
|
62199
|
+
paramsSchema: safeModule.paramsSchema,
|
|
62200
|
+
functionCall: safeModule.functionCall
|
|
62201
|
+
};
|
|
62202
|
+
};
|
|
62203
|
+
const supportImports = new Map([[/\.function_call\.js$/, {
|
|
62204
|
+
getKey: (filename) => {
|
|
62205
|
+
return filename.replace(/\.function_call\.js$/, "");
|
|
62206
|
+
},
|
|
62207
|
+
importer: esmImporter
|
|
62208
|
+
}], [/\.function_call\.ts$/, {
|
|
62209
|
+
getKey: (filename) => {
|
|
62210
|
+
return filename.replace(/\.function_call\.ts$/, "");
|
|
62211
|
+
},
|
|
62212
|
+
importer: esmImporter
|
|
62213
|
+
}]]);
|
|
62214
|
+
const defineFunctionCalls = async (dir) => {
|
|
62215
|
+
const codeEntries = /* @__PURE__ */ new Map();
|
|
62216
|
+
for (const filename of readdirSync(dir)) {
|
|
62217
|
+
const fullpath = path.join(dir, filename);
|
|
62218
|
+
const stat$1 = statSync(fullpath);
|
|
62219
|
+
if (!stat$1.isFile()) continue;
|
|
62220
|
+
let key$1;
|
|
62221
|
+
for (const [suffix, config$1] of supportImports) if (suffix.test(filename)) {
|
|
62222
|
+
key$1 = config$1.getKey(filename).trim();
|
|
62223
|
+
if (key$1 != "") {
|
|
62224
|
+
const codeEntry = {
|
|
62225
|
+
key: key$1,
|
|
62226
|
+
filename,
|
|
62227
|
+
dirname: dir,
|
|
62228
|
+
fullpath,
|
|
62229
|
+
stat: stat$1
|
|
62230
|
+
};
|
|
62231
|
+
const module$1 = await config$1.importer(codeEntry);
|
|
62232
|
+
if (module$1) {
|
|
62233
|
+
codeEntries.set(codeEntry.key, {
|
|
62234
|
+
codeEntry,
|
|
62235
|
+
module: module$1
|
|
62236
|
+
});
|
|
62237
|
+
break;
|
|
62238
|
+
}
|
|
62239
|
+
}
|
|
62240
|
+
}
|
|
62241
|
+
}
|
|
62242
|
+
return codeEntries;
|
|
62243
|
+
};
|
|
62164
62244
|
|
|
62165
62245
|
//#endregion
|
|
62166
62246
|
//#region ../dev/dist/google-aistudio/node/types.js
|
|
@@ -62237,67 +62317,95 @@ const zContentSchema = looseObject$1({
|
|
|
62237
62317
|
});
|
|
62238
62318
|
|
|
62239
62319
|
//#endregion
|
|
62240
|
-
//#region ../dev/dist/google-aistudio/node/
|
|
62241
|
-
const
|
|
62242
|
-
|
|
62243
|
-
const
|
|
62244
|
-
|
|
62245
|
-
|
|
62246
|
-
|
|
62247
|
-
|
|
62248
|
-
|
|
62249
|
-
|
|
62320
|
+
//#region ../dev/dist/google-aistudio/node/tasks.js
|
|
62321
|
+
const parseContent = async (fcs, dir, basename$1, contentFilepath, filenames) => {
|
|
62322
|
+
console.log(magenta("开始处理文件"), path.relative(process.cwd(), contentFilepath));
|
|
62323
|
+
const fileData = await zContentSchema.parse(JSON.parse(reactiveFs.readFile(contentFilepath)));
|
|
62324
|
+
const { contents } = fileData.generateContentParameters;
|
|
62325
|
+
const latestContent = contents.at(-1);
|
|
62326
|
+
if (!latestContent) return;
|
|
62327
|
+
if (latestContent.role !== "user") return;
|
|
62328
|
+
const functionResponsePart = latestContent.parts.find((p$1) => "functionResponse" in p$1);
|
|
62329
|
+
if (!functionResponsePart) return;
|
|
62330
|
+
if (functionResponsePart.functionResponse.response !== "") return;
|
|
62331
|
+
const modelContent = contents.findLast((content$2) => {
|
|
62332
|
+
return content$2.role === "model" && content$2.parts.find((p$1) => "functionCall" in p$1);
|
|
62333
|
+
});
|
|
62334
|
+
if (!modelContent) return;
|
|
62335
|
+
const functionCallPart = modelContent.parts.find((p$1) => "functionCall" in p$1)?.functionCall;
|
|
62336
|
+
if (!functionCallPart) {
|
|
62337
|
+
console.log(gray("发现任务已经有输入的内容,跳过任务"));
|
|
62338
|
+
return;
|
|
62339
|
+
}
|
|
62340
|
+
const modelIndex = contents.indexOf(modelContent);
|
|
62341
|
+
const hash = createHash("sha256").update(`INDEX:${modelIndex}`).update(JSON.stringify(modelContent)).digest("hex").slice(0, 8);
|
|
62342
|
+
const taskFilename = `${basename$1}.${functionCallPart.name}.${modelIndex}-${hash}.function_call.json`;
|
|
62343
|
+
if (filenames.includes(taskFilename)) return;
|
|
62344
|
+
console.log(blue("收到 functionCallPart 任务请求"), functionCallPart);
|
|
62345
|
+
const fc = fcs.get(functionCallPart.name);
|
|
62346
|
+
if (!fc) {
|
|
62347
|
+
console.warn("找不到任务处理工具");
|
|
62348
|
+
return false;
|
|
62349
|
+
} else {
|
|
62350
|
+
const { functionCall } = await fc.module;
|
|
62351
|
+
const input = JSON.parse(functionCallPart.parameters);
|
|
62352
|
+
try {
|
|
62353
|
+
console.log(cyan("开始执行任务"));
|
|
62354
|
+
const output = await functionCall(input);
|
|
62355
|
+
console.log(green("生成任务结果:"), taskFilename);
|
|
62356
|
+
fs.writeFileSync(path.join(dir, taskFilename), JSON.stringify({
|
|
62357
|
+
input,
|
|
62358
|
+
output
|
|
62359
|
+
}, null, 2));
|
|
62360
|
+
return true;
|
|
62361
|
+
} catch (e$1) {
|
|
62362
|
+
console.log(red("任务执行失败:"), e$1);
|
|
62363
|
+
return false;
|
|
62250
62364
|
}
|
|
62251
|
-
}
|
|
62252
|
-
|
|
62253
|
-
|
|
62254
|
-
|
|
62255
|
-
|
|
62256
|
-
|
|
62257
|
-
|
|
62258
|
-
|
|
62259
|
-
|
|
62260
|
-
|
|
62261
|
-
|
|
62262
|
-
|
|
62263
|
-
|
|
62264
|
-
|
|
62265
|
-
|
|
62266
|
-
|
|
62267
|
-
|
|
62268
|
-
|
|
62269
|
-
|
|
62270
|
-
|
|
62271
|
-
|
|
62272
|
-
|
|
62273
|
-
const
|
|
62274
|
-
|
|
62275
|
-
|
|
62276
|
-
|
|
62277
|
-
})
|
|
62278
|
-
|
|
62279
|
-
else {
|
|
62280
|
-
const { functionCall } = await import(pathToFileURL(scriptFilepath).href);
|
|
62281
|
-
const input = JSON.parse(functionCallPart.parameters);
|
|
62282
|
-
try {
|
|
62283
|
-
console.log(cyan("开始执行任务"));
|
|
62284
|
-
const output = await functionCall(input);
|
|
62285
|
-
console.log(green("生成任务结果:"), taskFilename);
|
|
62286
|
-
fs.writeFileSync(path.join(dir, taskFilename), JSON.stringify({
|
|
62287
|
-
input,
|
|
62288
|
-
output
|
|
62289
|
-
}, null, 2));
|
|
62290
|
-
} catch (e$1) {
|
|
62291
|
-
console.log(red("任务执行失败:"), e$1);
|
|
62292
|
-
}
|
|
62365
|
+
}
|
|
62366
|
+
};
|
|
62367
|
+
const getFunctionCalls = func_remember(async (dir) => {
|
|
62368
|
+
const fcs = await defineFunctionCalls(dir);
|
|
62369
|
+
if (fcs.size === 0) {
|
|
62370
|
+
console.log(red("No Found functionCalls"));
|
|
62371
|
+
return;
|
|
62372
|
+
}
|
|
62373
|
+
console.log(green(`Found functionCalls (${fcs.size}):`));
|
|
62374
|
+
for (const [index$1, [name$1, fc]] of Array.from(fcs).entries()) console.log(gray(`${index$1 + 1}.`), blue(name$1), fc.module.description ?? "");
|
|
62375
|
+
return fcs;
|
|
62376
|
+
});
|
|
62377
|
+
const googleAiStudioAutomation = async ({ dir = process.cwd() }) => {
|
|
62378
|
+
const fcs = await getFunctionCalls(dir);
|
|
62379
|
+
if (!fcs) return;
|
|
62380
|
+
const contentNames = reactiveFs.readDirByGlob(dir, "*.contents.json");
|
|
62381
|
+
if (contentNames.length === 0) {
|
|
62382
|
+
console.log(red("No Found aistudio browser output contents file"));
|
|
62383
|
+
return;
|
|
62384
|
+
}
|
|
62385
|
+
console.log(gray((/* @__PURE__ */ new Date()).toLocaleTimeString()), magenta("处理开始"));
|
|
62386
|
+
for (const contentFilename of contentNames) {
|
|
62387
|
+
const contentFilepath = path.join(dir, contentFilename);
|
|
62388
|
+
const basename$1 = contentFilename.replace(".contents.json", "");
|
|
62389
|
+
try {
|
|
62390
|
+
const result = await parseContent(fcs, dir, basename$1, contentFilepath, contentNames).catch(console.error);
|
|
62391
|
+
} catch (e$1) {
|
|
62392
|
+
console.error(red(e$1 instanceof Error ? e$1.stack ?? e$1.message : String(e$1)));
|
|
62293
62393
|
}
|
|
62294
|
-
}
|
|
62295
|
-
|
|
62296
|
-
|
|
62297
|
-
|
|
62298
|
-
|
|
62299
|
-
|
|
62300
|
-
|
|
62394
|
+
}
|
|
62395
|
+
console.log(gray((/* @__PURE__ */ new Date()).toLocaleTimeString()), magenta("处理结束"));
|
|
62396
|
+
};
|
|
62397
|
+
|
|
62398
|
+
//#endregion
|
|
62399
|
+
//#region ../dev/dist/google-aistudio/node/index.js
|
|
62400
|
+
const doGoogleAiStudioAutomation = async ({ watch,...opts }) => {
|
|
62401
|
+
const handle = func_throttle(() => {
|
|
62402
|
+
return googleAiStudioAutomation(opts);
|
|
62403
|
+
}, 200);
|
|
62404
|
+
const printWatchTip = func_remember(() => console.log(gray("\nWatching for file changes... Press Ctrl+C to exit.")));
|
|
62405
|
+
await reactiveFs.use(async () => {
|
|
62406
|
+
await handle();
|
|
62407
|
+
if (watch) printWatchTip();
|
|
62408
|
+
}, { once: !watch });
|
|
62301
62409
|
};
|
|
62302
62410
|
|
|
62303
62411
|
//#endregion
|
|
@@ -62839,12 +62947,12 @@ const ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
|
|
|
62839
62947
|
catchall: void 0
|
|
62840
62948
|
});
|
|
62841
62949
|
inst.extend = (incoming) => {
|
|
62842
|
-
return extend(inst, incoming);
|
|
62950
|
+
return extend$1(inst, incoming);
|
|
62843
62951
|
};
|
|
62844
62952
|
inst.merge = (other) => merge(inst, other);
|
|
62845
62953
|
inst.pick = (mask) => pick(inst, mask);
|
|
62846
62954
|
inst.omit = (mask) => omit(inst, mask);
|
|
62847
|
-
inst.partial = (...args) => partial(ZodOptional, inst, args[0]);
|
|
62955
|
+
inst.partial = (...args) => partial$1(ZodOptional, inst, args[0]);
|
|
62848
62956
|
inst.required = (...args) => required(ZodNonOptional, inst, args[0]);
|
|
62849
62957
|
});
|
|
62850
62958
|
function object(shape, params) {
|
|
@@ -63685,7 +63793,7 @@ const doInit = async ({ dir, force }) => {
|
|
|
63685
63793
|
return;
|
|
63686
63794
|
}
|
|
63687
63795
|
if (force == null) {
|
|
63688
|
-
const overwrite = await esm_default({
|
|
63796
|
+
const overwrite = await esm_default$1({
|
|
63689
63797
|
message: [`the same file(s) name already exists. Are you sure you want to overwrite?`, ...logPaths()].join("\n"),
|
|
63690
63798
|
default: false
|
|
63691
63799
|
});
|
|
@@ -63736,9 +63844,14 @@ const browserCommand = {
|
|
|
63736
63844
|
describe: "Directory for aistudio output contents",
|
|
63737
63845
|
type: "string",
|
|
63738
63846
|
default: process.cwd()
|
|
63847
|
+
}).option("watch", {
|
|
63848
|
+
alias: "W",
|
|
63849
|
+
type: "boolean",
|
|
63850
|
+
describe: "Watch for browser response automatically",
|
|
63851
|
+
default: true
|
|
63739
63852
|
}),
|
|
63740
63853
|
handler: async (argv) => {
|
|
63741
|
-
doGoogleAiStudioAutomation(argv
|
|
63854
|
+
doGoogleAiStudioAutomation(argv);
|
|
63742
63855
|
}
|
|
63743
63856
|
};
|
|
63744
63857
|
const initCommand = {
|
|
@@ -63747,15 +63860,22 @@ const initCommand = {
|
|
|
63747
63860
|
describe: "init an browser-kit directory for aistudio.google.com",
|
|
63748
63861
|
builder: (yargs) => yargs.positional("dir", {
|
|
63749
63862
|
describe: "Directory for aistudio input/output contents",
|
|
63750
|
-
type: "string"
|
|
63751
|
-
default: path.resolve(process.cwd(), ".ai")
|
|
63863
|
+
type: "string"
|
|
63752
63864
|
}).option("force", {
|
|
63753
63865
|
alias: "F",
|
|
63754
63866
|
type: "boolean",
|
|
63755
63867
|
describe: "override exits files"
|
|
63756
63868
|
}),
|
|
63757
63869
|
handler: async (argv) => {
|
|
63758
|
-
|
|
63870
|
+
let { dir } = argv;
|
|
63871
|
+
if (dir == null) dir = await esm_default({
|
|
63872
|
+
message: "No directory specified. Do you want to use the default '.ai' directory?",
|
|
63873
|
+
default: ".ai"
|
|
63874
|
+
});
|
|
63875
|
+
doInit({
|
|
63876
|
+
...argv,
|
|
63877
|
+
dir
|
|
63878
|
+
});
|
|
63759
63879
|
}
|
|
63760
63880
|
};
|
|
63761
63881
|
/**
|