@taptap/instant-games-open-mcp 1.23.2 → 1.23.3
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/README.md +64 -56
- package/dist/maker.js +1498 -1089
- package/dist/proxy.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/skills/taptap-maker-dev-kit-guide/SKILL.md +10 -9
- package/skills/taptap-maker-local/SKILL.md +88 -74
- package/skills/update-taptap-mcp/SKILL.md +9 -16
package/dist/maker.js
CHANGED
|
@@ -3116,27 +3116,27 @@ var require_utils = __commonJS({
|
|
|
3116
3116
|
"use strict";
|
|
3117
3117
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
3118
3118
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
3119
|
-
function stringArrayToHexStripped(
|
|
3119
|
+
function stringArrayToHexStripped(input2) {
|
|
3120
3120
|
let acc = "";
|
|
3121
3121
|
let code = 0;
|
|
3122
3122
|
let i = 0;
|
|
3123
|
-
for (i = 0; i <
|
|
3124
|
-
code =
|
|
3123
|
+
for (i = 0; i < input2.length; i++) {
|
|
3124
|
+
code = input2[i].charCodeAt(0);
|
|
3125
3125
|
if (code === 48) {
|
|
3126
3126
|
continue;
|
|
3127
3127
|
}
|
|
3128
3128
|
if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
|
|
3129
3129
|
return "";
|
|
3130
3130
|
}
|
|
3131
|
-
acc +=
|
|
3131
|
+
acc += input2[i];
|
|
3132
3132
|
break;
|
|
3133
3133
|
}
|
|
3134
|
-
for (i += 1; i <
|
|
3135
|
-
code =
|
|
3134
|
+
for (i += 1; i < input2.length; i++) {
|
|
3135
|
+
code = input2[i].charCodeAt(0);
|
|
3136
3136
|
if (!(code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102)) {
|
|
3137
3137
|
return "";
|
|
3138
3138
|
}
|
|
3139
|
-
acc +=
|
|
3139
|
+
acc += input2[i];
|
|
3140
3140
|
}
|
|
3141
3141
|
return acc;
|
|
3142
3142
|
}
|
|
@@ -3145,29 +3145,29 @@ var require_utils = __commonJS({
|
|
|
3145
3145
|
buffer.length = 0;
|
|
3146
3146
|
return true;
|
|
3147
3147
|
}
|
|
3148
|
-
function consumeHextets(buffer, address,
|
|
3148
|
+
function consumeHextets(buffer, address, output2) {
|
|
3149
3149
|
if (buffer.length) {
|
|
3150
3150
|
const hex3 = stringArrayToHexStripped(buffer);
|
|
3151
3151
|
if (hex3 !== "") {
|
|
3152
3152
|
address.push(hex3);
|
|
3153
3153
|
} else {
|
|
3154
|
-
|
|
3154
|
+
output2.error = true;
|
|
3155
3155
|
return false;
|
|
3156
3156
|
}
|
|
3157
3157
|
buffer.length = 0;
|
|
3158
3158
|
}
|
|
3159
3159
|
return true;
|
|
3160
3160
|
}
|
|
3161
|
-
function getIPV6(
|
|
3161
|
+
function getIPV6(input2) {
|
|
3162
3162
|
let tokenCount = 0;
|
|
3163
|
-
const
|
|
3163
|
+
const output2 = { error: false, address: "", zone: "" };
|
|
3164
3164
|
const address = [];
|
|
3165
3165
|
const buffer = [];
|
|
3166
3166
|
let endipv6Encountered = false;
|
|
3167
3167
|
let endIpv6 = false;
|
|
3168
3168
|
let consume = consumeHextets;
|
|
3169
|
-
for (let i = 0; i <
|
|
3170
|
-
const cursor =
|
|
3169
|
+
for (let i = 0; i < input2.length; i++) {
|
|
3170
|
+
const cursor = input2[i];
|
|
3171
3171
|
if (cursor === "[" || cursor === "]") {
|
|
3172
3172
|
continue;
|
|
3173
3173
|
}
|
|
@@ -3175,20 +3175,20 @@ var require_utils = __commonJS({
|
|
|
3175
3175
|
if (endipv6Encountered === true) {
|
|
3176
3176
|
endIpv6 = true;
|
|
3177
3177
|
}
|
|
3178
|
-
if (!consume(buffer, address,
|
|
3178
|
+
if (!consume(buffer, address, output2)) {
|
|
3179
3179
|
break;
|
|
3180
3180
|
}
|
|
3181
3181
|
if (++tokenCount > 7) {
|
|
3182
|
-
|
|
3182
|
+
output2.error = true;
|
|
3183
3183
|
break;
|
|
3184
3184
|
}
|
|
3185
|
-
if (i > 0 &&
|
|
3185
|
+
if (i > 0 && input2[i - 1] === ":") {
|
|
3186
3186
|
endipv6Encountered = true;
|
|
3187
3187
|
}
|
|
3188
3188
|
address.push(":");
|
|
3189
3189
|
continue;
|
|
3190
3190
|
} else if (cursor === "%") {
|
|
3191
|
-
if (!consume(buffer, address,
|
|
3191
|
+
if (!consume(buffer, address, output2)) {
|
|
3192
3192
|
break;
|
|
3193
3193
|
}
|
|
3194
3194
|
consume = consumeIsZone;
|
|
@@ -3199,15 +3199,15 @@ var require_utils = __commonJS({
|
|
|
3199
3199
|
}
|
|
3200
3200
|
if (buffer.length) {
|
|
3201
3201
|
if (consume === consumeIsZone) {
|
|
3202
|
-
|
|
3202
|
+
output2.zone = buffer.join("");
|
|
3203
3203
|
} else if (endIpv6) {
|
|
3204
3204
|
address.push(buffer.join(""));
|
|
3205
3205
|
} else {
|
|
3206
3206
|
address.push(stringArrayToHexStripped(buffer));
|
|
3207
3207
|
}
|
|
3208
3208
|
}
|
|
3209
|
-
|
|
3210
|
-
return
|
|
3209
|
+
output2.address = address.join("");
|
|
3210
|
+
return output2;
|
|
3211
3211
|
}
|
|
3212
3212
|
function normalizeIPv6(host) {
|
|
3213
3213
|
if (findToken(host, ":") < 2) {
|
|
@@ -3233,80 +3233,80 @@ var require_utils = __commonJS({
|
|
|
3233
3233
|
}
|
|
3234
3234
|
return ind;
|
|
3235
3235
|
}
|
|
3236
|
-
function removeDotSegments(
|
|
3237
|
-
let
|
|
3238
|
-
const
|
|
3236
|
+
function removeDotSegments(path10) {
|
|
3237
|
+
let input2 = path10;
|
|
3238
|
+
const output2 = [];
|
|
3239
3239
|
let nextSlash = -1;
|
|
3240
3240
|
let len = 0;
|
|
3241
|
-
while (len =
|
|
3241
|
+
while (len = input2.length) {
|
|
3242
3242
|
if (len === 1) {
|
|
3243
|
-
if (
|
|
3243
|
+
if (input2 === ".") {
|
|
3244
3244
|
break;
|
|
3245
|
-
} else if (
|
|
3246
|
-
|
|
3245
|
+
} else if (input2 === "/") {
|
|
3246
|
+
output2.push("/");
|
|
3247
3247
|
break;
|
|
3248
3248
|
} else {
|
|
3249
|
-
|
|
3249
|
+
output2.push(input2);
|
|
3250
3250
|
break;
|
|
3251
3251
|
}
|
|
3252
3252
|
} else if (len === 2) {
|
|
3253
|
-
if (
|
|
3254
|
-
if (
|
|
3253
|
+
if (input2[0] === ".") {
|
|
3254
|
+
if (input2[1] === ".") {
|
|
3255
3255
|
break;
|
|
3256
|
-
} else if (
|
|
3257
|
-
|
|
3256
|
+
} else if (input2[1] === "/") {
|
|
3257
|
+
input2 = input2.slice(2);
|
|
3258
3258
|
continue;
|
|
3259
3259
|
}
|
|
3260
|
-
} else if (
|
|
3261
|
-
if (
|
|
3262
|
-
|
|
3260
|
+
} else if (input2[0] === "/") {
|
|
3261
|
+
if (input2[1] === "." || input2[1] === "/") {
|
|
3262
|
+
output2.push("/");
|
|
3263
3263
|
break;
|
|
3264
3264
|
}
|
|
3265
3265
|
}
|
|
3266
3266
|
} else if (len === 3) {
|
|
3267
|
-
if (
|
|
3268
|
-
if (
|
|
3269
|
-
|
|
3267
|
+
if (input2 === "/..") {
|
|
3268
|
+
if (output2.length !== 0) {
|
|
3269
|
+
output2.pop();
|
|
3270
3270
|
}
|
|
3271
|
-
|
|
3271
|
+
output2.push("/");
|
|
3272
3272
|
break;
|
|
3273
3273
|
}
|
|
3274
3274
|
}
|
|
3275
|
-
if (
|
|
3276
|
-
if (
|
|
3277
|
-
if (
|
|
3278
|
-
|
|
3275
|
+
if (input2[0] === ".") {
|
|
3276
|
+
if (input2[1] === ".") {
|
|
3277
|
+
if (input2[2] === "/") {
|
|
3278
|
+
input2 = input2.slice(3);
|
|
3279
3279
|
continue;
|
|
3280
3280
|
}
|
|
3281
|
-
} else if (
|
|
3282
|
-
|
|
3281
|
+
} else if (input2[1] === "/") {
|
|
3282
|
+
input2 = input2.slice(2);
|
|
3283
3283
|
continue;
|
|
3284
3284
|
}
|
|
3285
|
-
} else if (
|
|
3286
|
-
if (
|
|
3287
|
-
if (
|
|
3288
|
-
|
|
3285
|
+
} else if (input2[0] === "/") {
|
|
3286
|
+
if (input2[1] === ".") {
|
|
3287
|
+
if (input2[2] === "/") {
|
|
3288
|
+
input2 = input2.slice(2);
|
|
3289
3289
|
continue;
|
|
3290
|
-
} else if (
|
|
3291
|
-
if (
|
|
3292
|
-
|
|
3293
|
-
if (
|
|
3294
|
-
|
|
3290
|
+
} else if (input2[2] === ".") {
|
|
3291
|
+
if (input2[3] === "/") {
|
|
3292
|
+
input2 = input2.slice(3);
|
|
3293
|
+
if (output2.length !== 0) {
|
|
3294
|
+
output2.pop();
|
|
3295
3295
|
}
|
|
3296
3296
|
continue;
|
|
3297
3297
|
}
|
|
3298
3298
|
}
|
|
3299
3299
|
}
|
|
3300
3300
|
}
|
|
3301
|
-
if ((nextSlash =
|
|
3302
|
-
|
|
3301
|
+
if ((nextSlash = input2.indexOf("/", 1)) === -1) {
|
|
3302
|
+
output2.push(input2);
|
|
3303
3303
|
break;
|
|
3304
3304
|
} else {
|
|
3305
|
-
|
|
3306
|
-
|
|
3305
|
+
output2.push(input2.slice(0, nextSlash));
|
|
3306
|
+
input2 = input2.slice(nextSlash);
|
|
3307
3307
|
}
|
|
3308
3308
|
}
|
|
3309
|
-
return
|
|
3309
|
+
return output2.join("");
|
|
3310
3310
|
}
|
|
3311
3311
|
function normalizeComponentEncoding(component, esc2) {
|
|
3312
3312
|
const func = esc2 !== true ? escape : unescape;
|
|
@@ -3433,8 +3433,8 @@ var require_schemes = __commonJS({
|
|
|
3433
3433
|
wsComponent.secure = void 0;
|
|
3434
3434
|
}
|
|
3435
3435
|
if (wsComponent.resourceName) {
|
|
3436
|
-
const [
|
|
3437
|
-
wsComponent.path =
|
|
3436
|
+
const [path10, query] = wsComponent.resourceName.split("?");
|
|
3437
|
+
wsComponent.path = path10 && path10 !== "/" ? path10 : void 0;
|
|
3438
3438
|
wsComponent.query = query;
|
|
3439
3439
|
wsComponent.resourceName = void 0;
|
|
3440
3440
|
}
|
|
@@ -12491,12 +12491,12 @@ var require_dist = __commonJS({
|
|
|
12491
12491
|
throw new Error(`Unknown format "${name}"`);
|
|
12492
12492
|
return f;
|
|
12493
12493
|
};
|
|
12494
|
-
function addFormats(ajv, list,
|
|
12494
|
+
function addFormats(ajv, list, fs9, exportName) {
|
|
12495
12495
|
var _a2;
|
|
12496
12496
|
var _b;
|
|
12497
12497
|
(_a2 = (_b = ajv.opts.code).formats) !== null && _a2 !== void 0 ? _a2 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
12498
12498
|
for (const f of list)
|
|
12499
|
-
ajv.addFormat(f,
|
|
12499
|
+
ajv.addFormat(f, fs9[f]);
|
|
12500
12500
|
}
|
|
12501
12501
|
module.exports = exports = formatsPlugin;
|
|
12502
12502
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -12509,8 +12509,8 @@ var require_windows = __commonJS({
|
|
|
12509
12509
|
"node_modules/isexe/windows.js"(exports, module) {
|
|
12510
12510
|
module.exports = isexe;
|
|
12511
12511
|
isexe.sync = sync;
|
|
12512
|
-
var
|
|
12513
|
-
function checkPathExt(
|
|
12512
|
+
var fs9 = __require("fs");
|
|
12513
|
+
function checkPathExt(path10, options) {
|
|
12514
12514
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
12515
12515
|
if (!pathext) {
|
|
12516
12516
|
return true;
|
|
@@ -12521,25 +12521,25 @@ var require_windows = __commonJS({
|
|
|
12521
12521
|
}
|
|
12522
12522
|
for (var i = 0; i < pathext.length; i++) {
|
|
12523
12523
|
var p = pathext[i].toLowerCase();
|
|
12524
|
-
if (p &&
|
|
12524
|
+
if (p && path10.substr(-p.length).toLowerCase() === p) {
|
|
12525
12525
|
return true;
|
|
12526
12526
|
}
|
|
12527
12527
|
}
|
|
12528
12528
|
return false;
|
|
12529
12529
|
}
|
|
12530
|
-
function checkStat(stat,
|
|
12530
|
+
function checkStat(stat, path10, options) {
|
|
12531
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12532
|
return false;
|
|
12533
12533
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path10, options);
|
|
12535
12535
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
12536
|
+
function isexe(path10, options, cb) {
|
|
12537
|
+
fs9.stat(path10, function(er, stat) {
|
|
12538
|
+
cb(er, er ? false : checkStat(stat, path10, options));
|
|
12539
12539
|
});
|
|
12540
12540
|
}
|
|
12541
|
-
function sync(
|
|
12542
|
-
return checkStat(
|
|
12541
|
+
function sync(path10, options) {
|
|
12542
|
+
return checkStat(fs9.statSync(path10), path10, options);
|
|
12543
12543
|
}
|
|
12544
12544
|
}
|
|
12545
12545
|
});
|
|
@@ -12549,14 +12549,14 @@ var require_mode = __commonJS({
|
|
|
12549
12549
|
"node_modules/isexe/mode.js"(exports, module) {
|
|
12550
12550
|
module.exports = isexe;
|
|
12551
12551
|
isexe.sync = sync;
|
|
12552
|
-
var
|
|
12553
|
-
function isexe(
|
|
12554
|
-
|
|
12552
|
+
var fs9 = __require("fs");
|
|
12553
|
+
function isexe(path10, options, cb) {
|
|
12554
|
+
fs9.stat(path10, function(er, stat) {
|
|
12555
12555
|
cb(er, er ? false : checkStat(stat, options));
|
|
12556
12556
|
});
|
|
12557
12557
|
}
|
|
12558
|
-
function sync(
|
|
12559
|
-
return checkStat(
|
|
12558
|
+
function sync(path10, options) {
|
|
12559
|
+
return checkStat(fs9.statSync(path10), options);
|
|
12560
12560
|
}
|
|
12561
12561
|
function checkStat(stat, options) {
|
|
12562
12562
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -12580,7 +12580,7 @@ var require_mode = __commonJS({
|
|
|
12580
12580
|
// node_modules/isexe/index.js
|
|
12581
12581
|
var require_isexe = __commonJS({
|
|
12582
12582
|
"node_modules/isexe/index.js"(exports, module) {
|
|
12583
|
-
var
|
|
12583
|
+
var fs9 = __require("fs");
|
|
12584
12584
|
var core;
|
|
12585
12585
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
12586
12586
|
core = require_windows();
|
|
@@ -12589,7 +12589,7 @@ var require_isexe = __commonJS({
|
|
|
12589
12589
|
}
|
|
12590
12590
|
module.exports = isexe;
|
|
12591
12591
|
isexe.sync = sync;
|
|
12592
|
-
function isexe(
|
|
12592
|
+
function isexe(path10, options, cb) {
|
|
12593
12593
|
if (typeof options === "function") {
|
|
12594
12594
|
cb = options;
|
|
12595
12595
|
options = {};
|
|
@@ -12599,7 +12599,7 @@ var require_isexe = __commonJS({
|
|
|
12599
12599
|
throw new TypeError("callback not provided");
|
|
12600
12600
|
}
|
|
12601
12601
|
return new Promise(function(resolve, reject) {
|
|
12602
|
-
isexe(
|
|
12602
|
+
isexe(path10, options || {}, function(er, is) {
|
|
12603
12603
|
if (er) {
|
|
12604
12604
|
reject(er);
|
|
12605
12605
|
} else {
|
|
@@ -12608,7 +12608,7 @@ var require_isexe = __commonJS({
|
|
|
12608
12608
|
});
|
|
12609
12609
|
});
|
|
12610
12610
|
}
|
|
12611
|
-
core(
|
|
12611
|
+
core(path10, options || {}, function(er, is) {
|
|
12612
12612
|
if (er) {
|
|
12613
12613
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
12614
12614
|
er = null;
|
|
@@ -12618,9 +12618,9 @@ var require_isexe = __commonJS({
|
|
|
12618
12618
|
cb(er, is);
|
|
12619
12619
|
});
|
|
12620
12620
|
}
|
|
12621
|
-
function sync(
|
|
12621
|
+
function sync(path10, options) {
|
|
12622
12622
|
try {
|
|
12623
|
-
return core.sync(
|
|
12623
|
+
return core.sync(path10, options || {});
|
|
12624
12624
|
} catch (er) {
|
|
12625
12625
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
12626
12626
|
return false;
|
|
@@ -12636,7 +12636,7 @@ var require_isexe = __commonJS({
|
|
|
12636
12636
|
var require_which = __commonJS({
|
|
12637
12637
|
"node_modules/which/which.js"(exports, module) {
|
|
12638
12638
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
12639
|
-
var
|
|
12639
|
+
var path10 = __require("path");
|
|
12640
12640
|
var COLON = isWindows ? ";" : ":";
|
|
12641
12641
|
var isexe = require_isexe();
|
|
12642
12642
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -12674,7 +12674,7 @@ var require_which = __commonJS({
|
|
|
12674
12674
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
12675
12675
|
const ppRaw = pathEnv[i];
|
|
12676
12676
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12677
|
-
const pCmd =
|
|
12677
|
+
const pCmd = path10.join(pathPart, cmd);
|
|
12678
12678
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12679
12679
|
resolve(subStep(p, i, 0));
|
|
12680
12680
|
});
|
|
@@ -12701,7 +12701,7 @@ var require_which = __commonJS({
|
|
|
12701
12701
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
12702
12702
|
const ppRaw = pathEnv[i];
|
|
12703
12703
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12704
|
-
const pCmd =
|
|
12704
|
+
const pCmd = path10.join(pathPart, cmd);
|
|
12705
12705
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12706
12706
|
for (let j = 0; j < pathExt.length; j++) {
|
|
12707
12707
|
const cur = p + pathExt[j];
|
|
@@ -12749,7 +12749,7 @@ var require_path_key = __commonJS({
|
|
|
12749
12749
|
var require_resolveCommand = __commonJS({
|
|
12750
12750
|
"node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
12751
12751
|
"use strict";
|
|
12752
|
-
var
|
|
12752
|
+
var path10 = __require("path");
|
|
12753
12753
|
var which = require_which();
|
|
12754
12754
|
var getPathKey = require_path_key();
|
|
12755
12755
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -12767,7 +12767,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12767
12767
|
try {
|
|
12768
12768
|
resolved = which.sync(parsed.command, {
|
|
12769
12769
|
path: env[getPathKey({ env })],
|
|
12770
|
-
pathExt: withoutPathExt ?
|
|
12770
|
+
pathExt: withoutPathExt ? path10.delimiter : void 0
|
|
12771
12771
|
});
|
|
12772
12772
|
} catch (e) {
|
|
12773
12773
|
} finally {
|
|
@@ -12776,7 +12776,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12776
12776
|
}
|
|
12777
12777
|
}
|
|
12778
12778
|
if (resolved) {
|
|
12779
|
-
resolved =
|
|
12779
|
+
resolved = path10.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
12780
12780
|
}
|
|
12781
12781
|
return resolved;
|
|
12782
12782
|
}
|
|
@@ -12830,8 +12830,8 @@ var require_shebang_command = __commonJS({
|
|
|
12830
12830
|
if (!match) {
|
|
12831
12831
|
return null;
|
|
12832
12832
|
}
|
|
12833
|
-
const [
|
|
12834
|
-
const binary =
|
|
12833
|
+
const [path10, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12834
|
+
const binary = path10.split("/").pop();
|
|
12835
12835
|
if (binary === "env") {
|
|
12836
12836
|
return argument;
|
|
12837
12837
|
}
|
|
@@ -12844,16 +12844,16 @@ var require_shebang_command = __commonJS({
|
|
|
12844
12844
|
var require_readShebang = __commonJS({
|
|
12845
12845
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
12846
12846
|
"use strict";
|
|
12847
|
-
var
|
|
12847
|
+
var fs9 = __require("fs");
|
|
12848
12848
|
var shebangCommand = require_shebang_command();
|
|
12849
12849
|
function readShebang(command) {
|
|
12850
12850
|
const size = 150;
|
|
12851
12851
|
const buffer = Buffer.alloc(size);
|
|
12852
12852
|
let fd;
|
|
12853
12853
|
try {
|
|
12854
|
-
fd =
|
|
12855
|
-
|
|
12856
|
-
|
|
12854
|
+
fd = fs9.openSync(command, "r");
|
|
12855
|
+
fs9.readSync(fd, buffer, 0, size, 0);
|
|
12856
|
+
fs9.closeSync(fd);
|
|
12857
12857
|
} catch (e) {
|
|
12858
12858
|
}
|
|
12859
12859
|
return shebangCommand(buffer.toString());
|
|
@@ -12866,7 +12866,7 @@ var require_readShebang = __commonJS({
|
|
|
12866
12866
|
var require_parse = __commonJS({
|
|
12867
12867
|
"node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
12868
12868
|
"use strict";
|
|
12869
|
-
var
|
|
12869
|
+
var path10 = __require("path");
|
|
12870
12870
|
var resolveCommand = require_resolveCommand();
|
|
12871
12871
|
var escape2 = require_escape();
|
|
12872
12872
|
var readShebang = require_readShebang();
|
|
@@ -12891,7 +12891,7 @@ var require_parse = __commonJS({
|
|
|
12891
12891
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
12892
12892
|
if (parsed.options.forceShell || needsShell) {
|
|
12893
12893
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
12894
|
-
parsed.command =
|
|
12894
|
+
parsed.command = path10.normalize(parsed.command);
|
|
12895
12895
|
parsed.command = escape2.command(parsed.command);
|
|
12896
12896
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
12897
12897
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -12987,7 +12987,7 @@ var require_cross_spawn = __commonJS({
|
|
|
12987
12987
|
enoent.hookChildProcess(spawned, parsed);
|
|
12988
12988
|
return spawned;
|
|
12989
12989
|
}
|
|
12990
|
-
function
|
|
12990
|
+
function spawnSync5(command, args, options) {
|
|
12991
12991
|
const parsed = parse3(command, args, options);
|
|
12992
12992
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
12993
12993
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
@@ -12995,16 +12995,12 @@ var require_cross_spawn = __commonJS({
|
|
|
12995
12995
|
}
|
|
12996
12996
|
module.exports = spawn3;
|
|
12997
12997
|
module.exports.spawn = spawn3;
|
|
12998
|
-
module.exports.sync =
|
|
12998
|
+
module.exports.sync = spawnSync5;
|
|
12999
12999
|
module.exports._parse = parse3;
|
|
13000
13000
|
module.exports._enoent = enoent;
|
|
13001
13001
|
}
|
|
13002
13002
|
});
|
|
13003
13003
|
|
|
13004
|
-
// src/maker/index.ts
|
|
13005
|
-
import fs7 from "node:fs";
|
|
13006
|
-
import path8 from "node:path";
|
|
13007
|
-
|
|
13008
13004
|
// src/maker/server/mcp.ts
|
|
13009
13005
|
import fs6 from "node:fs";
|
|
13010
13006
|
import path7 from "node:path";
|
|
@@ -13369,8 +13365,8 @@ function getErrorMap() {
|
|
|
13369
13365
|
|
|
13370
13366
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
13371
13367
|
var makeIssue = (params) => {
|
|
13372
|
-
const { data, path:
|
|
13373
|
-
const fullPath = [...
|
|
13368
|
+
const { data, path: path10, errorMaps, issueData } = params;
|
|
13369
|
+
const fullPath = [...path10, ...issueData.path || []];
|
|
13374
13370
|
const fullIssue = {
|
|
13375
13371
|
...issueData,
|
|
13376
13372
|
path: fullPath
|
|
@@ -13485,11 +13481,11 @@ var errorUtil;
|
|
|
13485
13481
|
|
|
13486
13482
|
// node_modules/zod/v3/types.js
|
|
13487
13483
|
var ParseInputLazyPath = class {
|
|
13488
|
-
constructor(parent, value,
|
|
13484
|
+
constructor(parent, value, path10, key) {
|
|
13489
13485
|
this._cachedPath = [];
|
|
13490
13486
|
this.parent = parent;
|
|
13491
13487
|
this.data = value;
|
|
13492
|
-
this._path =
|
|
13488
|
+
this._path = path10;
|
|
13493
13489
|
this._key = key;
|
|
13494
13490
|
}
|
|
13495
13491
|
get path() {
|
|
@@ -13549,41 +13545,41 @@ var ZodType = class {
|
|
|
13549
13545
|
get description() {
|
|
13550
13546
|
return this._def.description;
|
|
13551
13547
|
}
|
|
13552
|
-
_getType(
|
|
13553
|
-
return getParsedType(
|
|
13548
|
+
_getType(input2) {
|
|
13549
|
+
return getParsedType(input2.data);
|
|
13554
13550
|
}
|
|
13555
|
-
_getOrReturnCtx(
|
|
13551
|
+
_getOrReturnCtx(input2, ctx) {
|
|
13556
13552
|
return ctx || {
|
|
13557
|
-
common:
|
|
13558
|
-
data:
|
|
13559
|
-
parsedType: getParsedType(
|
|
13553
|
+
common: input2.parent.common,
|
|
13554
|
+
data: input2.data,
|
|
13555
|
+
parsedType: getParsedType(input2.data),
|
|
13560
13556
|
schemaErrorMap: this._def.errorMap,
|
|
13561
|
-
path:
|
|
13562
|
-
parent:
|
|
13557
|
+
path: input2.path,
|
|
13558
|
+
parent: input2.parent
|
|
13563
13559
|
};
|
|
13564
13560
|
}
|
|
13565
|
-
_processInputParams(
|
|
13561
|
+
_processInputParams(input2) {
|
|
13566
13562
|
return {
|
|
13567
13563
|
status: new ParseStatus(),
|
|
13568
13564
|
ctx: {
|
|
13569
|
-
common:
|
|
13570
|
-
data:
|
|
13571
|
-
parsedType: getParsedType(
|
|
13565
|
+
common: input2.parent.common,
|
|
13566
|
+
data: input2.data,
|
|
13567
|
+
parsedType: getParsedType(input2.data),
|
|
13572
13568
|
schemaErrorMap: this._def.errorMap,
|
|
13573
|
-
path:
|
|
13574
|
-
parent:
|
|
13569
|
+
path: input2.path,
|
|
13570
|
+
parent: input2.parent
|
|
13575
13571
|
}
|
|
13576
13572
|
};
|
|
13577
13573
|
}
|
|
13578
|
-
_parseSync(
|
|
13579
|
-
const result = this._parse(
|
|
13574
|
+
_parseSync(input2) {
|
|
13575
|
+
const result = this._parse(input2);
|
|
13580
13576
|
if (isAsync(result)) {
|
|
13581
13577
|
throw new Error("Synchronous parse encountered promise.");
|
|
13582
13578
|
}
|
|
13583
13579
|
return result;
|
|
13584
13580
|
}
|
|
13585
|
-
_parseAsync(
|
|
13586
|
-
const result = this._parse(
|
|
13581
|
+
_parseAsync(input2) {
|
|
13582
|
+
const result = this._parse(input2);
|
|
13587
13583
|
return Promise.resolve(result);
|
|
13588
13584
|
}
|
|
13589
13585
|
parse(data, params) {
|
|
@@ -13910,13 +13906,13 @@ function isValidCidr(ip, version2) {
|
|
|
13910
13906
|
return false;
|
|
13911
13907
|
}
|
|
13912
13908
|
var ZodString = class _ZodString2 extends ZodType {
|
|
13913
|
-
_parse(
|
|
13909
|
+
_parse(input2) {
|
|
13914
13910
|
if (this._def.coerce) {
|
|
13915
|
-
|
|
13911
|
+
input2.data = String(input2.data);
|
|
13916
13912
|
}
|
|
13917
|
-
const parsedType2 = this._getType(
|
|
13913
|
+
const parsedType2 = this._getType(input2);
|
|
13918
13914
|
if (parsedType2 !== ZodParsedType.string) {
|
|
13919
|
-
const ctx2 = this._getOrReturnCtx(
|
|
13915
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
13920
13916
|
addIssueToContext(ctx2, {
|
|
13921
13917
|
code: ZodIssueCode.invalid_type,
|
|
13922
13918
|
expected: ZodParsedType.string,
|
|
@@ -13928,8 +13924,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
13928
13924
|
let ctx = void 0;
|
|
13929
13925
|
for (const check2 of this._def.checks) {
|
|
13930
13926
|
if (check2.kind === "min") {
|
|
13931
|
-
if (
|
|
13932
|
-
ctx = this._getOrReturnCtx(
|
|
13927
|
+
if (input2.data.length < check2.value) {
|
|
13928
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
13933
13929
|
addIssueToContext(ctx, {
|
|
13934
13930
|
code: ZodIssueCode.too_small,
|
|
13935
13931
|
minimum: check2.value,
|
|
@@ -13941,8 +13937,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
13941
13937
|
status.dirty();
|
|
13942
13938
|
}
|
|
13943
13939
|
} else if (check2.kind === "max") {
|
|
13944
|
-
if (
|
|
13945
|
-
ctx = this._getOrReturnCtx(
|
|
13940
|
+
if (input2.data.length > check2.value) {
|
|
13941
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
13946
13942
|
addIssueToContext(ctx, {
|
|
13947
13943
|
code: ZodIssueCode.too_big,
|
|
13948
13944
|
maximum: check2.value,
|
|
@@ -13954,10 +13950,10 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
13954
13950
|
status.dirty();
|
|
13955
13951
|
}
|
|
13956
13952
|
} else if (check2.kind === "length") {
|
|
13957
|
-
const tooBig =
|
|
13958
|
-
const tooSmall =
|
|
13953
|
+
const tooBig = input2.data.length > check2.value;
|
|
13954
|
+
const tooSmall = input2.data.length < check2.value;
|
|
13959
13955
|
if (tooBig || tooSmall) {
|
|
13960
|
-
ctx = this._getOrReturnCtx(
|
|
13956
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
13961
13957
|
if (tooBig) {
|
|
13962
13958
|
addIssueToContext(ctx, {
|
|
13963
13959
|
code: ZodIssueCode.too_big,
|
|
@@ -13980,8 +13976,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
13980
13976
|
status.dirty();
|
|
13981
13977
|
}
|
|
13982
13978
|
} else if (check2.kind === "email") {
|
|
13983
|
-
if (!emailRegex.test(
|
|
13984
|
-
ctx = this._getOrReturnCtx(
|
|
13979
|
+
if (!emailRegex.test(input2.data)) {
|
|
13980
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
13985
13981
|
addIssueToContext(ctx, {
|
|
13986
13982
|
validation: "email",
|
|
13987
13983
|
code: ZodIssueCode.invalid_string,
|
|
@@ -13993,8 +13989,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
13993
13989
|
if (!emojiRegex) {
|
|
13994
13990
|
emojiRegex = new RegExp(_emojiRegex, "u");
|
|
13995
13991
|
}
|
|
13996
|
-
if (!emojiRegex.test(
|
|
13997
|
-
ctx = this._getOrReturnCtx(
|
|
13992
|
+
if (!emojiRegex.test(input2.data)) {
|
|
13993
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
13998
13994
|
addIssueToContext(ctx, {
|
|
13999
13995
|
validation: "emoji",
|
|
14000
13996
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14003,8 +13999,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14003
13999
|
status.dirty();
|
|
14004
14000
|
}
|
|
14005
14001
|
} else if (check2.kind === "uuid") {
|
|
14006
|
-
if (!uuidRegex.test(
|
|
14007
|
-
ctx = this._getOrReturnCtx(
|
|
14002
|
+
if (!uuidRegex.test(input2.data)) {
|
|
14003
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14008
14004
|
addIssueToContext(ctx, {
|
|
14009
14005
|
validation: "uuid",
|
|
14010
14006
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14013,8 +14009,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14013
14009
|
status.dirty();
|
|
14014
14010
|
}
|
|
14015
14011
|
} else if (check2.kind === "nanoid") {
|
|
14016
|
-
if (!nanoidRegex.test(
|
|
14017
|
-
ctx = this._getOrReturnCtx(
|
|
14012
|
+
if (!nanoidRegex.test(input2.data)) {
|
|
14013
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14018
14014
|
addIssueToContext(ctx, {
|
|
14019
14015
|
validation: "nanoid",
|
|
14020
14016
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14023,8 +14019,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14023
14019
|
status.dirty();
|
|
14024
14020
|
}
|
|
14025
14021
|
} else if (check2.kind === "cuid") {
|
|
14026
|
-
if (!cuidRegex.test(
|
|
14027
|
-
ctx = this._getOrReturnCtx(
|
|
14022
|
+
if (!cuidRegex.test(input2.data)) {
|
|
14023
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14028
14024
|
addIssueToContext(ctx, {
|
|
14029
14025
|
validation: "cuid",
|
|
14030
14026
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14033,8 +14029,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14033
14029
|
status.dirty();
|
|
14034
14030
|
}
|
|
14035
14031
|
} else if (check2.kind === "cuid2") {
|
|
14036
|
-
if (!cuid2Regex.test(
|
|
14037
|
-
ctx = this._getOrReturnCtx(
|
|
14032
|
+
if (!cuid2Regex.test(input2.data)) {
|
|
14033
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14038
14034
|
addIssueToContext(ctx, {
|
|
14039
14035
|
validation: "cuid2",
|
|
14040
14036
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14043,8 +14039,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14043
14039
|
status.dirty();
|
|
14044
14040
|
}
|
|
14045
14041
|
} else if (check2.kind === "ulid") {
|
|
14046
|
-
if (!ulidRegex.test(
|
|
14047
|
-
ctx = this._getOrReturnCtx(
|
|
14042
|
+
if (!ulidRegex.test(input2.data)) {
|
|
14043
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14048
14044
|
addIssueToContext(ctx, {
|
|
14049
14045
|
validation: "ulid",
|
|
14050
14046
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14054,9 +14050,9 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14054
14050
|
}
|
|
14055
14051
|
} else if (check2.kind === "url") {
|
|
14056
14052
|
try {
|
|
14057
|
-
new URL(
|
|
14053
|
+
new URL(input2.data);
|
|
14058
14054
|
} catch {
|
|
14059
|
-
ctx = this._getOrReturnCtx(
|
|
14055
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14060
14056
|
addIssueToContext(ctx, {
|
|
14061
14057
|
validation: "url",
|
|
14062
14058
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14066,9 +14062,9 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14066
14062
|
}
|
|
14067
14063
|
} else if (check2.kind === "regex") {
|
|
14068
14064
|
check2.regex.lastIndex = 0;
|
|
14069
|
-
const testResult = check2.regex.test(
|
|
14065
|
+
const testResult = check2.regex.test(input2.data);
|
|
14070
14066
|
if (!testResult) {
|
|
14071
|
-
ctx = this._getOrReturnCtx(
|
|
14067
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14072
14068
|
addIssueToContext(ctx, {
|
|
14073
14069
|
validation: "regex",
|
|
14074
14070
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14077,10 +14073,10 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14077
14073
|
status.dirty();
|
|
14078
14074
|
}
|
|
14079
14075
|
} else if (check2.kind === "trim") {
|
|
14080
|
-
|
|
14076
|
+
input2.data = input2.data.trim();
|
|
14081
14077
|
} else if (check2.kind === "includes") {
|
|
14082
|
-
if (!
|
|
14083
|
-
ctx = this._getOrReturnCtx(
|
|
14078
|
+
if (!input2.data.includes(check2.value, check2.position)) {
|
|
14079
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14084
14080
|
addIssueToContext(ctx, {
|
|
14085
14081
|
code: ZodIssueCode.invalid_string,
|
|
14086
14082
|
validation: { includes: check2.value, position: check2.position },
|
|
@@ -14089,12 +14085,12 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14089
14085
|
status.dirty();
|
|
14090
14086
|
}
|
|
14091
14087
|
} else if (check2.kind === "toLowerCase") {
|
|
14092
|
-
|
|
14088
|
+
input2.data = input2.data.toLowerCase();
|
|
14093
14089
|
} else if (check2.kind === "toUpperCase") {
|
|
14094
|
-
|
|
14090
|
+
input2.data = input2.data.toUpperCase();
|
|
14095
14091
|
} else if (check2.kind === "startsWith") {
|
|
14096
|
-
if (!
|
|
14097
|
-
ctx = this._getOrReturnCtx(
|
|
14092
|
+
if (!input2.data.startsWith(check2.value)) {
|
|
14093
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14098
14094
|
addIssueToContext(ctx, {
|
|
14099
14095
|
code: ZodIssueCode.invalid_string,
|
|
14100
14096
|
validation: { startsWith: check2.value },
|
|
@@ -14103,8 +14099,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14103
14099
|
status.dirty();
|
|
14104
14100
|
}
|
|
14105
14101
|
} else if (check2.kind === "endsWith") {
|
|
14106
|
-
if (!
|
|
14107
|
-
ctx = this._getOrReturnCtx(
|
|
14102
|
+
if (!input2.data.endsWith(check2.value)) {
|
|
14103
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14108
14104
|
addIssueToContext(ctx, {
|
|
14109
14105
|
code: ZodIssueCode.invalid_string,
|
|
14110
14106
|
validation: { endsWith: check2.value },
|
|
@@ -14114,8 +14110,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14114
14110
|
}
|
|
14115
14111
|
} else if (check2.kind === "datetime") {
|
|
14116
14112
|
const regex = datetimeRegex(check2);
|
|
14117
|
-
if (!regex.test(
|
|
14118
|
-
ctx = this._getOrReturnCtx(
|
|
14113
|
+
if (!regex.test(input2.data)) {
|
|
14114
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14119
14115
|
addIssueToContext(ctx, {
|
|
14120
14116
|
code: ZodIssueCode.invalid_string,
|
|
14121
14117
|
validation: "datetime",
|
|
@@ -14125,8 +14121,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14125
14121
|
}
|
|
14126
14122
|
} else if (check2.kind === "date") {
|
|
14127
14123
|
const regex = dateRegex;
|
|
14128
|
-
if (!regex.test(
|
|
14129
|
-
ctx = this._getOrReturnCtx(
|
|
14124
|
+
if (!regex.test(input2.data)) {
|
|
14125
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14130
14126
|
addIssueToContext(ctx, {
|
|
14131
14127
|
code: ZodIssueCode.invalid_string,
|
|
14132
14128
|
validation: "date",
|
|
@@ -14136,8 +14132,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14136
14132
|
}
|
|
14137
14133
|
} else if (check2.kind === "time") {
|
|
14138
14134
|
const regex = timeRegex(check2);
|
|
14139
|
-
if (!regex.test(
|
|
14140
|
-
ctx = this._getOrReturnCtx(
|
|
14135
|
+
if (!regex.test(input2.data)) {
|
|
14136
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14141
14137
|
addIssueToContext(ctx, {
|
|
14142
14138
|
code: ZodIssueCode.invalid_string,
|
|
14143
14139
|
validation: "time",
|
|
@@ -14146,8 +14142,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14146
14142
|
status.dirty();
|
|
14147
14143
|
}
|
|
14148
14144
|
} else if (check2.kind === "duration") {
|
|
14149
|
-
if (!durationRegex.test(
|
|
14150
|
-
ctx = this._getOrReturnCtx(
|
|
14145
|
+
if (!durationRegex.test(input2.data)) {
|
|
14146
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14151
14147
|
addIssueToContext(ctx, {
|
|
14152
14148
|
validation: "duration",
|
|
14153
14149
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14156,8 +14152,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14156
14152
|
status.dirty();
|
|
14157
14153
|
}
|
|
14158
14154
|
} else if (check2.kind === "ip") {
|
|
14159
|
-
if (!isValidIP(
|
|
14160
|
-
ctx = this._getOrReturnCtx(
|
|
14155
|
+
if (!isValidIP(input2.data, check2.version)) {
|
|
14156
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14161
14157
|
addIssueToContext(ctx, {
|
|
14162
14158
|
validation: "ip",
|
|
14163
14159
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14166,8 +14162,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14166
14162
|
status.dirty();
|
|
14167
14163
|
}
|
|
14168
14164
|
} else if (check2.kind === "jwt") {
|
|
14169
|
-
if (!isValidJWT(
|
|
14170
|
-
ctx = this._getOrReturnCtx(
|
|
14165
|
+
if (!isValidJWT(input2.data, check2.alg)) {
|
|
14166
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14171
14167
|
addIssueToContext(ctx, {
|
|
14172
14168
|
validation: "jwt",
|
|
14173
14169
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14176,8 +14172,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14176
14172
|
status.dirty();
|
|
14177
14173
|
}
|
|
14178
14174
|
} else if (check2.kind === "cidr") {
|
|
14179
|
-
if (!isValidCidr(
|
|
14180
|
-
ctx = this._getOrReturnCtx(
|
|
14175
|
+
if (!isValidCidr(input2.data, check2.version)) {
|
|
14176
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14181
14177
|
addIssueToContext(ctx, {
|
|
14182
14178
|
validation: "cidr",
|
|
14183
14179
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14186,8 +14182,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14186
14182
|
status.dirty();
|
|
14187
14183
|
}
|
|
14188
14184
|
} else if (check2.kind === "base64") {
|
|
14189
|
-
if (!base64Regex.test(
|
|
14190
|
-
ctx = this._getOrReturnCtx(
|
|
14185
|
+
if (!base64Regex.test(input2.data)) {
|
|
14186
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14191
14187
|
addIssueToContext(ctx, {
|
|
14192
14188
|
validation: "base64",
|
|
14193
14189
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14196,8 +14192,8 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14196
14192
|
status.dirty();
|
|
14197
14193
|
}
|
|
14198
14194
|
} else if (check2.kind === "base64url") {
|
|
14199
|
-
if (!base64urlRegex.test(
|
|
14200
|
-
ctx = this._getOrReturnCtx(
|
|
14195
|
+
if (!base64urlRegex.test(input2.data)) {
|
|
14196
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14201
14197
|
addIssueToContext(ctx, {
|
|
14202
14198
|
validation: "base64url",
|
|
14203
14199
|
code: ZodIssueCode.invalid_string,
|
|
@@ -14209,7 +14205,7 @@ var ZodString = class _ZodString2 extends ZodType {
|
|
|
14209
14205
|
util.assertNever(check2);
|
|
14210
14206
|
}
|
|
14211
14207
|
}
|
|
14212
|
-
return { status: status.value, value:
|
|
14208
|
+
return { status: status.value, value: input2.data };
|
|
14213
14209
|
}
|
|
14214
14210
|
_regex(regex, validation, message) {
|
|
14215
14211
|
return this.refinement((data) => regex.test(data), {
|
|
@@ -14470,13 +14466,13 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
14470
14466
|
this.max = this.lte;
|
|
14471
14467
|
this.step = this.multipleOf;
|
|
14472
14468
|
}
|
|
14473
|
-
_parse(
|
|
14469
|
+
_parse(input2) {
|
|
14474
14470
|
if (this._def.coerce) {
|
|
14475
|
-
|
|
14471
|
+
input2.data = Number(input2.data);
|
|
14476
14472
|
}
|
|
14477
|
-
const parsedType2 = this._getType(
|
|
14473
|
+
const parsedType2 = this._getType(input2);
|
|
14478
14474
|
if (parsedType2 !== ZodParsedType.number) {
|
|
14479
|
-
const ctx2 = this._getOrReturnCtx(
|
|
14475
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
14480
14476
|
addIssueToContext(ctx2, {
|
|
14481
14477
|
code: ZodIssueCode.invalid_type,
|
|
14482
14478
|
expected: ZodParsedType.number,
|
|
@@ -14488,8 +14484,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
14488
14484
|
const status = new ParseStatus();
|
|
14489
14485
|
for (const check2 of this._def.checks) {
|
|
14490
14486
|
if (check2.kind === "int") {
|
|
14491
|
-
if (!util.isInteger(
|
|
14492
|
-
ctx = this._getOrReturnCtx(
|
|
14487
|
+
if (!util.isInteger(input2.data)) {
|
|
14488
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14493
14489
|
addIssueToContext(ctx, {
|
|
14494
14490
|
code: ZodIssueCode.invalid_type,
|
|
14495
14491
|
expected: "integer",
|
|
@@ -14499,9 +14495,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
14499
14495
|
status.dirty();
|
|
14500
14496
|
}
|
|
14501
14497
|
} else if (check2.kind === "min") {
|
|
14502
|
-
const tooSmall = check2.inclusive ?
|
|
14498
|
+
const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value;
|
|
14503
14499
|
if (tooSmall) {
|
|
14504
|
-
ctx = this._getOrReturnCtx(
|
|
14500
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14505
14501
|
addIssueToContext(ctx, {
|
|
14506
14502
|
code: ZodIssueCode.too_small,
|
|
14507
14503
|
minimum: check2.value,
|
|
@@ -14513,9 +14509,9 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
14513
14509
|
status.dirty();
|
|
14514
14510
|
}
|
|
14515
14511
|
} else if (check2.kind === "max") {
|
|
14516
|
-
const tooBig = check2.inclusive ?
|
|
14512
|
+
const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value;
|
|
14517
14513
|
if (tooBig) {
|
|
14518
|
-
ctx = this._getOrReturnCtx(
|
|
14514
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14519
14515
|
addIssueToContext(ctx, {
|
|
14520
14516
|
code: ZodIssueCode.too_big,
|
|
14521
14517
|
maximum: check2.value,
|
|
@@ -14527,8 +14523,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
14527
14523
|
status.dirty();
|
|
14528
14524
|
}
|
|
14529
14525
|
} else if (check2.kind === "multipleOf") {
|
|
14530
|
-
if (floatSafeRemainder(
|
|
14531
|
-
ctx = this._getOrReturnCtx(
|
|
14526
|
+
if (floatSafeRemainder(input2.data, check2.value) !== 0) {
|
|
14527
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14532
14528
|
addIssueToContext(ctx, {
|
|
14533
14529
|
code: ZodIssueCode.not_multiple_of,
|
|
14534
14530
|
multipleOf: check2.value,
|
|
@@ -14537,8 +14533,8 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
14537
14533
|
status.dirty();
|
|
14538
14534
|
}
|
|
14539
14535
|
} else if (check2.kind === "finite") {
|
|
14540
|
-
if (!Number.isFinite(
|
|
14541
|
-
ctx = this._getOrReturnCtx(
|
|
14536
|
+
if (!Number.isFinite(input2.data)) {
|
|
14537
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14542
14538
|
addIssueToContext(ctx, {
|
|
14543
14539
|
code: ZodIssueCode.not_finite,
|
|
14544
14540
|
message: check2.message
|
|
@@ -14549,7 +14545,7 @@ var ZodNumber = class _ZodNumber extends ZodType {
|
|
|
14549
14545
|
util.assertNever(check2);
|
|
14550
14546
|
}
|
|
14551
14547
|
}
|
|
14552
|
-
return { status: status.value, value:
|
|
14548
|
+
return { status: status.value, value: input2.data };
|
|
14553
14549
|
}
|
|
14554
14550
|
gte(value, message) {
|
|
14555
14551
|
return this.setLimit("min", value, true, errorUtil.toString(message));
|
|
@@ -14701,25 +14697,25 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
14701
14697
|
this.min = this.gte;
|
|
14702
14698
|
this.max = this.lte;
|
|
14703
14699
|
}
|
|
14704
|
-
_parse(
|
|
14700
|
+
_parse(input2) {
|
|
14705
14701
|
if (this._def.coerce) {
|
|
14706
14702
|
try {
|
|
14707
|
-
|
|
14703
|
+
input2.data = BigInt(input2.data);
|
|
14708
14704
|
} catch {
|
|
14709
|
-
return this._getInvalidInput(
|
|
14705
|
+
return this._getInvalidInput(input2);
|
|
14710
14706
|
}
|
|
14711
14707
|
}
|
|
14712
|
-
const parsedType2 = this._getType(
|
|
14708
|
+
const parsedType2 = this._getType(input2);
|
|
14713
14709
|
if (parsedType2 !== ZodParsedType.bigint) {
|
|
14714
|
-
return this._getInvalidInput(
|
|
14710
|
+
return this._getInvalidInput(input2);
|
|
14715
14711
|
}
|
|
14716
14712
|
let ctx = void 0;
|
|
14717
14713
|
const status = new ParseStatus();
|
|
14718
14714
|
for (const check2 of this._def.checks) {
|
|
14719
14715
|
if (check2.kind === "min") {
|
|
14720
|
-
const tooSmall = check2.inclusive ?
|
|
14716
|
+
const tooSmall = check2.inclusive ? input2.data < check2.value : input2.data <= check2.value;
|
|
14721
14717
|
if (tooSmall) {
|
|
14722
|
-
ctx = this._getOrReturnCtx(
|
|
14718
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14723
14719
|
addIssueToContext(ctx, {
|
|
14724
14720
|
code: ZodIssueCode.too_small,
|
|
14725
14721
|
type: "bigint",
|
|
@@ -14730,9 +14726,9 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
14730
14726
|
status.dirty();
|
|
14731
14727
|
}
|
|
14732
14728
|
} else if (check2.kind === "max") {
|
|
14733
|
-
const tooBig = check2.inclusive ?
|
|
14729
|
+
const tooBig = check2.inclusive ? input2.data > check2.value : input2.data >= check2.value;
|
|
14734
14730
|
if (tooBig) {
|
|
14735
|
-
ctx = this._getOrReturnCtx(
|
|
14731
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14736
14732
|
addIssueToContext(ctx, {
|
|
14737
14733
|
code: ZodIssueCode.too_big,
|
|
14738
14734
|
type: "bigint",
|
|
@@ -14743,8 +14739,8 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
14743
14739
|
status.dirty();
|
|
14744
14740
|
}
|
|
14745
14741
|
} else if (check2.kind === "multipleOf") {
|
|
14746
|
-
if (
|
|
14747
|
-
ctx = this._getOrReturnCtx(
|
|
14742
|
+
if (input2.data % check2.value !== BigInt(0)) {
|
|
14743
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14748
14744
|
addIssueToContext(ctx, {
|
|
14749
14745
|
code: ZodIssueCode.not_multiple_of,
|
|
14750
14746
|
multipleOf: check2.value,
|
|
@@ -14756,10 +14752,10 @@ var ZodBigInt = class _ZodBigInt extends ZodType {
|
|
|
14756
14752
|
util.assertNever(check2);
|
|
14757
14753
|
}
|
|
14758
14754
|
}
|
|
14759
|
-
return { status: status.value, value:
|
|
14755
|
+
return { status: status.value, value: input2.data };
|
|
14760
14756
|
}
|
|
14761
|
-
_getInvalidInput(
|
|
14762
|
-
const ctx = this._getOrReturnCtx(
|
|
14757
|
+
_getInvalidInput(input2) {
|
|
14758
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
14763
14759
|
addIssueToContext(ctx, {
|
|
14764
14760
|
code: ZodIssueCode.invalid_type,
|
|
14765
14761
|
expected: ZodParsedType.bigint,
|
|
@@ -14868,13 +14864,13 @@ ZodBigInt.create = (params) => {
|
|
|
14868
14864
|
});
|
|
14869
14865
|
};
|
|
14870
14866
|
var ZodBoolean = class extends ZodType {
|
|
14871
|
-
_parse(
|
|
14867
|
+
_parse(input2) {
|
|
14872
14868
|
if (this._def.coerce) {
|
|
14873
|
-
|
|
14869
|
+
input2.data = Boolean(input2.data);
|
|
14874
14870
|
}
|
|
14875
|
-
const parsedType2 = this._getType(
|
|
14871
|
+
const parsedType2 = this._getType(input2);
|
|
14876
14872
|
if (parsedType2 !== ZodParsedType.boolean) {
|
|
14877
|
-
const ctx = this._getOrReturnCtx(
|
|
14873
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
14878
14874
|
addIssueToContext(ctx, {
|
|
14879
14875
|
code: ZodIssueCode.invalid_type,
|
|
14880
14876
|
expected: ZodParsedType.boolean,
|
|
@@ -14882,7 +14878,7 @@ var ZodBoolean = class extends ZodType {
|
|
|
14882
14878
|
});
|
|
14883
14879
|
return INVALID;
|
|
14884
14880
|
}
|
|
14885
|
-
return OK(
|
|
14881
|
+
return OK(input2.data);
|
|
14886
14882
|
}
|
|
14887
14883
|
};
|
|
14888
14884
|
ZodBoolean.create = (params) => {
|
|
@@ -14893,13 +14889,13 @@ ZodBoolean.create = (params) => {
|
|
|
14893
14889
|
});
|
|
14894
14890
|
};
|
|
14895
14891
|
var ZodDate = class _ZodDate extends ZodType {
|
|
14896
|
-
_parse(
|
|
14892
|
+
_parse(input2) {
|
|
14897
14893
|
if (this._def.coerce) {
|
|
14898
|
-
|
|
14894
|
+
input2.data = new Date(input2.data);
|
|
14899
14895
|
}
|
|
14900
|
-
const parsedType2 = this._getType(
|
|
14896
|
+
const parsedType2 = this._getType(input2);
|
|
14901
14897
|
if (parsedType2 !== ZodParsedType.date) {
|
|
14902
|
-
const ctx2 = this._getOrReturnCtx(
|
|
14898
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
14903
14899
|
addIssueToContext(ctx2, {
|
|
14904
14900
|
code: ZodIssueCode.invalid_type,
|
|
14905
14901
|
expected: ZodParsedType.date,
|
|
@@ -14907,8 +14903,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
14907
14903
|
});
|
|
14908
14904
|
return INVALID;
|
|
14909
14905
|
}
|
|
14910
|
-
if (Number.isNaN(
|
|
14911
|
-
const ctx2 = this._getOrReturnCtx(
|
|
14906
|
+
if (Number.isNaN(input2.data.getTime())) {
|
|
14907
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
14912
14908
|
addIssueToContext(ctx2, {
|
|
14913
14909
|
code: ZodIssueCode.invalid_date
|
|
14914
14910
|
});
|
|
@@ -14918,8 +14914,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
14918
14914
|
let ctx = void 0;
|
|
14919
14915
|
for (const check2 of this._def.checks) {
|
|
14920
14916
|
if (check2.kind === "min") {
|
|
14921
|
-
if (
|
|
14922
|
-
ctx = this._getOrReturnCtx(
|
|
14917
|
+
if (input2.data.getTime() < check2.value) {
|
|
14918
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14923
14919
|
addIssueToContext(ctx, {
|
|
14924
14920
|
code: ZodIssueCode.too_small,
|
|
14925
14921
|
message: check2.message,
|
|
@@ -14931,8 +14927,8 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
14931
14927
|
status.dirty();
|
|
14932
14928
|
}
|
|
14933
14929
|
} else if (check2.kind === "max") {
|
|
14934
|
-
if (
|
|
14935
|
-
ctx = this._getOrReturnCtx(
|
|
14930
|
+
if (input2.data.getTime() > check2.value) {
|
|
14931
|
+
ctx = this._getOrReturnCtx(input2, ctx);
|
|
14936
14932
|
addIssueToContext(ctx, {
|
|
14937
14933
|
code: ZodIssueCode.too_big,
|
|
14938
14934
|
message: check2.message,
|
|
@@ -14949,7 +14945,7 @@ var ZodDate = class _ZodDate extends ZodType {
|
|
|
14949
14945
|
}
|
|
14950
14946
|
return {
|
|
14951
14947
|
status: status.value,
|
|
14952
|
-
value: new Date(
|
|
14948
|
+
value: new Date(input2.data.getTime())
|
|
14953
14949
|
};
|
|
14954
14950
|
}
|
|
14955
14951
|
_addCheck(check2) {
|
|
@@ -15002,10 +14998,10 @@ ZodDate.create = (params) => {
|
|
|
15002
14998
|
});
|
|
15003
14999
|
};
|
|
15004
15000
|
var ZodSymbol = class extends ZodType {
|
|
15005
|
-
_parse(
|
|
15006
|
-
const parsedType2 = this._getType(
|
|
15001
|
+
_parse(input2) {
|
|
15002
|
+
const parsedType2 = this._getType(input2);
|
|
15007
15003
|
if (parsedType2 !== ZodParsedType.symbol) {
|
|
15008
|
-
const ctx = this._getOrReturnCtx(
|
|
15004
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
15009
15005
|
addIssueToContext(ctx, {
|
|
15010
15006
|
code: ZodIssueCode.invalid_type,
|
|
15011
15007
|
expected: ZodParsedType.symbol,
|
|
@@ -15013,7 +15009,7 @@ var ZodSymbol = class extends ZodType {
|
|
|
15013
15009
|
});
|
|
15014
15010
|
return INVALID;
|
|
15015
15011
|
}
|
|
15016
|
-
return OK(
|
|
15012
|
+
return OK(input2.data);
|
|
15017
15013
|
}
|
|
15018
15014
|
};
|
|
15019
15015
|
ZodSymbol.create = (params) => {
|
|
@@ -15023,10 +15019,10 @@ ZodSymbol.create = (params) => {
|
|
|
15023
15019
|
});
|
|
15024
15020
|
};
|
|
15025
15021
|
var ZodUndefined = class extends ZodType {
|
|
15026
|
-
_parse(
|
|
15027
|
-
const parsedType2 = this._getType(
|
|
15022
|
+
_parse(input2) {
|
|
15023
|
+
const parsedType2 = this._getType(input2);
|
|
15028
15024
|
if (parsedType2 !== ZodParsedType.undefined) {
|
|
15029
|
-
const ctx = this._getOrReturnCtx(
|
|
15025
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
15030
15026
|
addIssueToContext(ctx, {
|
|
15031
15027
|
code: ZodIssueCode.invalid_type,
|
|
15032
15028
|
expected: ZodParsedType.undefined,
|
|
@@ -15034,7 +15030,7 @@ var ZodUndefined = class extends ZodType {
|
|
|
15034
15030
|
});
|
|
15035
15031
|
return INVALID;
|
|
15036
15032
|
}
|
|
15037
|
-
return OK(
|
|
15033
|
+
return OK(input2.data);
|
|
15038
15034
|
}
|
|
15039
15035
|
};
|
|
15040
15036
|
ZodUndefined.create = (params) => {
|
|
@@ -15044,10 +15040,10 @@ ZodUndefined.create = (params) => {
|
|
|
15044
15040
|
});
|
|
15045
15041
|
};
|
|
15046
15042
|
var ZodNull = class extends ZodType {
|
|
15047
|
-
_parse(
|
|
15048
|
-
const parsedType2 = this._getType(
|
|
15043
|
+
_parse(input2) {
|
|
15044
|
+
const parsedType2 = this._getType(input2);
|
|
15049
15045
|
if (parsedType2 !== ZodParsedType.null) {
|
|
15050
|
-
const ctx = this._getOrReturnCtx(
|
|
15046
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
15051
15047
|
addIssueToContext(ctx, {
|
|
15052
15048
|
code: ZodIssueCode.invalid_type,
|
|
15053
15049
|
expected: ZodParsedType.null,
|
|
@@ -15055,7 +15051,7 @@ var ZodNull = class extends ZodType {
|
|
|
15055
15051
|
});
|
|
15056
15052
|
return INVALID;
|
|
15057
15053
|
}
|
|
15058
|
-
return OK(
|
|
15054
|
+
return OK(input2.data);
|
|
15059
15055
|
}
|
|
15060
15056
|
};
|
|
15061
15057
|
ZodNull.create = (params) => {
|
|
@@ -15069,8 +15065,8 @@ var ZodAny = class extends ZodType {
|
|
|
15069
15065
|
super(...arguments);
|
|
15070
15066
|
this._any = true;
|
|
15071
15067
|
}
|
|
15072
|
-
_parse(
|
|
15073
|
-
return OK(
|
|
15068
|
+
_parse(input2) {
|
|
15069
|
+
return OK(input2.data);
|
|
15074
15070
|
}
|
|
15075
15071
|
};
|
|
15076
15072
|
ZodAny.create = (params) => {
|
|
@@ -15084,8 +15080,8 @@ var ZodUnknown = class extends ZodType {
|
|
|
15084
15080
|
super(...arguments);
|
|
15085
15081
|
this._unknown = true;
|
|
15086
15082
|
}
|
|
15087
|
-
_parse(
|
|
15088
|
-
return OK(
|
|
15083
|
+
_parse(input2) {
|
|
15084
|
+
return OK(input2.data);
|
|
15089
15085
|
}
|
|
15090
15086
|
};
|
|
15091
15087
|
ZodUnknown.create = (params) => {
|
|
@@ -15095,8 +15091,8 @@ ZodUnknown.create = (params) => {
|
|
|
15095
15091
|
});
|
|
15096
15092
|
};
|
|
15097
15093
|
var ZodNever = class extends ZodType {
|
|
15098
|
-
_parse(
|
|
15099
|
-
const ctx = this._getOrReturnCtx(
|
|
15094
|
+
_parse(input2) {
|
|
15095
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
15100
15096
|
addIssueToContext(ctx, {
|
|
15101
15097
|
code: ZodIssueCode.invalid_type,
|
|
15102
15098
|
expected: ZodParsedType.never,
|
|
@@ -15112,10 +15108,10 @@ ZodNever.create = (params) => {
|
|
|
15112
15108
|
});
|
|
15113
15109
|
};
|
|
15114
15110
|
var ZodVoid = class extends ZodType {
|
|
15115
|
-
_parse(
|
|
15116
|
-
const parsedType2 = this._getType(
|
|
15111
|
+
_parse(input2) {
|
|
15112
|
+
const parsedType2 = this._getType(input2);
|
|
15117
15113
|
if (parsedType2 !== ZodParsedType.undefined) {
|
|
15118
|
-
const ctx = this._getOrReturnCtx(
|
|
15114
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
15119
15115
|
addIssueToContext(ctx, {
|
|
15120
15116
|
code: ZodIssueCode.invalid_type,
|
|
15121
15117
|
expected: ZodParsedType.void,
|
|
@@ -15123,7 +15119,7 @@ var ZodVoid = class extends ZodType {
|
|
|
15123
15119
|
});
|
|
15124
15120
|
return INVALID;
|
|
15125
15121
|
}
|
|
15126
|
-
return OK(
|
|
15122
|
+
return OK(input2.data);
|
|
15127
15123
|
}
|
|
15128
15124
|
};
|
|
15129
15125
|
ZodVoid.create = (params) => {
|
|
@@ -15133,8 +15129,8 @@ ZodVoid.create = (params) => {
|
|
|
15133
15129
|
});
|
|
15134
15130
|
};
|
|
15135
15131
|
var ZodArray = class _ZodArray extends ZodType {
|
|
15136
|
-
_parse(
|
|
15137
|
-
const { ctx, status } = this._processInputParams(
|
|
15132
|
+
_parse(input2) {
|
|
15133
|
+
const { ctx, status } = this._processInputParams(input2);
|
|
15138
15134
|
const def = this._def;
|
|
15139
15135
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
15140
15136
|
addIssueToContext(ctx, {
|
|
@@ -15274,10 +15270,10 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
15274
15270
|
this._cached = { shape, keys };
|
|
15275
15271
|
return this._cached;
|
|
15276
15272
|
}
|
|
15277
|
-
_parse(
|
|
15278
|
-
const parsedType2 = this._getType(
|
|
15273
|
+
_parse(input2) {
|
|
15274
|
+
const parsedType2 = this._getType(input2);
|
|
15279
15275
|
if (parsedType2 !== ZodParsedType.object) {
|
|
15280
|
-
const ctx2 = this._getOrReturnCtx(
|
|
15276
|
+
const ctx2 = this._getOrReturnCtx(input2);
|
|
15281
15277
|
addIssueToContext(ctx2, {
|
|
15282
15278
|
code: ZodIssueCode.invalid_type,
|
|
15283
15279
|
expected: ZodParsedType.object,
|
|
@@ -15285,7 +15281,7 @@ var ZodObject = class _ZodObject extends ZodType {
|
|
|
15285
15281
|
});
|
|
15286
15282
|
return INVALID;
|
|
15287
15283
|
}
|
|
15288
|
-
const { status, ctx } = this._processInputParams(
|
|
15284
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
15289
15285
|
const { shape, keys: shapeKeys } = this._getCached();
|
|
15290
15286
|
const extraKeys = [];
|
|
15291
15287
|
if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
|
|
@@ -15599,8 +15595,8 @@ ZodObject.lazycreate = (shape, params) => {
|
|
|
15599
15595
|
});
|
|
15600
15596
|
};
|
|
15601
15597
|
var ZodUnion = class extends ZodType {
|
|
15602
|
-
_parse(
|
|
15603
|
-
const { ctx } = this._processInputParams(
|
|
15598
|
+
_parse(input2) {
|
|
15599
|
+
const { ctx } = this._processInputParams(input2);
|
|
15604
15600
|
const options = this._def.options;
|
|
15605
15601
|
function handleResults(results) {
|
|
15606
15602
|
for (const result of results) {
|
|
@@ -15721,8 +15717,8 @@ var getDiscriminator = (type) => {
|
|
|
15721
15717
|
}
|
|
15722
15718
|
};
|
|
15723
15719
|
var ZodDiscriminatedUnion = class _ZodDiscriminatedUnion extends ZodType {
|
|
15724
|
-
_parse(
|
|
15725
|
-
const { ctx } = this._processInputParams(
|
|
15720
|
+
_parse(input2) {
|
|
15721
|
+
const { ctx } = this._processInputParams(input2);
|
|
15726
15722
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
15727
15723
|
addIssueToContext(ctx, {
|
|
15728
15724
|
code: ZodIssueCode.invalid_type,
|
|
@@ -15835,8 +15831,8 @@ function mergeValues(a, b) {
|
|
|
15835
15831
|
}
|
|
15836
15832
|
}
|
|
15837
15833
|
var ZodIntersection = class extends ZodType {
|
|
15838
|
-
_parse(
|
|
15839
|
-
const { status, ctx } = this._processInputParams(
|
|
15834
|
+
_parse(input2) {
|
|
15835
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
15840
15836
|
const handleParsed = (parsedLeft, parsedRight) => {
|
|
15841
15837
|
if (isAborted(parsedLeft) || isAborted(parsedRight)) {
|
|
15842
15838
|
return INVALID;
|
|
@@ -15888,8 +15884,8 @@ ZodIntersection.create = (left, right, params) => {
|
|
|
15888
15884
|
});
|
|
15889
15885
|
};
|
|
15890
15886
|
var ZodTuple = class _ZodTuple extends ZodType {
|
|
15891
|
-
_parse(
|
|
15892
|
-
const { status, ctx } = this._processInputParams(
|
|
15887
|
+
_parse(input2) {
|
|
15888
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
15893
15889
|
if (ctx.parsedType !== ZodParsedType.array) {
|
|
15894
15890
|
addIssueToContext(ctx, {
|
|
15895
15891
|
code: ZodIssueCode.invalid_type,
|
|
@@ -15961,8 +15957,8 @@ var ZodRecord = class _ZodRecord extends ZodType {
|
|
|
15961
15957
|
get valueSchema() {
|
|
15962
15958
|
return this._def.valueType;
|
|
15963
15959
|
}
|
|
15964
|
-
_parse(
|
|
15965
|
-
const { status, ctx } = this._processInputParams(
|
|
15960
|
+
_parse(input2) {
|
|
15961
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
15966
15962
|
if (ctx.parsedType !== ZodParsedType.object) {
|
|
15967
15963
|
addIssueToContext(ctx, {
|
|
15968
15964
|
code: ZodIssueCode.invalid_type,
|
|
@@ -16014,8 +16010,8 @@ var ZodMap = class extends ZodType {
|
|
|
16014
16010
|
get valueSchema() {
|
|
16015
16011
|
return this._def.valueType;
|
|
16016
16012
|
}
|
|
16017
|
-
_parse(
|
|
16018
|
-
const { status, ctx } = this._processInputParams(
|
|
16013
|
+
_parse(input2) {
|
|
16014
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
16019
16015
|
if (ctx.parsedType !== ZodParsedType.map) {
|
|
16020
16016
|
addIssueToContext(ctx, {
|
|
16021
16017
|
code: ZodIssueCode.invalid_type,
|
|
@@ -16074,8 +16070,8 @@ ZodMap.create = (keyType, valueType, params) => {
|
|
|
16074
16070
|
});
|
|
16075
16071
|
};
|
|
16076
16072
|
var ZodSet = class _ZodSet extends ZodType {
|
|
16077
|
-
_parse(
|
|
16078
|
-
const { status, ctx } = this._processInputParams(
|
|
16073
|
+
_parse(input2) {
|
|
16074
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
16079
16075
|
if (ctx.parsedType !== ZodParsedType.set) {
|
|
16080
16076
|
addIssueToContext(ctx, {
|
|
16081
16077
|
code: ZodIssueCode.invalid_type,
|
|
@@ -16163,8 +16159,8 @@ var ZodFunction = class _ZodFunction extends ZodType {
|
|
|
16163
16159
|
super(...arguments);
|
|
16164
16160
|
this.validate = this.implement;
|
|
16165
16161
|
}
|
|
16166
|
-
_parse(
|
|
16167
|
-
const { ctx } = this._processInputParams(
|
|
16162
|
+
_parse(input2) {
|
|
16163
|
+
const { ctx } = this._processInputParams(input2);
|
|
16168
16164
|
if (ctx.parsedType !== ZodParsedType.function) {
|
|
16169
16165
|
addIssueToContext(ctx, {
|
|
16170
16166
|
code: ZodIssueCode.invalid_type,
|
|
@@ -16267,8 +16263,8 @@ var ZodLazy = class extends ZodType {
|
|
|
16267
16263
|
get schema() {
|
|
16268
16264
|
return this._def.getter();
|
|
16269
16265
|
}
|
|
16270
|
-
_parse(
|
|
16271
|
-
const { ctx } = this._processInputParams(
|
|
16266
|
+
_parse(input2) {
|
|
16267
|
+
const { ctx } = this._processInputParams(input2);
|
|
16272
16268
|
const lazySchema = this._def.getter();
|
|
16273
16269
|
return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
|
|
16274
16270
|
}
|
|
@@ -16281,9 +16277,9 @@ ZodLazy.create = (getter, params) => {
|
|
|
16281
16277
|
});
|
|
16282
16278
|
};
|
|
16283
16279
|
var ZodLiteral = class extends ZodType {
|
|
16284
|
-
_parse(
|
|
16285
|
-
if (
|
|
16286
|
-
const ctx = this._getOrReturnCtx(
|
|
16280
|
+
_parse(input2) {
|
|
16281
|
+
if (input2.data !== this._def.value) {
|
|
16282
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
16287
16283
|
addIssueToContext(ctx, {
|
|
16288
16284
|
received: ctx.data,
|
|
16289
16285
|
code: ZodIssueCode.invalid_literal,
|
|
@@ -16291,7 +16287,7 @@ var ZodLiteral = class extends ZodType {
|
|
|
16291
16287
|
});
|
|
16292
16288
|
return INVALID;
|
|
16293
16289
|
}
|
|
16294
|
-
return { status: "valid", value:
|
|
16290
|
+
return { status: "valid", value: input2.data };
|
|
16295
16291
|
}
|
|
16296
16292
|
get value() {
|
|
16297
16293
|
return this._def.value;
|
|
@@ -16312,9 +16308,9 @@ function createZodEnum(values, params) {
|
|
|
16312
16308
|
});
|
|
16313
16309
|
}
|
|
16314
16310
|
var ZodEnum = class _ZodEnum extends ZodType {
|
|
16315
|
-
_parse(
|
|
16316
|
-
if (typeof
|
|
16317
|
-
const ctx = this._getOrReturnCtx(
|
|
16311
|
+
_parse(input2) {
|
|
16312
|
+
if (typeof input2.data !== "string") {
|
|
16313
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
16318
16314
|
const expectedValues = this._def.values;
|
|
16319
16315
|
addIssueToContext(ctx, {
|
|
16320
16316
|
expected: util.joinValues(expectedValues),
|
|
@@ -16326,8 +16322,8 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
16326
16322
|
if (!this._cache) {
|
|
16327
16323
|
this._cache = new Set(this._def.values);
|
|
16328
16324
|
}
|
|
16329
|
-
if (!this._cache.has(
|
|
16330
|
-
const ctx = this._getOrReturnCtx(
|
|
16325
|
+
if (!this._cache.has(input2.data)) {
|
|
16326
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
16331
16327
|
const expectedValues = this._def.values;
|
|
16332
16328
|
addIssueToContext(ctx, {
|
|
16333
16329
|
received: ctx.data,
|
|
@@ -16336,7 +16332,7 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
16336
16332
|
});
|
|
16337
16333
|
return INVALID;
|
|
16338
16334
|
}
|
|
16339
|
-
return OK(
|
|
16335
|
+
return OK(input2.data);
|
|
16340
16336
|
}
|
|
16341
16337
|
get options() {
|
|
16342
16338
|
return this._def.values;
|
|
@@ -16377,9 +16373,9 @@ var ZodEnum = class _ZodEnum extends ZodType {
|
|
|
16377
16373
|
};
|
|
16378
16374
|
ZodEnum.create = createZodEnum;
|
|
16379
16375
|
var ZodNativeEnum = class extends ZodType {
|
|
16380
|
-
_parse(
|
|
16376
|
+
_parse(input2) {
|
|
16381
16377
|
const nativeEnumValues = util.getValidEnumValues(this._def.values);
|
|
16382
|
-
const ctx = this._getOrReturnCtx(
|
|
16378
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
16383
16379
|
if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
|
|
16384
16380
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
16385
16381
|
addIssueToContext(ctx, {
|
|
@@ -16392,7 +16388,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
16392
16388
|
if (!this._cache) {
|
|
16393
16389
|
this._cache = new Set(util.getValidEnumValues(this._def.values));
|
|
16394
16390
|
}
|
|
16395
|
-
if (!this._cache.has(
|
|
16391
|
+
if (!this._cache.has(input2.data)) {
|
|
16396
16392
|
const expectedValues = util.objectValues(nativeEnumValues);
|
|
16397
16393
|
addIssueToContext(ctx, {
|
|
16398
16394
|
received: ctx.data,
|
|
@@ -16401,7 +16397,7 @@ var ZodNativeEnum = class extends ZodType {
|
|
|
16401
16397
|
});
|
|
16402
16398
|
return INVALID;
|
|
16403
16399
|
}
|
|
16404
|
-
return OK(
|
|
16400
|
+
return OK(input2.data);
|
|
16405
16401
|
}
|
|
16406
16402
|
get enum() {
|
|
16407
16403
|
return this._def.values;
|
|
@@ -16418,8 +16414,8 @@ var ZodPromise = class extends ZodType {
|
|
|
16418
16414
|
unwrap() {
|
|
16419
16415
|
return this._def.type;
|
|
16420
16416
|
}
|
|
16421
|
-
_parse(
|
|
16422
|
-
const { ctx } = this._processInputParams(
|
|
16417
|
+
_parse(input2) {
|
|
16418
|
+
const { ctx } = this._processInputParams(input2);
|
|
16423
16419
|
if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
|
|
16424
16420
|
addIssueToContext(ctx, {
|
|
16425
16421
|
code: ZodIssueCode.invalid_type,
|
|
@@ -16451,8 +16447,8 @@ var ZodEffects = class extends ZodType {
|
|
|
16451
16447
|
sourceType() {
|
|
16452
16448
|
return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
16453
16449
|
}
|
|
16454
|
-
_parse(
|
|
16455
|
-
const { status, ctx } = this._processInputParams(
|
|
16450
|
+
_parse(input2) {
|
|
16451
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
16456
16452
|
const effect = this._def.effect || null;
|
|
16457
16453
|
const checkCtx = {
|
|
16458
16454
|
addIssue: (arg) => {
|
|
@@ -16584,12 +16580,12 @@ ZodEffects.createWithPreprocess = (preprocess2, schema, params) => {
|
|
|
16584
16580
|
});
|
|
16585
16581
|
};
|
|
16586
16582
|
var ZodOptional = class extends ZodType {
|
|
16587
|
-
_parse(
|
|
16588
|
-
const parsedType2 = this._getType(
|
|
16583
|
+
_parse(input2) {
|
|
16584
|
+
const parsedType2 = this._getType(input2);
|
|
16589
16585
|
if (parsedType2 === ZodParsedType.undefined) {
|
|
16590
16586
|
return OK(void 0);
|
|
16591
16587
|
}
|
|
16592
|
-
return this._def.innerType._parse(
|
|
16588
|
+
return this._def.innerType._parse(input2);
|
|
16593
16589
|
}
|
|
16594
16590
|
unwrap() {
|
|
16595
16591
|
return this._def.innerType;
|
|
@@ -16603,12 +16599,12 @@ ZodOptional.create = (type, params) => {
|
|
|
16603
16599
|
});
|
|
16604
16600
|
};
|
|
16605
16601
|
var ZodNullable = class extends ZodType {
|
|
16606
|
-
_parse(
|
|
16607
|
-
const parsedType2 = this._getType(
|
|
16602
|
+
_parse(input2) {
|
|
16603
|
+
const parsedType2 = this._getType(input2);
|
|
16608
16604
|
if (parsedType2 === ZodParsedType.null) {
|
|
16609
16605
|
return OK(null);
|
|
16610
16606
|
}
|
|
16611
|
-
return this._def.innerType._parse(
|
|
16607
|
+
return this._def.innerType._parse(input2);
|
|
16612
16608
|
}
|
|
16613
16609
|
unwrap() {
|
|
16614
16610
|
return this._def.innerType;
|
|
@@ -16622,8 +16618,8 @@ ZodNullable.create = (type, params) => {
|
|
|
16622
16618
|
});
|
|
16623
16619
|
};
|
|
16624
16620
|
var ZodDefault = class extends ZodType {
|
|
16625
|
-
_parse(
|
|
16626
|
-
const { ctx } = this._processInputParams(
|
|
16621
|
+
_parse(input2) {
|
|
16622
|
+
const { ctx } = this._processInputParams(input2);
|
|
16627
16623
|
let data = ctx.data;
|
|
16628
16624
|
if (ctx.parsedType === ZodParsedType.undefined) {
|
|
16629
16625
|
data = this._def.defaultValue();
|
|
@@ -16647,8 +16643,8 @@ ZodDefault.create = (type, params) => {
|
|
|
16647
16643
|
});
|
|
16648
16644
|
};
|
|
16649
16645
|
var ZodCatch = class extends ZodType {
|
|
16650
|
-
_parse(
|
|
16651
|
-
const { ctx } = this._processInputParams(
|
|
16646
|
+
_parse(input2) {
|
|
16647
|
+
const { ctx } = this._processInputParams(input2);
|
|
16652
16648
|
const newCtx = {
|
|
16653
16649
|
...ctx,
|
|
16654
16650
|
common: {
|
|
@@ -16700,10 +16696,10 @@ ZodCatch.create = (type, params) => {
|
|
|
16700
16696
|
});
|
|
16701
16697
|
};
|
|
16702
16698
|
var ZodNaN = class extends ZodType {
|
|
16703
|
-
_parse(
|
|
16704
|
-
const parsedType2 = this._getType(
|
|
16699
|
+
_parse(input2) {
|
|
16700
|
+
const parsedType2 = this._getType(input2);
|
|
16705
16701
|
if (parsedType2 !== ZodParsedType.nan) {
|
|
16706
|
-
const ctx = this._getOrReturnCtx(
|
|
16702
|
+
const ctx = this._getOrReturnCtx(input2);
|
|
16707
16703
|
addIssueToContext(ctx, {
|
|
16708
16704
|
code: ZodIssueCode.invalid_type,
|
|
16709
16705
|
expected: ZodParsedType.nan,
|
|
@@ -16711,7 +16707,7 @@ var ZodNaN = class extends ZodType {
|
|
|
16711
16707
|
});
|
|
16712
16708
|
return INVALID;
|
|
16713
16709
|
}
|
|
16714
|
-
return { status: "valid", value:
|
|
16710
|
+
return { status: "valid", value: input2.data };
|
|
16715
16711
|
}
|
|
16716
16712
|
};
|
|
16717
16713
|
ZodNaN.create = (params) => {
|
|
@@ -16722,8 +16718,8 @@ ZodNaN.create = (params) => {
|
|
|
16722
16718
|
};
|
|
16723
16719
|
var BRAND = Symbol("zod_brand");
|
|
16724
16720
|
var ZodBranded = class extends ZodType {
|
|
16725
|
-
_parse(
|
|
16726
|
-
const { ctx } = this._processInputParams(
|
|
16721
|
+
_parse(input2) {
|
|
16722
|
+
const { ctx } = this._processInputParams(input2);
|
|
16727
16723
|
const data = ctx.data;
|
|
16728
16724
|
return this._def.type._parse({
|
|
16729
16725
|
data,
|
|
@@ -16736,8 +16732,8 @@ var ZodBranded = class extends ZodType {
|
|
|
16736
16732
|
}
|
|
16737
16733
|
};
|
|
16738
16734
|
var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
16739
|
-
_parse(
|
|
16740
|
-
const { status, ctx } = this._processInputParams(
|
|
16735
|
+
_parse(input2) {
|
|
16736
|
+
const { status, ctx } = this._processInputParams(input2);
|
|
16741
16737
|
if (ctx.common.async) {
|
|
16742
16738
|
const handleAsync = async () => {
|
|
16743
16739
|
const inResult = await this._def.in._parseAsync({
|
|
@@ -16791,8 +16787,8 @@ var ZodPipeline = class _ZodPipeline extends ZodType {
|
|
|
16791
16787
|
}
|
|
16792
16788
|
};
|
|
16793
16789
|
var ZodReadonly = class extends ZodType {
|
|
16794
|
-
_parse(
|
|
16795
|
-
const result = this._def.innerType._parse(
|
|
16790
|
+
_parse(input2) {
|
|
16791
|
+
const result = this._def.innerType._parse(input2);
|
|
16796
16792
|
const freeze = (data) => {
|
|
16797
16793
|
if (isValid(data)) {
|
|
16798
16794
|
data.value = Object.freeze(data.value);
|
|
@@ -17070,8 +17066,8 @@ function cached(getter) {
|
|
|
17070
17066
|
}
|
|
17071
17067
|
};
|
|
17072
17068
|
}
|
|
17073
|
-
function nullish(
|
|
17074
|
-
return
|
|
17069
|
+
function nullish(input2) {
|
|
17070
|
+
return input2 === null || input2 === void 0;
|
|
17075
17071
|
}
|
|
17076
17072
|
function cleanRegex(source) {
|
|
17077
17073
|
const start = source.startsWith("^") ? 1 : 0;
|
|
@@ -17138,10 +17134,10 @@ function mergeDefs(...defs) {
|
|
|
17138
17134
|
function cloneDef(schema) {
|
|
17139
17135
|
return mergeDefs(schema._zod.def);
|
|
17140
17136
|
}
|
|
17141
|
-
function getElementAtPath(obj,
|
|
17142
|
-
if (!
|
|
17137
|
+
function getElementAtPath(obj, path10) {
|
|
17138
|
+
if (!path10)
|
|
17143
17139
|
return obj;
|
|
17144
|
-
return
|
|
17140
|
+
return path10.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
17145
17141
|
}
|
|
17146
17142
|
function promiseAllObject(promisesObj) {
|
|
17147
17143
|
const keys = Object.keys(promisesObj);
|
|
@@ -17165,8 +17161,8 @@ function randomString(length = 10) {
|
|
|
17165
17161
|
function esc(str) {
|
|
17166
17162
|
return JSON.stringify(str);
|
|
17167
17163
|
}
|
|
17168
|
-
function slugify(
|
|
17169
|
-
return
|
|
17164
|
+
function slugify(input2) {
|
|
17165
|
+
return input2.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
17170
17166
|
}
|
|
17171
17167
|
var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
|
|
17172
17168
|
};
|
|
@@ -17526,11 +17522,11 @@ function aborted(x, startIndex = 0) {
|
|
|
17526
17522
|
}
|
|
17527
17523
|
return false;
|
|
17528
17524
|
}
|
|
17529
|
-
function prefixIssues(
|
|
17525
|
+
function prefixIssues(path10, issues) {
|
|
17530
17526
|
return issues.map((iss) => {
|
|
17531
17527
|
var _a2;
|
|
17532
17528
|
(_a2 = iss).path ?? (_a2.path = []);
|
|
17533
|
-
iss.path.unshift(
|
|
17529
|
+
iss.path.unshift(path10);
|
|
17534
17530
|
return iss;
|
|
17535
17531
|
});
|
|
17536
17532
|
}
|
|
@@ -17551,19 +17547,19 @@ function finalizeIssue(iss, ctx, config2) {
|
|
|
17551
17547
|
}
|
|
17552
17548
|
return full;
|
|
17553
17549
|
}
|
|
17554
|
-
function getSizableOrigin(
|
|
17555
|
-
if (
|
|
17550
|
+
function getSizableOrigin(input2) {
|
|
17551
|
+
if (input2 instanceof Set)
|
|
17556
17552
|
return "set";
|
|
17557
|
-
if (
|
|
17553
|
+
if (input2 instanceof Map)
|
|
17558
17554
|
return "map";
|
|
17559
|
-
if (
|
|
17555
|
+
if (input2 instanceof File)
|
|
17560
17556
|
return "file";
|
|
17561
17557
|
return "unknown";
|
|
17562
17558
|
}
|
|
17563
|
-
function getLengthableOrigin(
|
|
17564
|
-
if (Array.isArray(
|
|
17559
|
+
function getLengthableOrigin(input2) {
|
|
17560
|
+
if (Array.isArray(input2))
|
|
17565
17561
|
return "array";
|
|
17566
|
-
if (typeof
|
|
17562
|
+
if (typeof input2 === "string")
|
|
17567
17563
|
return "string";
|
|
17568
17564
|
return "unknown";
|
|
17569
17565
|
}
|
|
@@ -17589,12 +17585,12 @@ function parsedType(data) {
|
|
|
17589
17585
|
return t;
|
|
17590
17586
|
}
|
|
17591
17587
|
function issue(...args) {
|
|
17592
|
-
const [iss,
|
|
17588
|
+
const [iss, input2, inst] = args;
|
|
17593
17589
|
if (typeof iss === "string") {
|
|
17594
17590
|
return {
|
|
17595
17591
|
message: iss,
|
|
17596
17592
|
code: "custom",
|
|
17597
|
-
input,
|
|
17593
|
+
input: input2,
|
|
17598
17594
|
inst
|
|
17599
17595
|
};
|
|
17600
17596
|
}
|
|
@@ -18056,23 +18052,23 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
18056
18052
|
bag.pattern = integer;
|
|
18057
18053
|
});
|
|
18058
18054
|
inst._zod.check = (payload) => {
|
|
18059
|
-
const
|
|
18055
|
+
const input2 = payload.value;
|
|
18060
18056
|
if (isInt) {
|
|
18061
|
-
if (!Number.isInteger(
|
|
18057
|
+
if (!Number.isInteger(input2)) {
|
|
18062
18058
|
payload.issues.push({
|
|
18063
18059
|
expected: origin,
|
|
18064
18060
|
format: def.format,
|
|
18065
18061
|
code: "invalid_type",
|
|
18066
18062
|
continue: false,
|
|
18067
|
-
input,
|
|
18063
|
+
input: input2,
|
|
18068
18064
|
inst
|
|
18069
18065
|
});
|
|
18070
18066
|
return;
|
|
18071
18067
|
}
|
|
18072
|
-
if (!Number.isSafeInteger(
|
|
18073
|
-
if (
|
|
18068
|
+
if (!Number.isSafeInteger(input2)) {
|
|
18069
|
+
if (input2 > 0) {
|
|
18074
18070
|
payload.issues.push({
|
|
18075
|
-
input,
|
|
18071
|
+
input: input2,
|
|
18076
18072
|
code: "too_big",
|
|
18077
18073
|
maximum: Number.MAX_SAFE_INTEGER,
|
|
18078
18074
|
note: "Integers must be within the safe integer range.",
|
|
@@ -18083,7 +18079,7 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
18083
18079
|
});
|
|
18084
18080
|
} else {
|
|
18085
18081
|
payload.issues.push({
|
|
18086
|
-
input,
|
|
18082
|
+
input: input2,
|
|
18087
18083
|
code: "too_small",
|
|
18088
18084
|
minimum: Number.MIN_SAFE_INTEGER,
|
|
18089
18085
|
note: "Integers must be within the safe integer range.",
|
|
@@ -18096,10 +18092,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
18096
18092
|
return;
|
|
18097
18093
|
}
|
|
18098
18094
|
}
|
|
18099
|
-
if (
|
|
18095
|
+
if (input2 < minimum) {
|
|
18100
18096
|
payload.issues.push({
|
|
18101
18097
|
origin: "number",
|
|
18102
|
-
input,
|
|
18098
|
+
input: input2,
|
|
18103
18099
|
code: "too_small",
|
|
18104
18100
|
minimum,
|
|
18105
18101
|
inclusive: true,
|
|
@@ -18107,10 +18103,10 @@ var $ZodCheckNumberFormat = /* @__PURE__ */ $constructor("$ZodCheckNumberFormat"
|
|
|
18107
18103
|
continue: !def.abort
|
|
18108
18104
|
});
|
|
18109
18105
|
}
|
|
18110
|
-
if (
|
|
18106
|
+
if (input2 > maximum) {
|
|
18111
18107
|
payload.issues.push({
|
|
18112
18108
|
origin: "number",
|
|
18113
|
-
input,
|
|
18109
|
+
input: input2,
|
|
18114
18110
|
code: "too_big",
|
|
18115
18111
|
maximum,
|
|
18116
18112
|
inclusive: true,
|
|
@@ -18130,11 +18126,11 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
18130
18126
|
bag.maximum = maximum;
|
|
18131
18127
|
});
|
|
18132
18128
|
inst._zod.check = (payload) => {
|
|
18133
|
-
const
|
|
18134
|
-
if (
|
|
18129
|
+
const input2 = payload.value;
|
|
18130
|
+
if (input2 < minimum) {
|
|
18135
18131
|
payload.issues.push({
|
|
18136
18132
|
origin: "bigint",
|
|
18137
|
-
input,
|
|
18133
|
+
input: input2,
|
|
18138
18134
|
code: "too_small",
|
|
18139
18135
|
minimum,
|
|
18140
18136
|
inclusive: true,
|
|
@@ -18142,10 +18138,10 @@ var $ZodCheckBigIntFormat = /* @__PURE__ */ $constructor("$ZodCheckBigIntFormat"
|
|
|
18142
18138
|
continue: !def.abort
|
|
18143
18139
|
});
|
|
18144
18140
|
}
|
|
18145
|
-
if (
|
|
18141
|
+
if (input2 > maximum) {
|
|
18146
18142
|
payload.issues.push({
|
|
18147
18143
|
origin: "bigint",
|
|
18148
|
-
input,
|
|
18144
|
+
input: input2,
|
|
18149
18145
|
code: "too_big",
|
|
18150
18146
|
maximum,
|
|
18151
18147
|
inclusive: true,
|
|
@@ -18168,16 +18164,16 @@ var $ZodCheckMaxSize = /* @__PURE__ */ $constructor("$ZodCheckMaxSize", (inst, d
|
|
|
18168
18164
|
inst2._zod.bag.maximum = def.maximum;
|
|
18169
18165
|
});
|
|
18170
18166
|
inst._zod.check = (payload) => {
|
|
18171
|
-
const
|
|
18172
|
-
const size =
|
|
18167
|
+
const input2 = payload.value;
|
|
18168
|
+
const size = input2.size;
|
|
18173
18169
|
if (size <= def.maximum)
|
|
18174
18170
|
return;
|
|
18175
18171
|
payload.issues.push({
|
|
18176
|
-
origin: getSizableOrigin(
|
|
18172
|
+
origin: getSizableOrigin(input2),
|
|
18177
18173
|
code: "too_big",
|
|
18178
18174
|
maximum: def.maximum,
|
|
18179
18175
|
inclusive: true,
|
|
18180
|
-
input,
|
|
18176
|
+
input: input2,
|
|
18181
18177
|
inst,
|
|
18182
18178
|
continue: !def.abort
|
|
18183
18179
|
});
|
|
@@ -18196,16 +18192,16 @@ var $ZodCheckMinSize = /* @__PURE__ */ $constructor("$ZodCheckMinSize", (inst, d
|
|
|
18196
18192
|
inst2._zod.bag.minimum = def.minimum;
|
|
18197
18193
|
});
|
|
18198
18194
|
inst._zod.check = (payload) => {
|
|
18199
|
-
const
|
|
18200
|
-
const size =
|
|
18195
|
+
const input2 = payload.value;
|
|
18196
|
+
const size = input2.size;
|
|
18201
18197
|
if (size >= def.minimum)
|
|
18202
18198
|
return;
|
|
18203
18199
|
payload.issues.push({
|
|
18204
|
-
origin: getSizableOrigin(
|
|
18200
|
+
origin: getSizableOrigin(input2),
|
|
18205
18201
|
code: "too_small",
|
|
18206
18202
|
minimum: def.minimum,
|
|
18207
18203
|
inclusive: true,
|
|
18208
|
-
input,
|
|
18204
|
+
input: input2,
|
|
18209
18205
|
inst,
|
|
18210
18206
|
continue: !def.abort
|
|
18211
18207
|
});
|
|
@@ -18225,13 +18221,13 @@ var $ZodCheckSizeEquals = /* @__PURE__ */ $constructor("$ZodCheckSizeEquals", (i
|
|
|
18225
18221
|
bag.size = def.size;
|
|
18226
18222
|
});
|
|
18227
18223
|
inst._zod.check = (payload) => {
|
|
18228
|
-
const
|
|
18229
|
-
const size =
|
|
18224
|
+
const input2 = payload.value;
|
|
18225
|
+
const size = input2.size;
|
|
18230
18226
|
if (size === def.size)
|
|
18231
18227
|
return;
|
|
18232
18228
|
const tooBig = size > def.size;
|
|
18233
18229
|
payload.issues.push({
|
|
18234
|
-
origin: getSizableOrigin(
|
|
18230
|
+
origin: getSizableOrigin(input2),
|
|
18235
18231
|
...tooBig ? { code: "too_big", maximum: def.size } : { code: "too_small", minimum: def.size },
|
|
18236
18232
|
inclusive: true,
|
|
18237
18233
|
exact: true,
|
|
@@ -18254,17 +18250,17 @@ var $ZodCheckMaxLength = /* @__PURE__ */ $constructor("$ZodCheckMaxLength", (ins
|
|
|
18254
18250
|
inst2._zod.bag.maximum = def.maximum;
|
|
18255
18251
|
});
|
|
18256
18252
|
inst._zod.check = (payload) => {
|
|
18257
|
-
const
|
|
18258
|
-
const length =
|
|
18253
|
+
const input2 = payload.value;
|
|
18254
|
+
const length = input2.length;
|
|
18259
18255
|
if (length <= def.maximum)
|
|
18260
18256
|
return;
|
|
18261
|
-
const origin = getLengthableOrigin(
|
|
18257
|
+
const origin = getLengthableOrigin(input2);
|
|
18262
18258
|
payload.issues.push({
|
|
18263
18259
|
origin,
|
|
18264
18260
|
code: "too_big",
|
|
18265
18261
|
maximum: def.maximum,
|
|
18266
18262
|
inclusive: true,
|
|
18267
|
-
input,
|
|
18263
|
+
input: input2,
|
|
18268
18264
|
inst,
|
|
18269
18265
|
continue: !def.abort
|
|
18270
18266
|
});
|
|
@@ -18283,17 +18279,17 @@ var $ZodCheckMinLength = /* @__PURE__ */ $constructor("$ZodCheckMinLength", (ins
|
|
|
18283
18279
|
inst2._zod.bag.minimum = def.minimum;
|
|
18284
18280
|
});
|
|
18285
18281
|
inst._zod.check = (payload) => {
|
|
18286
|
-
const
|
|
18287
|
-
const length =
|
|
18282
|
+
const input2 = payload.value;
|
|
18283
|
+
const length = input2.length;
|
|
18288
18284
|
if (length >= def.minimum)
|
|
18289
18285
|
return;
|
|
18290
|
-
const origin = getLengthableOrigin(
|
|
18286
|
+
const origin = getLengthableOrigin(input2);
|
|
18291
18287
|
payload.issues.push({
|
|
18292
18288
|
origin,
|
|
18293
18289
|
code: "too_small",
|
|
18294
18290
|
minimum: def.minimum,
|
|
18295
18291
|
inclusive: true,
|
|
18296
|
-
input,
|
|
18292
|
+
input: input2,
|
|
18297
18293
|
inst,
|
|
18298
18294
|
continue: !def.abort
|
|
18299
18295
|
});
|
|
@@ -18313,11 +18309,11 @@ var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals"
|
|
|
18313
18309
|
bag.length = def.length;
|
|
18314
18310
|
});
|
|
18315
18311
|
inst._zod.check = (payload) => {
|
|
18316
|
-
const
|
|
18317
|
-
const length =
|
|
18312
|
+
const input2 = payload.value;
|
|
18313
|
+
const length = input2.length;
|
|
18318
18314
|
if (length === def.length)
|
|
18319
18315
|
return;
|
|
18320
|
-
const origin = getLengthableOrigin(
|
|
18316
|
+
const origin = getLengthableOrigin(input2);
|
|
18321
18317
|
const tooBig = length > def.length;
|
|
18322
18318
|
payload.issues.push({
|
|
18323
18319
|
origin,
|
|
@@ -18977,15 +18973,15 @@ var $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
|
18977
18973
|
payload.value = Number(payload.value);
|
|
18978
18974
|
} catch (_) {
|
|
18979
18975
|
}
|
|
18980
|
-
const
|
|
18981
|
-
if (typeof
|
|
18976
|
+
const input2 = payload.value;
|
|
18977
|
+
if (typeof input2 === "number" && !Number.isNaN(input2) && Number.isFinite(input2)) {
|
|
18982
18978
|
return payload;
|
|
18983
18979
|
}
|
|
18984
|
-
const received = typeof
|
|
18980
|
+
const received = typeof input2 === "number" ? Number.isNaN(input2) ? "NaN" : !Number.isFinite(input2) ? "Infinity" : void 0 : void 0;
|
|
18985
18981
|
payload.issues.push({
|
|
18986
18982
|
expected: "number",
|
|
18987
18983
|
code: "invalid_type",
|
|
18988
|
-
input,
|
|
18984
|
+
input: input2,
|
|
18989
18985
|
inst,
|
|
18990
18986
|
...received ? { received } : {}
|
|
18991
18987
|
});
|
|
@@ -19005,13 +19001,13 @@ var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
|
19005
19001
|
payload.value = Boolean(payload.value);
|
|
19006
19002
|
} catch (_) {
|
|
19007
19003
|
}
|
|
19008
|
-
const
|
|
19009
|
-
if (typeof
|
|
19004
|
+
const input2 = payload.value;
|
|
19005
|
+
if (typeof input2 === "boolean")
|
|
19010
19006
|
return payload;
|
|
19011
19007
|
payload.issues.push({
|
|
19012
19008
|
expected: "boolean",
|
|
19013
19009
|
code: "invalid_type",
|
|
19014
|
-
input,
|
|
19010
|
+
input: input2,
|
|
19015
19011
|
inst
|
|
19016
19012
|
});
|
|
19017
19013
|
return payload;
|
|
@@ -19044,13 +19040,13 @@ var $ZodBigIntFormat = /* @__PURE__ */ $constructor("$ZodBigIntFormat", (inst, d
|
|
|
19044
19040
|
var $ZodSymbol = /* @__PURE__ */ $constructor("$ZodSymbol", (inst, def) => {
|
|
19045
19041
|
$ZodType.init(inst, def);
|
|
19046
19042
|
inst._zod.parse = (payload, _ctx) => {
|
|
19047
|
-
const
|
|
19048
|
-
if (typeof
|
|
19043
|
+
const input2 = payload.value;
|
|
19044
|
+
if (typeof input2 === "symbol")
|
|
19049
19045
|
return payload;
|
|
19050
19046
|
payload.issues.push({
|
|
19051
19047
|
expected: "symbol",
|
|
19052
19048
|
code: "invalid_type",
|
|
19053
|
-
input,
|
|
19049
|
+
input: input2,
|
|
19054
19050
|
inst
|
|
19055
19051
|
});
|
|
19056
19052
|
return payload;
|
|
@@ -19063,13 +19059,13 @@ var $ZodUndefined = /* @__PURE__ */ $constructor("$ZodUndefined", (inst, def) =>
|
|
|
19063
19059
|
inst._zod.optin = "optional";
|
|
19064
19060
|
inst._zod.optout = "optional";
|
|
19065
19061
|
inst._zod.parse = (payload, _ctx) => {
|
|
19066
|
-
const
|
|
19067
|
-
if (typeof
|
|
19062
|
+
const input2 = payload.value;
|
|
19063
|
+
if (typeof input2 === "undefined")
|
|
19068
19064
|
return payload;
|
|
19069
19065
|
payload.issues.push({
|
|
19070
19066
|
expected: "undefined",
|
|
19071
19067
|
code: "invalid_type",
|
|
19072
|
-
input,
|
|
19068
|
+
input: input2,
|
|
19073
19069
|
inst
|
|
19074
19070
|
});
|
|
19075
19071
|
return payload;
|
|
@@ -19080,13 +19076,13 @@ var $ZodNull = /* @__PURE__ */ $constructor("$ZodNull", (inst, def) => {
|
|
|
19080
19076
|
inst._zod.pattern = _null;
|
|
19081
19077
|
inst._zod.values = /* @__PURE__ */ new Set([null]);
|
|
19082
19078
|
inst._zod.parse = (payload, _ctx) => {
|
|
19083
|
-
const
|
|
19084
|
-
if (
|
|
19079
|
+
const input2 = payload.value;
|
|
19080
|
+
if (input2 === null)
|
|
19085
19081
|
return payload;
|
|
19086
19082
|
payload.issues.push({
|
|
19087
19083
|
expected: "null",
|
|
19088
19084
|
code: "invalid_type",
|
|
19089
|
-
input,
|
|
19085
|
+
input: input2,
|
|
19090
19086
|
inst
|
|
19091
19087
|
});
|
|
19092
19088
|
return payload;
|
|
@@ -19115,13 +19111,13 @@ var $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
|
19115
19111
|
var $ZodVoid = /* @__PURE__ */ $constructor("$ZodVoid", (inst, def) => {
|
|
19116
19112
|
$ZodType.init(inst, def);
|
|
19117
19113
|
inst._zod.parse = (payload, _ctx) => {
|
|
19118
|
-
const
|
|
19119
|
-
if (typeof
|
|
19114
|
+
const input2 = payload.value;
|
|
19115
|
+
if (typeof input2 === "undefined")
|
|
19120
19116
|
return payload;
|
|
19121
19117
|
payload.issues.push({
|
|
19122
19118
|
expected: "void",
|
|
19123
19119
|
code: "invalid_type",
|
|
19124
|
-
input,
|
|
19120
|
+
input: input2,
|
|
19125
19121
|
inst
|
|
19126
19122
|
});
|
|
19127
19123
|
return payload;
|
|
@@ -19136,15 +19132,15 @@ var $ZodDate = /* @__PURE__ */ $constructor("$ZodDate", (inst, def) => {
|
|
|
19136
19132
|
} catch (_err) {
|
|
19137
19133
|
}
|
|
19138
19134
|
}
|
|
19139
|
-
const
|
|
19140
|
-
const isDate =
|
|
19141
|
-
const isValidDate = isDate && !Number.isNaN(
|
|
19135
|
+
const input2 = payload.value;
|
|
19136
|
+
const isDate = input2 instanceof Date;
|
|
19137
|
+
const isValidDate = isDate && !Number.isNaN(input2.getTime());
|
|
19142
19138
|
if (isValidDate)
|
|
19143
19139
|
return payload;
|
|
19144
19140
|
payload.issues.push({
|
|
19145
19141
|
expected: "date",
|
|
19146
19142
|
code: "invalid_type",
|
|
19147
|
-
input,
|
|
19143
|
+
input: input2,
|
|
19148
19144
|
...isDate ? { received: "Invalid Date" } : {},
|
|
19149
19145
|
inst
|
|
19150
19146
|
});
|
|
@@ -19160,20 +19156,20 @@ function handleArrayResult(result, final, index) {
|
|
|
19160
19156
|
var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
19161
19157
|
$ZodType.init(inst, def);
|
|
19162
19158
|
inst._zod.parse = (payload, ctx) => {
|
|
19163
|
-
const
|
|
19164
|
-
if (!Array.isArray(
|
|
19159
|
+
const input2 = payload.value;
|
|
19160
|
+
if (!Array.isArray(input2)) {
|
|
19165
19161
|
payload.issues.push({
|
|
19166
19162
|
expected: "array",
|
|
19167
19163
|
code: "invalid_type",
|
|
19168
|
-
input,
|
|
19164
|
+
input: input2,
|
|
19169
19165
|
inst
|
|
19170
19166
|
});
|
|
19171
19167
|
return payload;
|
|
19172
19168
|
}
|
|
19173
|
-
payload.value = Array(
|
|
19169
|
+
payload.value = Array(input2.length);
|
|
19174
19170
|
const proms = [];
|
|
19175
|
-
for (let i = 0; i <
|
|
19176
|
-
const item =
|
|
19171
|
+
for (let i = 0; i < input2.length; i++) {
|
|
19172
|
+
const item = input2[i];
|
|
19177
19173
|
const result = def.element._zod.run({
|
|
19178
19174
|
value: item,
|
|
19179
19175
|
issues: []
|
|
@@ -19190,15 +19186,15 @@ var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
|
19190
19186
|
return payload;
|
|
19191
19187
|
};
|
|
19192
19188
|
});
|
|
19193
|
-
function handlePropertyResult(result, final, key,
|
|
19189
|
+
function handlePropertyResult(result, final, key, input2, isOptionalOut) {
|
|
19194
19190
|
if (result.issues.length) {
|
|
19195
|
-
if (isOptionalOut && !(key in
|
|
19191
|
+
if (isOptionalOut && !(key in input2)) {
|
|
19196
19192
|
return;
|
|
19197
19193
|
}
|
|
19198
19194
|
final.issues.push(...prefixIssues(key, result.issues));
|
|
19199
19195
|
}
|
|
19200
19196
|
if (result.value === void 0) {
|
|
19201
|
-
if (key in
|
|
19197
|
+
if (key in input2) {
|
|
19202
19198
|
final.value[key] = void 0;
|
|
19203
19199
|
}
|
|
19204
19200
|
} else {
|
|
@@ -19222,31 +19218,31 @@ function normalizeDef(def) {
|
|
|
19222
19218
|
optionalKeys: new Set(okeys)
|
|
19223
19219
|
};
|
|
19224
19220
|
}
|
|
19225
|
-
function handleCatchall(proms,
|
|
19221
|
+
function handleCatchall(proms, input2, payload, ctx, def, inst) {
|
|
19226
19222
|
const unrecognized = [];
|
|
19227
19223
|
const keySet = def.keySet;
|
|
19228
19224
|
const _catchall = def.catchall._zod;
|
|
19229
19225
|
const t = _catchall.def.type;
|
|
19230
19226
|
const isOptionalOut = _catchall.optout === "optional";
|
|
19231
|
-
for (const key in
|
|
19227
|
+
for (const key in input2) {
|
|
19232
19228
|
if (keySet.has(key))
|
|
19233
19229
|
continue;
|
|
19234
19230
|
if (t === "never") {
|
|
19235
19231
|
unrecognized.push(key);
|
|
19236
19232
|
continue;
|
|
19237
19233
|
}
|
|
19238
|
-
const r = _catchall.run({ value:
|
|
19234
|
+
const r = _catchall.run({ value: input2[key], issues: [] }, ctx);
|
|
19239
19235
|
if (r instanceof Promise) {
|
|
19240
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
19236
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalOut)));
|
|
19241
19237
|
} else {
|
|
19242
|
-
handlePropertyResult(r, payload, key,
|
|
19238
|
+
handlePropertyResult(r, payload, key, input2, isOptionalOut);
|
|
19243
19239
|
}
|
|
19244
19240
|
}
|
|
19245
19241
|
if (unrecognized.length) {
|
|
19246
19242
|
payload.issues.push({
|
|
19247
19243
|
code: "unrecognized_keys",
|
|
19248
19244
|
keys: unrecognized,
|
|
19249
|
-
input,
|
|
19245
|
+
input: input2,
|
|
19250
19246
|
inst
|
|
19251
19247
|
});
|
|
19252
19248
|
}
|
|
@@ -19290,12 +19286,12 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
19290
19286
|
let value;
|
|
19291
19287
|
inst._zod.parse = (payload, ctx) => {
|
|
19292
19288
|
value ?? (value = _normalized.value);
|
|
19293
|
-
const
|
|
19294
|
-
if (!isObject2(
|
|
19289
|
+
const input2 = payload.value;
|
|
19290
|
+
if (!isObject2(input2)) {
|
|
19295
19291
|
payload.issues.push({
|
|
19296
19292
|
expected: "object",
|
|
19297
19293
|
code: "invalid_type",
|
|
19298
|
-
input,
|
|
19294
|
+
input: input2,
|
|
19299
19295
|
inst
|
|
19300
19296
|
});
|
|
19301
19297
|
return payload;
|
|
@@ -19306,17 +19302,17 @@ var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
|
19306
19302
|
for (const key of value.keys) {
|
|
19307
19303
|
const el = shape[key];
|
|
19308
19304
|
const isOptionalOut = el._zod.optout === "optional";
|
|
19309
|
-
const r = el._zod.run({ value:
|
|
19305
|
+
const r = el._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
19310
19306
|
if (r instanceof Promise) {
|
|
19311
|
-
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key,
|
|
19307
|
+
proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input2, isOptionalOut)));
|
|
19312
19308
|
} else {
|
|
19313
|
-
handlePropertyResult(r, payload, key,
|
|
19309
|
+
handlePropertyResult(r, payload, key, input2, isOptionalOut);
|
|
19314
19310
|
}
|
|
19315
19311
|
}
|
|
19316
19312
|
if (!catchall) {
|
|
19317
19313
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
19318
19314
|
}
|
|
19319
|
-
return handleCatchall(proms,
|
|
19315
|
+
return handleCatchall(proms, input2, payload, ctx, _normalized.value, inst);
|
|
19320
19316
|
};
|
|
19321
19317
|
});
|
|
19322
19318
|
var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -19398,12 +19394,12 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
19398
19394
|
let value;
|
|
19399
19395
|
inst._zod.parse = (payload, ctx) => {
|
|
19400
19396
|
value ?? (value = _normalized.value);
|
|
19401
|
-
const
|
|
19402
|
-
if (!isObject2(
|
|
19397
|
+
const input2 = payload.value;
|
|
19398
|
+
if (!isObject2(input2)) {
|
|
19403
19399
|
payload.issues.push({
|
|
19404
19400
|
expected: "object",
|
|
19405
19401
|
code: "invalid_type",
|
|
19406
|
-
input,
|
|
19402
|
+
input: input2,
|
|
19407
19403
|
inst
|
|
19408
19404
|
});
|
|
19409
19405
|
return payload;
|
|
@@ -19414,7 +19410,7 @@ var $ZodObjectJIT = /* @__PURE__ */ $constructor("$ZodObjectJIT", (inst, def) =>
|
|
|
19414
19410
|
payload = fastpass(payload, ctx);
|
|
19415
19411
|
if (!catchall)
|
|
19416
19412
|
return payload;
|
|
19417
|
-
return handleCatchall([],
|
|
19413
|
+
return handleCatchall([], input2, payload, ctx, value, inst);
|
|
19418
19414
|
}
|
|
19419
19415
|
return superParse(payload, ctx);
|
|
19420
19416
|
};
|
|
@@ -19577,17 +19573,17 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
19577
19573
|
return map2;
|
|
19578
19574
|
});
|
|
19579
19575
|
inst._zod.parse = (payload, ctx) => {
|
|
19580
|
-
const
|
|
19581
|
-
if (!isObject(
|
|
19576
|
+
const input2 = payload.value;
|
|
19577
|
+
if (!isObject(input2)) {
|
|
19582
19578
|
payload.issues.push({
|
|
19583
19579
|
code: "invalid_type",
|
|
19584
19580
|
expected: "object",
|
|
19585
|
-
input,
|
|
19581
|
+
input: input2,
|
|
19586
19582
|
inst
|
|
19587
19583
|
});
|
|
19588
19584
|
return payload;
|
|
19589
19585
|
}
|
|
19590
|
-
const opt = disc.value.get(
|
|
19586
|
+
const opt = disc.value.get(input2 == null ? void 0 : input2[def.discriminator]);
|
|
19591
19587
|
if (opt) {
|
|
19592
19588
|
return opt._zod.run(payload, ctx);
|
|
19593
19589
|
}
|
|
@@ -19599,7 +19595,7 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
19599
19595
|
errors: [],
|
|
19600
19596
|
note: "No matching discriminator",
|
|
19601
19597
|
discriminator: def.discriminator,
|
|
19602
|
-
input,
|
|
19598
|
+
input: input2,
|
|
19603
19599
|
path: [def.discriminator],
|
|
19604
19600
|
inst
|
|
19605
19601
|
});
|
|
@@ -19609,9 +19605,9 @@ var $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnio
|
|
|
19609
19605
|
var $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
19610
19606
|
$ZodType.init(inst, def);
|
|
19611
19607
|
inst._zod.parse = (payload, ctx) => {
|
|
19612
|
-
const
|
|
19613
|
-
const left = def.left._zod.run({ value:
|
|
19614
|
-
const right = def.right._zod.run({ value:
|
|
19608
|
+
const input2 = payload.value;
|
|
19609
|
+
const left = def.left._zod.run({ value: input2, issues: [] }, ctx);
|
|
19610
|
+
const right = def.right._zod.run({ value: input2, issues: [] }, ctx);
|
|
19615
19611
|
const async = left instanceof Promise || right instanceof Promise;
|
|
19616
19612
|
if (async) {
|
|
19617
19613
|
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
@@ -19708,10 +19704,10 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
19708
19704
|
$ZodType.init(inst, def);
|
|
19709
19705
|
const items = def.items;
|
|
19710
19706
|
inst._zod.parse = (payload, ctx) => {
|
|
19711
|
-
const
|
|
19712
|
-
if (!Array.isArray(
|
|
19707
|
+
const input2 = payload.value;
|
|
19708
|
+
if (!Array.isArray(input2)) {
|
|
19713
19709
|
payload.issues.push({
|
|
19714
|
-
input,
|
|
19710
|
+
input: input2,
|
|
19715
19711
|
inst,
|
|
19716
19712
|
expected: "tuple",
|
|
19717
19713
|
code: "invalid_type"
|
|
@@ -19723,12 +19719,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
19723
19719
|
const reversedIndex = [...items].reverse().findIndex((item) => item._zod.optin !== "optional");
|
|
19724
19720
|
const optStart = reversedIndex === -1 ? 0 : items.length - reversedIndex;
|
|
19725
19721
|
if (!def.rest) {
|
|
19726
|
-
const tooBig =
|
|
19727
|
-
const tooSmall =
|
|
19722
|
+
const tooBig = input2.length > items.length;
|
|
19723
|
+
const tooSmall = input2.length < optStart - 1;
|
|
19728
19724
|
if (tooBig || tooSmall) {
|
|
19729
19725
|
payload.issues.push({
|
|
19730
19726
|
...tooBig ? { code: "too_big", maximum: items.length, inclusive: true } : { code: "too_small", minimum: items.length },
|
|
19731
|
-
input,
|
|
19727
|
+
input: input2,
|
|
19732
19728
|
inst,
|
|
19733
19729
|
origin: "array"
|
|
19734
19730
|
});
|
|
@@ -19738,12 +19734,12 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
19738
19734
|
let i = -1;
|
|
19739
19735
|
for (const item of items) {
|
|
19740
19736
|
i++;
|
|
19741
|
-
if (i >=
|
|
19737
|
+
if (i >= input2.length) {
|
|
19742
19738
|
if (i >= optStart)
|
|
19743
19739
|
continue;
|
|
19744
19740
|
}
|
|
19745
19741
|
const result = item._zod.run({
|
|
19746
|
-
value:
|
|
19742
|
+
value: input2[i],
|
|
19747
19743
|
issues: []
|
|
19748
19744
|
}, ctx);
|
|
19749
19745
|
if (result instanceof Promise) {
|
|
@@ -19753,7 +19749,7 @@ var $ZodTuple = /* @__PURE__ */ $constructor("$ZodTuple", (inst, def) => {
|
|
|
19753
19749
|
}
|
|
19754
19750
|
}
|
|
19755
19751
|
if (def.rest) {
|
|
19756
|
-
const rest =
|
|
19752
|
+
const rest = input2.slice(items.length);
|
|
19757
19753
|
for (const el of rest) {
|
|
19758
19754
|
i++;
|
|
19759
19755
|
const result = def.rest._zod.run({
|
|
@@ -19781,12 +19777,12 @@ function handleTupleResult(result, final, index) {
|
|
|
19781
19777
|
var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
19782
19778
|
$ZodType.init(inst, def);
|
|
19783
19779
|
inst._zod.parse = (payload, ctx) => {
|
|
19784
|
-
const
|
|
19785
|
-
if (!isPlainObject(
|
|
19780
|
+
const input2 = payload.value;
|
|
19781
|
+
if (!isPlainObject(input2)) {
|
|
19786
19782
|
payload.issues.push({
|
|
19787
19783
|
expected: "record",
|
|
19788
19784
|
code: "invalid_type",
|
|
19789
|
-
input,
|
|
19785
|
+
input: input2,
|
|
19790
19786
|
inst
|
|
19791
19787
|
});
|
|
19792
19788
|
return payload;
|
|
@@ -19799,7 +19795,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
19799
19795
|
for (const key of values) {
|
|
19800
19796
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
19801
19797
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
19802
|
-
const result = def.valueType._zod.run({ value:
|
|
19798
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
19803
19799
|
if (result instanceof Promise) {
|
|
19804
19800
|
proms.push(result.then((result2) => {
|
|
19805
19801
|
if (result2.issues.length) {
|
|
@@ -19816,7 +19812,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
19816
19812
|
}
|
|
19817
19813
|
}
|
|
19818
19814
|
let unrecognized;
|
|
19819
|
-
for (const key in
|
|
19815
|
+
for (const key in input2) {
|
|
19820
19816
|
if (!recordKeys.has(key)) {
|
|
19821
19817
|
unrecognized = unrecognized ?? [];
|
|
19822
19818
|
unrecognized.push(key);
|
|
@@ -19825,14 +19821,14 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
19825
19821
|
if (unrecognized && unrecognized.length > 0) {
|
|
19826
19822
|
payload.issues.push({
|
|
19827
19823
|
code: "unrecognized_keys",
|
|
19828
|
-
input,
|
|
19824
|
+
input: input2,
|
|
19829
19825
|
inst,
|
|
19830
19826
|
keys: unrecognized
|
|
19831
19827
|
});
|
|
19832
19828
|
}
|
|
19833
19829
|
} else {
|
|
19834
19830
|
payload.value = {};
|
|
19835
|
-
for (const key of Reflect.ownKeys(
|
|
19831
|
+
for (const key of Reflect.ownKeys(input2)) {
|
|
19836
19832
|
if (key === "__proto__")
|
|
19837
19833
|
continue;
|
|
19838
19834
|
let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
@@ -19851,7 +19847,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
19851
19847
|
}
|
|
19852
19848
|
if (keyResult.issues.length) {
|
|
19853
19849
|
if (def.mode === "loose") {
|
|
19854
|
-
payload.value[key] =
|
|
19850
|
+
payload.value[key] = input2[key];
|
|
19855
19851
|
} else {
|
|
19856
19852
|
payload.issues.push({
|
|
19857
19853
|
code: "invalid_key",
|
|
@@ -19864,7 +19860,7 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
19864
19860
|
}
|
|
19865
19861
|
continue;
|
|
19866
19862
|
}
|
|
19867
|
-
const result = def.valueType._zod.run({ value:
|
|
19863
|
+
const result = def.valueType._zod.run({ value: input2[key], issues: [] }, ctx);
|
|
19868
19864
|
if (result instanceof Promise) {
|
|
19869
19865
|
proms.push(result.then((result2) => {
|
|
19870
19866
|
if (result2.issues.length) {
|
|
@@ -19889,27 +19885,27 @@ var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
|
19889
19885
|
var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
19890
19886
|
$ZodType.init(inst, def);
|
|
19891
19887
|
inst._zod.parse = (payload, ctx) => {
|
|
19892
|
-
const
|
|
19893
|
-
if (!(
|
|
19888
|
+
const input2 = payload.value;
|
|
19889
|
+
if (!(input2 instanceof Map)) {
|
|
19894
19890
|
payload.issues.push({
|
|
19895
19891
|
expected: "map",
|
|
19896
19892
|
code: "invalid_type",
|
|
19897
|
-
input,
|
|
19893
|
+
input: input2,
|
|
19898
19894
|
inst
|
|
19899
19895
|
});
|
|
19900
19896
|
return payload;
|
|
19901
19897
|
}
|
|
19902
19898
|
const proms = [];
|
|
19903
19899
|
payload.value = /* @__PURE__ */ new Map();
|
|
19904
|
-
for (const [key, value] of
|
|
19900
|
+
for (const [key, value] of input2) {
|
|
19905
19901
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
19906
19902
|
const valueResult = def.valueType._zod.run({ value, issues: [] }, ctx);
|
|
19907
19903
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
19908
19904
|
proms.push(Promise.all([keyResult, valueResult]).then(([keyResult2, valueResult2]) => {
|
|
19909
|
-
handleMapResult(keyResult2, valueResult2, payload, key,
|
|
19905
|
+
handleMapResult(keyResult2, valueResult2, payload, key, input2, inst, ctx);
|
|
19910
19906
|
}));
|
|
19911
19907
|
} else {
|
|
19912
|
-
handleMapResult(keyResult, valueResult, payload, key,
|
|
19908
|
+
handleMapResult(keyResult, valueResult, payload, key, input2, inst, ctx);
|
|
19913
19909
|
}
|
|
19914
19910
|
}
|
|
19915
19911
|
if (proms.length)
|
|
@@ -19917,7 +19913,7 @@ var $ZodMap = /* @__PURE__ */ $constructor("$ZodMap", (inst, def) => {
|
|
|
19917
19913
|
return payload;
|
|
19918
19914
|
};
|
|
19919
19915
|
});
|
|
19920
|
-
function handleMapResult(keyResult, valueResult, final, key,
|
|
19916
|
+
function handleMapResult(keyResult, valueResult, final, key, input2, inst, ctx) {
|
|
19921
19917
|
if (keyResult.issues.length) {
|
|
19922
19918
|
if (propertyKeyTypes.has(typeof key)) {
|
|
19923
19919
|
final.issues.push(...prefixIssues(key, keyResult.issues));
|
|
@@ -19925,7 +19921,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
19925
19921
|
final.issues.push({
|
|
19926
19922
|
code: "invalid_key",
|
|
19927
19923
|
origin: "map",
|
|
19928
|
-
input,
|
|
19924
|
+
input: input2,
|
|
19929
19925
|
inst,
|
|
19930
19926
|
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
19931
19927
|
});
|
|
@@ -19938,7 +19934,7 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
19938
19934
|
final.issues.push({
|
|
19939
19935
|
origin: "map",
|
|
19940
19936
|
code: "invalid_element",
|
|
19941
|
-
input,
|
|
19937
|
+
input: input2,
|
|
19942
19938
|
inst,
|
|
19943
19939
|
key,
|
|
19944
19940
|
issues: valueResult.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
@@ -19950,10 +19946,10 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
19950
19946
|
var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
19951
19947
|
$ZodType.init(inst, def);
|
|
19952
19948
|
inst._zod.parse = (payload, ctx) => {
|
|
19953
|
-
const
|
|
19954
|
-
if (!(
|
|
19949
|
+
const input2 = payload.value;
|
|
19950
|
+
if (!(input2 instanceof Set)) {
|
|
19955
19951
|
payload.issues.push({
|
|
19956
|
-
input,
|
|
19952
|
+
input: input2,
|
|
19957
19953
|
inst,
|
|
19958
19954
|
expected: "set",
|
|
19959
19955
|
code: "invalid_type"
|
|
@@ -19962,7 +19958,7 @@ var $ZodSet = /* @__PURE__ */ $constructor("$ZodSet", (inst, def) => {
|
|
|
19962
19958
|
}
|
|
19963
19959
|
const proms = [];
|
|
19964
19960
|
payload.value = /* @__PURE__ */ new Set();
|
|
19965
|
-
for (const item of
|
|
19961
|
+
for (const item of input2) {
|
|
19966
19962
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
19967
19963
|
if (result instanceof Promise) {
|
|
19968
19964
|
proms.push(result.then((result2) => handleSetResult(result2, payload)));
|
|
@@ -19987,14 +19983,14 @@ var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
|
19987
19983
|
inst._zod.values = valuesSet;
|
|
19988
19984
|
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
19989
19985
|
inst._zod.parse = (payload, _ctx) => {
|
|
19990
|
-
const
|
|
19991
|
-
if (valuesSet.has(
|
|
19986
|
+
const input2 = payload.value;
|
|
19987
|
+
if (valuesSet.has(input2)) {
|
|
19992
19988
|
return payload;
|
|
19993
19989
|
}
|
|
19994
19990
|
payload.issues.push({
|
|
19995
19991
|
code: "invalid_value",
|
|
19996
19992
|
values,
|
|
19997
|
-
input,
|
|
19993
|
+
input: input2,
|
|
19998
19994
|
inst
|
|
19999
19995
|
});
|
|
20000
19996
|
return payload;
|
|
@@ -20009,14 +20005,14 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
20009
20005
|
inst._zod.values = values;
|
|
20010
20006
|
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
|
|
20011
20007
|
inst._zod.parse = (payload, _ctx) => {
|
|
20012
|
-
const
|
|
20013
|
-
if (values.has(
|
|
20008
|
+
const input2 = payload.value;
|
|
20009
|
+
if (values.has(input2)) {
|
|
20014
20010
|
return payload;
|
|
20015
20011
|
}
|
|
20016
20012
|
payload.issues.push({
|
|
20017
20013
|
code: "invalid_value",
|
|
20018
20014
|
values: def.values,
|
|
20019
|
-
input,
|
|
20015
|
+
input: input2,
|
|
20020
20016
|
inst
|
|
20021
20017
|
});
|
|
20022
20018
|
return payload;
|
|
@@ -20025,13 +20021,13 @@ var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
|
20025
20021
|
var $ZodFile = /* @__PURE__ */ $constructor("$ZodFile", (inst, def) => {
|
|
20026
20022
|
$ZodType.init(inst, def);
|
|
20027
20023
|
inst._zod.parse = (payload, _ctx) => {
|
|
20028
|
-
const
|
|
20029
|
-
if (
|
|
20024
|
+
const input2 = payload.value;
|
|
20025
|
+
if (input2 instanceof File)
|
|
20030
20026
|
return payload;
|
|
20031
20027
|
payload.issues.push({
|
|
20032
20028
|
expected: "file",
|
|
20033
20029
|
code: "invalid_type",
|
|
20034
|
-
input,
|
|
20030
|
+
input: input2,
|
|
20035
20031
|
inst
|
|
20036
20032
|
});
|
|
20037
20033
|
return payload;
|
|
@@ -20045,9 +20041,9 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
20045
20041
|
}
|
|
20046
20042
|
const _out = def.transform(payload.value, payload);
|
|
20047
20043
|
if (ctx.async) {
|
|
20048
|
-
const
|
|
20049
|
-
return
|
|
20050
|
-
payload.value =
|
|
20044
|
+
const output2 = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
20045
|
+
return output2.then((output3) => {
|
|
20046
|
+
payload.value = output3;
|
|
20051
20047
|
return payload;
|
|
20052
20048
|
});
|
|
20053
20049
|
}
|
|
@@ -20058,8 +20054,8 @@ var $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) =>
|
|
|
20058
20054
|
return payload;
|
|
20059
20055
|
};
|
|
20060
20056
|
});
|
|
20061
|
-
function handleOptionalResult(result,
|
|
20062
|
-
if (result.issues.length &&
|
|
20057
|
+
function handleOptionalResult(result, input2) {
|
|
20058
|
+
if (result.issues.length && input2 === void 0) {
|
|
20063
20059
|
return { issues: [], value: void 0 };
|
|
20064
20060
|
}
|
|
20065
20061
|
return result;
|
|
@@ -20466,12 +20462,12 @@ var $ZodFunction = /* @__PURE__ */ $constructor("$ZodFunction", (inst, def) => {
|
|
|
20466
20462
|
output: inst._def.output
|
|
20467
20463
|
});
|
|
20468
20464
|
};
|
|
20469
|
-
inst.output = (
|
|
20465
|
+
inst.output = (output2) => {
|
|
20470
20466
|
const F = inst.constructor;
|
|
20471
20467
|
return new F({
|
|
20472
20468
|
type: "function",
|
|
20473
20469
|
input: inst._def.input,
|
|
20474
|
-
output
|
|
20470
|
+
output: output2
|
|
20475
20471
|
});
|
|
20476
20472
|
};
|
|
20477
20473
|
return inst;
|
|
@@ -20513,20 +20509,20 @@ var $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
|
20513
20509
|
return payload;
|
|
20514
20510
|
};
|
|
20515
20511
|
inst._zod.check = (payload) => {
|
|
20516
|
-
const
|
|
20517
|
-
const r = def.fn(
|
|
20512
|
+
const input2 = payload.value;
|
|
20513
|
+
const r = def.fn(input2);
|
|
20518
20514
|
if (r instanceof Promise) {
|
|
20519
|
-
return r.then((r2) => handleRefineResult(r2, payload,
|
|
20515
|
+
return r.then((r2) => handleRefineResult(r2, payload, input2, inst));
|
|
20520
20516
|
}
|
|
20521
|
-
handleRefineResult(r, payload,
|
|
20517
|
+
handleRefineResult(r, payload, input2, inst);
|
|
20522
20518
|
return;
|
|
20523
20519
|
};
|
|
20524
20520
|
});
|
|
20525
|
-
function handleRefineResult(result, payload,
|
|
20521
|
+
function handleRefineResult(result, payload, input2, inst) {
|
|
20526
20522
|
if (!result) {
|
|
20527
20523
|
const _iss = {
|
|
20528
20524
|
code: "custom",
|
|
20529
|
-
input,
|
|
20525
|
+
input: input2,
|
|
20530
20526
|
inst,
|
|
20531
20527
|
// incorporates params.error into issue reporting
|
|
20532
20528
|
path: [...inst._zod.def.path ?? []],
|
|
@@ -21320,23 +21316,23 @@ function _overwrite(tx) {
|
|
|
21320
21316
|
}
|
|
21321
21317
|
// @__NO_SIDE_EFFECTS__
|
|
21322
21318
|
function _normalize(form) {
|
|
21323
|
-
return /* @__PURE__ */ _overwrite((
|
|
21319
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.normalize(form));
|
|
21324
21320
|
}
|
|
21325
21321
|
// @__NO_SIDE_EFFECTS__
|
|
21326
21322
|
function _trim() {
|
|
21327
|
-
return /* @__PURE__ */ _overwrite((
|
|
21323
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.trim());
|
|
21328
21324
|
}
|
|
21329
21325
|
// @__NO_SIDE_EFFECTS__
|
|
21330
21326
|
function _toLowerCase() {
|
|
21331
|
-
return /* @__PURE__ */ _overwrite((
|
|
21327
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toLowerCase());
|
|
21332
21328
|
}
|
|
21333
21329
|
// @__NO_SIDE_EFFECTS__
|
|
21334
21330
|
function _toUpperCase() {
|
|
21335
|
-
return /* @__PURE__ */ _overwrite((
|
|
21331
|
+
return /* @__PURE__ */ _overwrite((input2) => input2.toUpperCase());
|
|
21336
21332
|
}
|
|
21337
21333
|
// @__NO_SIDE_EFFECTS__
|
|
21338
21334
|
function _slugify() {
|
|
21339
|
-
return /* @__PURE__ */ _overwrite((
|
|
21335
|
+
return /* @__PURE__ */ _overwrite((input2) => slugify(input2));
|
|
21340
21336
|
}
|
|
21341
21337
|
// @__NO_SIDE_EFFECTS__
|
|
21342
21338
|
function _array(Class2, element, params) {
|
|
@@ -21454,8 +21450,8 @@ function _stringbool(Classes, _params) {
|
|
|
21454
21450
|
type: "pipe",
|
|
21455
21451
|
in: stringSchema,
|
|
21456
21452
|
out: booleanSchema,
|
|
21457
|
-
transform: ((
|
|
21458
|
-
let data =
|
|
21453
|
+
transform: ((input2, payload) => {
|
|
21454
|
+
let data = input2;
|
|
21459
21455
|
if (params.case !== "sensitive")
|
|
21460
21456
|
data = data.toLowerCase();
|
|
21461
21457
|
if (truthySet.has(data)) {
|
|
@@ -21474,8 +21470,8 @@ function _stringbool(Classes, _params) {
|
|
|
21474
21470
|
return {};
|
|
21475
21471
|
}
|
|
21476
21472
|
}),
|
|
21477
|
-
reverseTransform: ((
|
|
21478
|
-
if (
|
|
21473
|
+
reverseTransform: ((input2, _payload) => {
|
|
21474
|
+
if (input2 === true) {
|
|
21479
21475
|
return truthyArray[0] || "true";
|
|
21480
21476
|
} else {
|
|
21481
21477
|
return falsyArray[0] || "false";
|
|
@@ -23496,14 +23492,14 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
|
|
|
23496
23492
|
payload.issues.push(util_exports.issue(_issue));
|
|
23497
23493
|
}
|
|
23498
23494
|
};
|
|
23499
|
-
const
|
|
23500
|
-
if (
|
|
23501
|
-
return
|
|
23502
|
-
payload.value =
|
|
23495
|
+
const output2 = def.transform(payload.value, payload);
|
|
23496
|
+
if (output2 instanceof Promise) {
|
|
23497
|
+
return output2.then((output3) => {
|
|
23498
|
+
payload.value = output3;
|
|
23503
23499
|
return payload;
|
|
23504
23500
|
});
|
|
23505
23501
|
}
|
|
23506
|
-
payload.value =
|
|
23502
|
+
payload.value = output2;
|
|
23507
23503
|
return payload;
|
|
23508
23504
|
};
|
|
23509
23505
|
});
|
|
@@ -26347,12 +26343,12 @@ var AjvJsonSchemaValidator = class {
|
|
|
26347
26343
|
*/
|
|
26348
26344
|
getValidator(schema) {
|
|
26349
26345
|
const ajvValidator = "$id" in schema && typeof schema.$id === "string" ? this._ajv.getSchema(schema.$id) ?? this._ajv.compile(schema) : this._ajv.compile(schema);
|
|
26350
|
-
return (
|
|
26351
|
-
const valid = ajvValidator(
|
|
26346
|
+
return (input2) => {
|
|
26347
|
+
const valid = ajvValidator(input2);
|
|
26352
26348
|
if (valid) {
|
|
26353
26349
|
return {
|
|
26354
26350
|
valid: true,
|
|
26355
|
-
data:
|
|
26351
|
+
data: input2,
|
|
26356
26352
|
errorMessage: void 0
|
|
26357
26353
|
};
|
|
26358
26354
|
} else {
|
|
@@ -28584,7 +28580,7 @@ async function requestMakerPat(options) {
|
|
|
28584
28580
|
[
|
|
28585
28581
|
"Maker PAT not found.",
|
|
28586
28582
|
"Provide a PAT through the pat argument, MAKER_PAT/PAT environment variable,",
|
|
28587
|
-
"or save it with
|
|
28583
|
+
"or save it interactively with `taptap-maker pat set`.",
|
|
28588
28584
|
"Creating a new PAT still requires a legacy Maker JWT."
|
|
28589
28585
|
].join(" ")
|
|
28590
28586
|
);
|
|
@@ -28933,6 +28929,7 @@ var MakerGitError = class extends Error {
|
|
|
28933
28929
|
this.failure = failure;
|
|
28934
28930
|
}
|
|
28935
28931
|
};
|
|
28932
|
+
var MAKER_FIRST_CLONE_WAIT_MESSAGE = "First Maker clone/fetch can take 20+ seconds while the server prepares the repository. Please keep this running; transient 503/5xx errors are retried automatically.";
|
|
28936
28933
|
function getConfiguredMakerApiBase() {
|
|
28937
28934
|
return getMakerEndpoints().apiBase;
|
|
28938
28935
|
}
|
|
@@ -29234,6 +29231,7 @@ async function pushMakerProject(options) {
|
|
|
29234
29231
|
let committed = false;
|
|
29235
29232
|
let commitHash;
|
|
29236
29233
|
let message;
|
|
29234
|
+
let transientRetries = 0;
|
|
29237
29235
|
if (!statusBefore.trim() && !options.allowEmpty && unpushed.hasUnpushedCommits) {
|
|
29238
29236
|
commitHash = (await readGit(["rev-parse", "--short", "HEAD"], cwd)).trim();
|
|
29239
29237
|
} else if ((_d = options.files) == null ? void 0 : _d.length) {
|
|
@@ -29285,7 +29283,11 @@ async function pushMakerProject(options) {
|
|
|
29285
29283
|
phase: "push",
|
|
29286
29284
|
message: `Pushing Maker project to ${branch}`
|
|
29287
29285
|
});
|
|
29288
|
-
await
|
|
29286
|
+
transientRetries += await pushGitWithTransientRetry(
|
|
29287
|
+
["push", "origin", `HEAD:${branch}`],
|
|
29288
|
+
cwd,
|
|
29289
|
+
options.onProgress
|
|
29290
|
+
);
|
|
29289
29291
|
} catch (error2) {
|
|
29290
29292
|
const failure = toMakerGitFailure(error2, "push");
|
|
29291
29293
|
return {
|
|
@@ -29296,7 +29298,8 @@ async function pushMakerProject(options) {
|
|
|
29296
29298
|
pushed: false,
|
|
29297
29299
|
status: committed || unpushed.hasUnpushedCommits ? "failed_after_commit" : "clean",
|
|
29298
29300
|
failure,
|
|
29299
|
-
ahead: await readAheadState(cwd)
|
|
29301
|
+
ahead: await readAheadState(cwd),
|
|
29302
|
+
transientRetries
|
|
29300
29303
|
};
|
|
29301
29304
|
}
|
|
29302
29305
|
(_i = options.onProgress) == null ? void 0 : _i.call(options, {
|
|
@@ -29311,7 +29314,8 @@ async function pushMakerProject(options) {
|
|
|
29311
29314
|
commitHash,
|
|
29312
29315
|
message,
|
|
29313
29316
|
pushed: true,
|
|
29314
|
-
status: "pushed"
|
|
29317
|
+
status: "pushed",
|
|
29318
|
+
transientRetries
|
|
29315
29319
|
};
|
|
29316
29320
|
}
|
|
29317
29321
|
async function readMakerProjectLocalChanges(cwd) {
|
|
@@ -29420,36 +29424,42 @@ function toMakerGitFailure(error2, stage) {
|
|
|
29420
29424
|
stderr: message
|
|
29421
29425
|
});
|
|
29422
29426
|
}
|
|
29423
|
-
function createGitFailure(
|
|
29427
|
+
function createGitFailure(input2) {
|
|
29424
29428
|
var _a2, _b;
|
|
29425
|
-
const stderr = ((_a2 =
|
|
29426
|
-
const stdout = ((_b =
|
|
29429
|
+
const stderr = redactGitSecrets(((_a2 = input2.stderr) == null ? void 0 : _a2.trim()) || "");
|
|
29430
|
+
const stdout = redactGitSecrets(((_b = input2.stdout) == null ? void 0 : _b.trim()) || "");
|
|
29427
29431
|
const text = `${stdout}
|
|
29428
29432
|
${stderr}`.trim();
|
|
29429
29433
|
const classification = classifyGitFailure(text);
|
|
29434
|
+
const retryDecision = getMakerGitRetryDecision(text);
|
|
29430
29435
|
return {
|
|
29431
|
-
stage:
|
|
29432
|
-
command:
|
|
29433
|
-
exitCode:
|
|
29436
|
+
stage: input2.stage,
|
|
29437
|
+
command: input2.command ? redactGitSecrets(input2.command) : void 0,
|
|
29438
|
+
exitCode: input2.exitCode,
|
|
29434
29439
|
stdout,
|
|
29435
29440
|
stderr,
|
|
29436
|
-
message: text || `${
|
|
29441
|
+
message: text || `${input2.stage} failed`,
|
|
29437
29442
|
classification,
|
|
29443
|
+
retryable: retryDecision.retry,
|
|
29444
|
+
retryReason: retryDecision.reason,
|
|
29438
29445
|
nextAction: nextActionForFailure(classification)
|
|
29439
29446
|
};
|
|
29440
29447
|
}
|
|
29448
|
+
function redactGitSecrets(value) {
|
|
29449
|
+
return value.replace(/(https?:\/\/[^:\s/@]+:)[^@\s]+@/g, "$1***@");
|
|
29450
|
+
}
|
|
29441
29451
|
function classifyGitFailure(message) {
|
|
29442
|
-
if (/ENOENT|
|
|
29452
|
+
if (/ENOENT|cannot find|spawn git|git: command not found|not recognized as an internal or external command/i.test(
|
|
29453
|
+
message
|
|
29454
|
+
)) {
|
|
29443
29455
|
return "git_missing";
|
|
29444
29456
|
}
|
|
29445
|
-
if (/authentication|authorization|401|403|forbidden|unauthorized|could not read username/i.test(
|
|
29457
|
+
if (/authentication|authorization|401|403|forbidden|unauthorized|could not read username|repository not found/i.test(
|
|
29446
29458
|
message
|
|
29447
29459
|
)) {
|
|
29448
29460
|
return "auth";
|
|
29449
29461
|
}
|
|
29450
|
-
if (
|
|
29451
|
-
message
|
|
29452
|
-
)) {
|
|
29462
|
+
if (getMakerGitRetryDecision(message).retry) {
|
|
29453
29463
|
return "remote_transient";
|
|
29454
29464
|
}
|
|
29455
29465
|
if (/non-fast-forward|fetch first|rejected|failed to push some refs/i.test(message)) {
|
|
@@ -29460,20 +29470,50 @@ function classifyGitFailure(message) {
|
|
|
29460
29470
|
}
|
|
29461
29471
|
return "unknown";
|
|
29462
29472
|
}
|
|
29473
|
+
function getMakerGitRetryDecision(message) {
|
|
29474
|
+
const text = message.trim();
|
|
29475
|
+
if (!text) {
|
|
29476
|
+
return { retry: false };
|
|
29477
|
+
}
|
|
29478
|
+
if (isNonRetryableGitFailure(text)) {
|
|
29479
|
+
return { retry: false };
|
|
29480
|
+
}
|
|
29481
|
+
if (/(?:HTTP|error|status|code|response|returned)\D*(?:500|502|503|504)\b|Bad Gateway|Service Unavailable|Gateway Timeout|Internal Server Error/i.test(
|
|
29482
|
+
text
|
|
29483
|
+
)) {
|
|
29484
|
+
return { retry: true, reason: "remote_http_5xx" };
|
|
29485
|
+
}
|
|
29486
|
+
if (/timed?\s*out|timeout|TLS handshake timeout|Failed to connect|Could not resolve host|Network is unreachable|No route to host/i.test(
|
|
29487
|
+
text
|
|
29488
|
+
)) {
|
|
29489
|
+
return { retry: true, reason: "network_or_timeout" };
|
|
29490
|
+
}
|
|
29491
|
+
if (/connection reset|connection refused|connection closed|remote end hung up|unexpected disconnect|early EOF|RPC failed|index-pack failed|HTTP\/2 stream.*not closed cleanly|SSL_ERROR_SYSCALL|curl\s+(?:18|28|35|52|55|56|92)/i.test(
|
|
29492
|
+
text
|
|
29493
|
+
)) {
|
|
29494
|
+
return { retry: true, reason: "connection_interrupted" };
|
|
29495
|
+
}
|
|
29496
|
+
return { retry: false };
|
|
29497
|
+
}
|
|
29498
|
+
function isNonRetryableGitFailure(message) {
|
|
29499
|
+
return /authentication|authorization|401|403|forbidden|unauthorized|could not read username|repository not found|not a git repository|not empty|already exists and is not an empty directory|permission denied|Operation not permitted|non-fast-forward|fetch first|rejected|failed to push some refs|would be overwritten|conflicting local files/i.test(
|
|
29500
|
+
message
|
|
29501
|
+
);
|
|
29502
|
+
}
|
|
29463
29503
|
function nextActionForFailure(classification) {
|
|
29464
29504
|
switch (classification) {
|
|
29465
29505
|
case "git_missing":
|
|
29466
29506
|
return "本机未检测到可用的 Git。请用户自行安装 Git,并在 `git --version` 可用后重启 MCP 客户端再重试;安装前不要执行 clone、fetch、commit 或 push。";
|
|
29467
29507
|
case "auth":
|
|
29468
|
-
return "
|
|
29508
|
+
return "运行 `taptap-maker pat set` 并粘贴新的 Maker PAT 后,再重试 maker_build_current_directory;如果仍失败,请确认 PAT 是否过期或缺少 Maker git 权限。";
|
|
29469
29509
|
case "remote_transient":
|
|
29470
|
-
return "远端 Maker git 服务临时不可用。本地 commit 会保留;不要手动执行通用 git push,稍后直接重试
|
|
29510
|
+
return "远端 Maker git 服务临时不可用。本地 commit 会保留;不要手动执行通用 git push,稍后直接重试 maker_build_current_directory。";
|
|
29471
29511
|
case "remote_rejected":
|
|
29472
|
-
return "远端已有新提交。不要新建分支、不要要任务号、不要手动执行通用 git push;先询问用户是否 pull/rebase 当前 Maker 远端变更,再重试
|
|
29512
|
+
return "远端已有新提交。不要新建分支、不要要任务号、不要手动执行通用 git push;先询问用户是否 pull/rebase 当前 Maker 远端变更,再重试 maker_build_current_directory。";
|
|
29473
29513
|
case "local":
|
|
29474
29514
|
return "本地目录或权限异常。检查当前目录是否是 Maker git repo,以及 Codex 是否有目录写权限。";
|
|
29475
29515
|
default:
|
|
29476
|
-
return "保留本地提交,不要重复提交;把错误详情反馈给用户,并在确认后重试
|
|
29516
|
+
return "保留本地提交,不要重复提交;把错误详情反馈给用户,并在确认后重试 maker_build_current_directory。";
|
|
29477
29517
|
}
|
|
29478
29518
|
}
|
|
29479
29519
|
function pushGit(args, cwd, onProgress) {
|
|
@@ -29524,6 +29564,12 @@ function pushGit(args, cwd, onProgress) {
|
|
|
29524
29564
|
});
|
|
29525
29565
|
});
|
|
29526
29566
|
}
|
|
29567
|
+
function pushGitWithTransientRetry(args, cwd, onProgress) {
|
|
29568
|
+
return runWithTransientRetry(() => pushGit(args, cwd, onProgress), {
|
|
29569
|
+
stage: "push",
|
|
29570
|
+
onProgress
|
|
29571
|
+
});
|
|
29572
|
+
}
|
|
29527
29573
|
async function resolveMakerProjectUserId(options) {
|
|
29528
29574
|
var _a2;
|
|
29529
29575
|
try {
|
|
@@ -29567,6 +29613,7 @@ async function cloneOrInitializeTarget(target, authUrl, pat, onProgress) {
|
|
|
29567
29613
|
message: "Target directory is not empty; initializing git repository in place and keeping existing untracked files unless they conflict with Maker project files."
|
|
29568
29614
|
});
|
|
29569
29615
|
let transientRetries = 0;
|
|
29616
|
+
emitFirstCloneWaitNotice(onProgress, "fetch");
|
|
29570
29617
|
transientRetries += await runGitCaptureWithTransientRetry(["init", target], {
|
|
29571
29618
|
sanitize: pat,
|
|
29572
29619
|
onProgress
|
|
@@ -29592,11 +29639,20 @@ async function cloneOrInitializeTarget(target, authUrl, pat, onProgress) {
|
|
|
29592
29639
|
}
|
|
29593
29640
|
return transientRetries;
|
|
29594
29641
|
}
|
|
29642
|
+
emitFirstCloneWaitNotice(onProgress, "clone");
|
|
29595
29643
|
return runGitCaptureWithTransientRetry(["clone", authUrl, target], {
|
|
29596
29644
|
sanitize: pat,
|
|
29597
29645
|
onProgress
|
|
29598
29646
|
});
|
|
29599
29647
|
}
|
|
29648
|
+
function emitFirstCloneWaitNotice(onProgress, phase) {
|
|
29649
|
+
onProgress == null ? void 0 : onProgress({
|
|
29650
|
+
progress: 10,
|
|
29651
|
+
total: 100,
|
|
29652
|
+
phase,
|
|
29653
|
+
message: MAKER_FIRST_CLONE_WAIT_MESSAGE
|
|
29654
|
+
});
|
|
29655
|
+
}
|
|
29600
29656
|
function hasDirectoryEntries(target) {
|
|
29601
29657
|
if (!fs4.existsSync(target)) {
|
|
29602
29658
|
return false;
|
|
@@ -29728,7 +29784,7 @@ async function assertNoCheckoutFileConflicts(cwd, branch) {
|
|
|
29728
29784
|
"Conflicting local files:",
|
|
29729
29785
|
...conflicts.map((file2) => `- ${file2}`),
|
|
29730
29786
|
"",
|
|
29731
|
-
"Please move, rename, or delete these local files, then retry
|
|
29787
|
+
"Please move, rename, or delete these local files, then retry taptap-maker init."
|
|
29732
29788
|
].join("\n")
|
|
29733
29789
|
);
|
|
29734
29790
|
}
|
|
@@ -29822,7 +29878,7 @@ function formatMakerGitRootMismatch(status) {
|
|
|
29822
29878
|
status.configPath ? `config: ${status.configPath}` : "",
|
|
29823
29879
|
"",
|
|
29824
29880
|
"The current Maker directory is inside another Git repository, but it does not have its own .git directory.",
|
|
29825
|
-
"Re-run
|
|
29881
|
+
"Re-run taptap-maker init after this fix, or use a fresh independent Maker directory."
|
|
29826
29882
|
].filter(Boolean).join("\n");
|
|
29827
29883
|
}
|
|
29828
29884
|
function findMakerProjectBinding(startDir) {
|
|
@@ -29886,7 +29942,7 @@ function ensureGitHeadCheckedOut(repoDir) {
|
|
|
29886
29942
|
[
|
|
29887
29943
|
"Maker clone did not complete checkout: local git repository has no HEAD commit.",
|
|
29888
29944
|
`target_dir: ${repoDir}`,
|
|
29889
|
-
"The remote fetch may have succeeded, but project files were not checked out. Please inspect git status and retry
|
|
29945
|
+
"The remote fetch may have succeeded, but project files were not checked out. Please inspect git status and retry taptap-maker init."
|
|
29890
29946
|
].join("\n")
|
|
29891
29947
|
);
|
|
29892
29948
|
}
|
|
@@ -29899,7 +29955,7 @@ function enhanceCheckoutConflictError(error2, target) {
|
|
|
29899
29955
|
[
|
|
29900
29956
|
"Maker clone could not check out project files because existing local files would be overwritten.",
|
|
29901
29957
|
`target_dir: ${target}`,
|
|
29902
|
-
"Please move, rename, or delete the conflicting local files, then retry
|
|
29958
|
+
"Please move, rename, or delete the conflicting local files, then retry taptap-maker init.",
|
|
29903
29959
|
"",
|
|
29904
29960
|
message
|
|
29905
29961
|
].join("\n")
|
|
@@ -29964,12 +30020,19 @@ function readGit(args, cwd) {
|
|
|
29964
30020
|
});
|
|
29965
30021
|
}
|
|
29966
30022
|
async function runGitWithTransientRetry(args, options) {
|
|
29967
|
-
return runWithTransientRetry(() => runGit(args, options)
|
|
30023
|
+
return runWithTransientRetry(() => runGit(args, options), {
|
|
30024
|
+
stage: args[0] || "git",
|
|
30025
|
+
onProgress: options.onProgress
|
|
30026
|
+
});
|
|
29968
30027
|
}
|
|
29969
30028
|
async function runGitCaptureWithTransientRetry(args, options = {}) {
|
|
29970
|
-
return runWithTransientRetry(() => runGitCapture(args, options)
|
|
30029
|
+
return runWithTransientRetry(() => runGitCapture(args, options), {
|
|
30030
|
+
stage: args[0] || "git",
|
|
30031
|
+
onProgress: options.onProgress
|
|
30032
|
+
});
|
|
29971
30033
|
}
|
|
29972
|
-
async function runWithTransientRetry(operation) {
|
|
30034
|
+
async function runWithTransientRetry(operation, options) {
|
|
30035
|
+
var _a2;
|
|
29973
30036
|
let retries = 0;
|
|
29974
30037
|
const maxRetries = 2;
|
|
29975
30038
|
for (; ; ) {
|
|
@@ -29977,20 +30040,65 @@ async function runWithTransientRetry(operation) {
|
|
|
29977
30040
|
await operation();
|
|
29978
30041
|
return retries;
|
|
29979
30042
|
} catch (error2) {
|
|
29980
|
-
|
|
30043
|
+
const decision = getMakerGitRetryDecisionFromError(error2);
|
|
30044
|
+
if (!decision.retry) {
|
|
29981
30045
|
throw error2;
|
|
29982
30046
|
}
|
|
30047
|
+
if (retries >= maxRetries) {
|
|
30048
|
+
throw appendRetryExhausted(error2, retries, decision);
|
|
30049
|
+
}
|
|
29983
30050
|
retries += 1;
|
|
29984
|
-
|
|
30051
|
+
(_a2 = options.onProgress) == null ? void 0 : _a2.call(options, {
|
|
30052
|
+
phase: options.stage,
|
|
30053
|
+
message: formatGitRetryProgressMessage(options.stage, decision, retries, maxRetries)
|
|
30054
|
+
});
|
|
30055
|
+
await sleep(getGitRetryDelayMs() * retries);
|
|
29985
30056
|
}
|
|
29986
30057
|
}
|
|
29987
30058
|
}
|
|
29988
|
-
function
|
|
30059
|
+
function formatGitRetryProgressMessage(stage, decision, retries, maxRetries) {
|
|
30060
|
+
const reason = decision.reason || "temporary_remote_failure";
|
|
30061
|
+
const prefix = (stage === "clone" || stage === "fetch") && reason === "remote_http_5xx" ? "Maker server may still be preparing the repository" : "Maker git remote is temporarily unavailable";
|
|
30062
|
+
return `${prefix} (${reason}); retrying ${retries}/${maxRetries}. Please keep this running.`;
|
|
30063
|
+
}
|
|
30064
|
+
function getMakerGitRetryDecisionFromError(error2) {
|
|
30065
|
+
if (error2 instanceof MakerGitError) {
|
|
30066
|
+
return getMakerGitRetryDecision(
|
|
30067
|
+
[error2.failure.stdout, error2.failure.stderr, error2.failure.message].filter(Boolean).join("\n")
|
|
30068
|
+
);
|
|
30069
|
+
}
|
|
29989
30070
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
29990
|
-
return
|
|
29991
|
-
|
|
30071
|
+
return getMakerGitRetryDecision(message);
|
|
30072
|
+
}
|
|
30073
|
+
function appendRetryExhausted(error2, retryAttempts, decision) {
|
|
30074
|
+
if (error2 instanceof MakerGitError) {
|
|
30075
|
+
return new MakerGitError({
|
|
30076
|
+
...error2.failure,
|
|
30077
|
+
retryable: decision.retry,
|
|
30078
|
+
retryReason: decision.reason,
|
|
30079
|
+
retryAttempts,
|
|
30080
|
+
message: [
|
|
30081
|
+
error2.failure.message,
|
|
30082
|
+
"",
|
|
30083
|
+
`Maker git transient retry exhausted after ${retryAttempts} retry attempts.`,
|
|
30084
|
+
decision.reason ? `retry_reason: ${decision.reason}` : ""
|
|
30085
|
+
].filter(Boolean).join("\n")
|
|
30086
|
+
});
|
|
30087
|
+
}
|
|
30088
|
+
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
30089
|
+
return new Error(
|
|
30090
|
+
[
|
|
30091
|
+
message,
|
|
30092
|
+
"",
|
|
30093
|
+
`Maker git transient retry exhausted after ${retryAttempts} retry attempts.`,
|
|
30094
|
+
decision.reason ? `retry_reason: ${decision.reason}` : ""
|
|
30095
|
+
].filter(Boolean).join("\n")
|
|
29992
30096
|
);
|
|
29993
30097
|
}
|
|
30098
|
+
function getGitRetryDelayMs() {
|
|
30099
|
+
const value = Number.parseInt(process.env.TAPTAP_MAKER_GIT_RETRY_DELAY_MS || "", 10);
|
|
30100
|
+
return Number.isFinite(value) && value >= 0 ? value : 1500;
|
|
30101
|
+
}
|
|
29994
30102
|
function sleep(ms) {
|
|
29995
30103
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
29996
30104
|
}
|
|
@@ -30226,7 +30334,7 @@ function getBundledSkillSourceDir(skillName) {
|
|
|
30226
30334
|
}
|
|
30227
30335
|
|
|
30228
30336
|
// src/maker/server/mcp.ts
|
|
30229
|
-
var VERSION = true ? "1.23.
|
|
30337
|
+
var VERSION = true ? "1.23.3" : "dev";
|
|
30230
30338
|
var DEFAULT_PROXY_PACKAGE = "@taptap/instant-games-open-mcp@1.22.0";
|
|
30231
30339
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
30232
30340
|
var LONG_OPERATION_HEARTBEAT_MS = 3 * 60 * 1e3;
|
|
@@ -30241,35 +30349,8 @@ var MakerCloneFailedError = class extends Error {
|
|
|
30241
30349
|
};
|
|
30242
30350
|
var tools = [
|
|
30243
30351
|
{
|
|
30244
|
-
name: "
|
|
30245
|
-
description: "
|
|
30246
|
-
inputSchema: {
|
|
30247
|
-
type: "object",
|
|
30248
|
-
properties: {
|
|
30249
|
-
manual_pat: {
|
|
30250
|
-
type: "string",
|
|
30251
|
-
description: "Maker PAT provided by the user. It will be saved for later Maker API and git operations."
|
|
30252
|
-
}
|
|
30253
|
-
},
|
|
30254
|
-
required: ["manual_pat"]
|
|
30255
|
-
}
|
|
30256
|
-
},
|
|
30257
|
-
{
|
|
30258
|
-
name: "maker_list_apps",
|
|
30259
|
-
description: "List Maker apps available to the cached or provided Maker PAT. Use this for unbound Maker directory initialization or explicit app-list requests. If the current directory is unbound, show every returned app entry to the user and ask them to choose; do not summarize the list as a count only. If maker_status already reports the current directory is bound, treat this list as reference only and do not ask which app to clone unless the user explicitly wants to switch or re-clone.",
|
|
30260
|
-
inputSchema: {
|
|
30261
|
-
type: "object",
|
|
30262
|
-
properties: {
|
|
30263
|
-
pat: {
|
|
30264
|
-
type: "string",
|
|
30265
|
-
description: "Optional Maker PAT override. If provided, it is saved for later Maker operations."
|
|
30266
|
-
}
|
|
30267
|
-
}
|
|
30268
|
-
}
|
|
30269
|
-
},
|
|
30270
|
-
{
|
|
30271
|
-
name: "maker_status",
|
|
30272
|
-
description: "Show local Maker MCP status for the user current working directory: Git availability, PAT/TapTap token status, project binding, AI dev kit status, bundled skill document paths, validation checklist, and available apps when the current directory is unbound and PAT exists. If the current directory is unbound and apps are returned, show every app entry to the user; do not summarize the list as a count only. If the MCP process cwd differs from the user current working directory, pass target_dir with the user current working directory.",
|
|
30352
|
+
name: "maker_status_lite",
|
|
30353
|
+
description: "Compatibility fallback for clients that cannot read the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow skill document paths.",
|
|
30273
30354
|
inputSchema: {
|
|
30274
30355
|
type: "object",
|
|
30275
30356
|
properties: {
|
|
@@ -30280,57 +30361,9 @@ var tools = [
|
|
|
30280
30361
|
}
|
|
30281
30362
|
}
|
|
30282
30363
|
},
|
|
30283
|
-
{
|
|
30284
|
-
name: "maker_clone_to_current_directory",
|
|
30285
|
-
description: "Clone a selected Maker app repository into the current agent working directory and write .maker-mcp/config.json. Requires Git and a concrete app_id. Before clone, the tool prepares the local AI dev kit automatically, skips dev-kit scripts, deletes the downloaded zip, and stages dev-kit ignore rules for merge after checkout. The tool checks local file conflicts before checkout and keeps non-conflicting local files.",
|
|
30286
|
-
inputSchema: {
|
|
30287
|
-
type: "object",
|
|
30288
|
-
properties: {
|
|
30289
|
-
app_id: {
|
|
30290
|
-
type: "string",
|
|
30291
|
-
description: "Maker APP_ID to clone from the configured Maker git service."
|
|
30292
|
-
},
|
|
30293
|
-
target_dir: {
|
|
30294
|
-
type: "string",
|
|
30295
|
-
description: "Optional target directory. Defaults to the MCP process cwd. Pass the user current working directory when it differs from the MCP process cwd."
|
|
30296
|
-
},
|
|
30297
|
-
pat: {
|
|
30298
|
-
type: "string",
|
|
30299
|
-
description: "Optional Maker PAT override. If provided, it is saved and used for git authentication."
|
|
30300
|
-
},
|
|
30301
|
-
user_id: {
|
|
30302
|
-
type: "string",
|
|
30303
|
-
description: "Optional Maker user_id from maker_list_apps output. If omitted, the tool will try to resolve it from the app list."
|
|
30304
|
-
}
|
|
30305
|
-
},
|
|
30306
|
-
required: ["app_id"]
|
|
30307
|
-
}
|
|
30308
|
-
},
|
|
30309
|
-
{
|
|
30310
|
-
name: "maker_submit_current_directory",
|
|
30311
|
-
description: 'Commit, push, and build current Maker project directory changes. Requires local Git. If Git is missing, stop and show install guidance; do not stage, commit, push, or build. Use this in Maker projects when the user says "帮我提交", "帮我提交代码", "提交", "提交代码", "提交并推送", "push", "帮我提交代码到maker", "帮我提交代码到taptap制造", "帮我提交代码到tap制造", or "帮我提交代码到tap". Maker submit means commit + push + build: after a successful push, this tool MUST run the remote Maker build and return the build result. If the remote build fails after push, return build_failure details together with the successful submit result. For build requests that stop on local changes, continue through maker_build_current_directory with submit_local_changes_before_build=true and remember_build_submit_preference=true so the build workflow can save the auto-submit preference and return the build result. This submit tool bypasses local generic Git branch/task-id rules and pushes directly to the Maker remote configured for the current directory.',
|
|
30312
|
-
inputSchema: {
|
|
30313
|
-
type: "object",
|
|
30314
|
-
properties: {
|
|
30315
|
-
message: {
|
|
30316
|
-
type: "string",
|
|
30317
|
-
description: "Optional commit message. If omitted, Maker MCP generates a simple message from changed files."
|
|
30318
|
-
},
|
|
30319
|
-
target_dir: {
|
|
30320
|
-
type: "string",
|
|
30321
|
-
description: "Optional target directory. Defaults to the MCP process cwd. Pass the user current working directory when it differs from the MCP process cwd."
|
|
30322
|
-
},
|
|
30323
|
-
files: {
|
|
30324
|
-
type: "array",
|
|
30325
|
-
items: { type: "string" },
|
|
30326
|
-
description: "Optional files to stage. Defaults to all changes."
|
|
30327
|
-
}
|
|
30328
|
-
}
|
|
30329
|
-
}
|
|
30330
|
-
},
|
|
30331
30364
|
{
|
|
30332
30365
|
name: "maker_build_current_directory",
|
|
30333
|
-
description: '
|
|
30366
|
+
description: 'Sync and build the current Maker game. Use this single tool for user requests like "构建", "build", "跑一下", "预览", "验证一下", "提交", "提交代码", "推送", or "push" in a Maker project. If local changes or committed-but-unpushed commits exist, the tool commits when needed, pushes to Maker remote, then triggers remote Maker build. If push fails, build is not started and the result includes recovery details for the local Agent to handle merge/conflict resolution. If push succeeds but remote build fails, report that code is already on Maker remote and include build failure details. Only set confirm_remote_build_without_submit=true when the user explicitly says they do not want to submit local changes and wants to build the current remote version.',
|
|
30334
30367
|
inputSchema: {
|
|
30335
30368
|
type: "object",
|
|
30336
30369
|
properties: {
|
|
@@ -30371,22 +30404,31 @@ var tools = [
|
|
|
30371
30404
|
type: "number",
|
|
30372
30405
|
description: "Optional remote build timeout in milliseconds. Defaults to 10 minutes. If timed out, do not retry blindly; inspect remote build logs first."
|
|
30373
30406
|
},
|
|
30374
|
-
|
|
30375
|
-
type: "
|
|
30376
|
-
description: "
|
|
30407
|
+
message: {
|
|
30408
|
+
type: "string",
|
|
30409
|
+
description: "Optional commit message used when local file changes need to be committed before build."
|
|
30377
30410
|
},
|
|
30378
|
-
|
|
30379
|
-
type: "
|
|
30380
|
-
|
|
30411
|
+
files: {
|
|
30412
|
+
type: "array",
|
|
30413
|
+
items: { type: "string" },
|
|
30414
|
+
description: "Optional files to stage before build. Defaults to all local changes."
|
|
30381
30415
|
},
|
|
30382
|
-
|
|
30416
|
+
confirm_remote_build_without_submit: {
|
|
30383
30417
|
type: "boolean",
|
|
30384
|
-
description:
|
|
30418
|
+
description: "Set true only after the user explicitly confirms they do not want to submit local changes and want to build the current Maker remote committed version."
|
|
30385
30419
|
}
|
|
30386
30420
|
}
|
|
30387
30421
|
}
|
|
30388
30422
|
}
|
|
30389
30423
|
];
|
|
30424
|
+
var resources = [
|
|
30425
|
+
{
|
|
30426
|
+
uri: "maker://status",
|
|
30427
|
+
name: "Maker status",
|
|
30428
|
+
description: "Local TapTap Maker project status, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow skill document paths.",
|
|
30429
|
+
mimeType: "text/plain"
|
|
30430
|
+
}
|
|
30431
|
+
];
|
|
30390
30432
|
async function startMakerMcpServer() {
|
|
30391
30433
|
const server = new Server(
|
|
30392
30434
|
{
|
|
@@ -30395,16 +30437,33 @@ async function startMakerMcpServer() {
|
|
|
30395
30437
|
},
|
|
30396
30438
|
{
|
|
30397
30439
|
capabilities: {
|
|
30398
|
-
tools: {}
|
|
30440
|
+
tools: {},
|
|
30441
|
+
resources: {}
|
|
30399
30442
|
}
|
|
30400
30443
|
}
|
|
30401
30444
|
);
|
|
30402
30445
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools }));
|
|
30446
|
+
server.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources }));
|
|
30447
|
+
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
30448
|
+
const uri = request.params.uri;
|
|
30449
|
+
if (uri !== "maker://status") {
|
|
30450
|
+
throw new McpError(ErrorCode.InvalidParams, `Unknown Maker resource: ${uri}`);
|
|
30451
|
+
}
|
|
30452
|
+
return {
|
|
30453
|
+
contents: [
|
|
30454
|
+
{
|
|
30455
|
+
uri,
|
|
30456
|
+
mimeType: "text/plain",
|
|
30457
|
+
text: await formatStatus()
|
|
30458
|
+
}
|
|
30459
|
+
]
|
|
30460
|
+
};
|
|
30461
|
+
});
|
|
30403
30462
|
server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
|
|
30404
|
-
var _a2
|
|
30463
|
+
var _a2;
|
|
30405
30464
|
const name = request.params.name;
|
|
30406
30465
|
try {
|
|
30407
|
-
if (name === "
|
|
30466
|
+
if (name === "maker_status_lite") {
|
|
30408
30467
|
const args = request.params.arguments || {};
|
|
30409
30468
|
return {
|
|
30410
30469
|
content: [
|
|
@@ -30417,221 +30476,10 @@ async function startMakerMcpServer() {
|
|
|
30417
30476
|
]
|
|
30418
30477
|
};
|
|
30419
30478
|
}
|
|
30420
|
-
if (name === "maker_exchange_pat") {
|
|
30421
|
-
const args = request.params.arguments || {};
|
|
30422
|
-
if (!args.manual_pat) {
|
|
30423
|
-
throw new McpError(ErrorCode.InvalidParams, "manual_pat is required");
|
|
30424
|
-
}
|
|
30425
|
-
const pat = saveManualMakerPat(args.manual_pat);
|
|
30426
|
-
let tapAuthText;
|
|
30427
|
-
try {
|
|
30428
|
-
const tapAuth = await requestTapAuthWithPat(args.manual_pat);
|
|
30429
|
-
tapAuthText = [
|
|
30430
|
-
"TapTap token 已通过 PAT 获取并保存。",
|
|
30431
|
-
`- kid: ${mask(tapAuth.kid)}`,
|
|
30432
|
-
`- token_type: ${tapAuth.token_type}`,
|
|
30433
|
-
`- saved: ${getTapAuthPath()}`
|
|
30434
|
-
].join("\n");
|
|
30435
|
-
} catch (error2) {
|
|
30436
|
-
tapAuthText = [
|
|
30437
|
-
"TapTap token 自动获取失败。",
|
|
30438
|
-
`原因:${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
30439
|
-
"远端 Maker MCP tools 需要 TapTap token;请确认 PAT 是否有效后重新调用 maker_exchange_pat。"
|
|
30440
|
-
].join("\n");
|
|
30441
|
-
}
|
|
30442
|
-
let nextText;
|
|
30443
|
-
try {
|
|
30444
|
-
const projects = await listMakerProjects({ pat: args.manual_pat });
|
|
30445
|
-
nextText = [
|
|
30446
|
-
"已自动列出可用 Maker Apps。",
|
|
30447
|
-
"当前目录未绑定时,请逐项展示下面完整列表,不要只总结数量;然后让用户选择编号或 app_id。",
|
|
30448
|
-
"",
|
|
30449
|
-
formatProjectList(projects)
|
|
30450
|
-
].join("\n");
|
|
30451
|
-
} catch (error2) {
|
|
30452
|
-
nextText = [
|
|
30453
|
-
"自动列出 Maker Apps 失败。",
|
|
30454
|
-
`原因:${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
30455
|
-
"请确认 PAT 是否有效,然后重新调用 maker_list_apps。"
|
|
30456
|
-
].join("\n");
|
|
30457
|
-
}
|
|
30458
|
-
return {
|
|
30459
|
-
content: [
|
|
30460
|
-
{
|
|
30461
|
-
type: "text",
|
|
30462
|
-
text: [
|
|
30463
|
-
"✓ Maker PAT ready",
|
|
30464
|
-
"",
|
|
30465
|
-
`- pat: ${mask(pat.token)}`,
|
|
30466
|
-
`- saved: ${getPatPath()}`,
|
|
30467
|
-
"",
|
|
30468
|
-
tapAuthText,
|
|
30469
|
-
"",
|
|
30470
|
-
nextText
|
|
30471
|
-
].join("\n")
|
|
30472
|
-
}
|
|
30473
|
-
]
|
|
30474
|
-
};
|
|
30475
|
-
}
|
|
30476
|
-
if (name === "maker_list_apps") {
|
|
30477
|
-
const args = request.params.arguments || {};
|
|
30478
|
-
const projects = await listMakerProjects({
|
|
30479
|
-
pat: args.pat
|
|
30480
|
-
});
|
|
30481
|
-
return {
|
|
30482
|
-
content: [
|
|
30483
|
-
{
|
|
30484
|
-
type: "text",
|
|
30485
|
-
text: formatProjectList(projects)
|
|
30486
|
-
}
|
|
30487
|
-
]
|
|
30488
|
-
};
|
|
30489
|
-
}
|
|
30490
|
-
if (name === "maker_clone_to_current_directory") {
|
|
30491
|
-
const args = request.params.arguments || {};
|
|
30492
|
-
if (!args.app_id) {
|
|
30493
|
-
throw new McpError(ErrorCode.InvalidParams, "app_id is required");
|
|
30494
|
-
}
|
|
30495
|
-
const targetDir = resolveMakerToolTargetDir(args.target_dir);
|
|
30496
|
-
ensureGitAvailable();
|
|
30497
|
-
const progressReporter = createToolProgressReporter(
|
|
30498
|
-
(_a2 = request.params._meta) == null ? void 0 : _a2.progressToken,
|
|
30499
|
-
extra,
|
|
30500
|
-
"Maker clone"
|
|
30501
|
-
);
|
|
30502
|
-
let result;
|
|
30503
|
-
let devKitResult = {
|
|
30504
|
-
targetDir,
|
|
30505
|
-
sourceDir: targetDir,
|
|
30506
|
-
installedEntries: [],
|
|
30507
|
-
skippedEntries: [],
|
|
30508
|
-
gitignorePath: path7.join(targetDir, ".gitignore"),
|
|
30509
|
-
stagedGitignorePath: path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
|
|
30510
|
-
};
|
|
30511
|
-
let devKitState = "prepared";
|
|
30512
|
-
let devKitError = "";
|
|
30513
|
-
let progressSummary;
|
|
30514
|
-
try {
|
|
30515
|
-
progressReporter.report({
|
|
30516
|
-
progress: 1,
|
|
30517
|
-
total: 100,
|
|
30518
|
-
phase: "dev_kit",
|
|
30519
|
-
message: "Preparing local AI dev kit before Maker clone"
|
|
30520
|
-
});
|
|
30521
|
-
const devKitStatus = inspectAiDevKit(targetDir);
|
|
30522
|
-
if (devKitStatus.ready) {
|
|
30523
|
-
const presentManagedEntries = listPresentDevKitManagedEntries(targetDir);
|
|
30524
|
-
writeDevKitStagedGitignore(
|
|
30525
|
-
path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
30526
|
-
presentManagedEntries
|
|
30527
|
-
);
|
|
30528
|
-
devKitState = "already_ready";
|
|
30529
|
-
devKitResult = {
|
|
30530
|
-
targetDir,
|
|
30531
|
-
sourceDir: targetDir,
|
|
30532
|
-
installedEntries: presentManagedEntries,
|
|
30533
|
-
skippedEntries: [],
|
|
30534
|
-
gitignorePath: path7.join(targetDir, ".gitignore"),
|
|
30535
|
-
stagedGitignorePath: path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
|
|
30536
|
-
};
|
|
30537
|
-
} else {
|
|
30538
|
-
try {
|
|
30539
|
-
devKitResult = await installAiDevKit({
|
|
30540
|
-
targetDir
|
|
30541
|
-
});
|
|
30542
|
-
} catch (error2) {
|
|
30543
|
-
const presentManagedEntries = listPresentDevKitManagedEntries(targetDir);
|
|
30544
|
-
if (presentManagedEntries.length > 0) {
|
|
30545
|
-
writeDevKitStagedGitignore(
|
|
30546
|
-
path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
30547
|
-
presentManagedEntries
|
|
30548
|
-
);
|
|
30549
|
-
}
|
|
30550
|
-
devKitState = "failed_non_blocking";
|
|
30551
|
-
devKitError = error2 instanceof Error ? error2.message : String(error2);
|
|
30552
|
-
devKitResult.installedEntries = presentManagedEntries;
|
|
30553
|
-
}
|
|
30554
|
-
}
|
|
30555
|
-
progressReporter.report({
|
|
30556
|
-
progress: 5,
|
|
30557
|
-
total: 100,
|
|
30558
|
-
phase: "dev_kit",
|
|
30559
|
-
message: devKitState === "failed_non_blocking" ? "Local AI dev kit preparation failed; continuing Maker clone" : "Local AI dev kit prepared"
|
|
30560
|
-
});
|
|
30561
|
-
result = await cloneMakerProject({
|
|
30562
|
-
appId: args.app_id,
|
|
30563
|
-
targetDir,
|
|
30564
|
-
pat: args.pat,
|
|
30565
|
-
userId: args.user_id,
|
|
30566
|
-
sceEndpoint: process.env.SCE_MCP_URL,
|
|
30567
|
-
onProgress: progressReporter.report
|
|
30568
|
-
});
|
|
30569
|
-
progressSummary = progressReporter.finish();
|
|
30570
|
-
} catch (error2) {
|
|
30571
|
-
progressReporter.finish();
|
|
30572
|
-
throw new MakerCloneFailedError(targetDir, error2);
|
|
30573
|
-
}
|
|
30574
|
-
return {
|
|
30575
|
-
content: [
|
|
30576
|
-
{
|
|
30577
|
-
type: "text",
|
|
30578
|
-
text: [
|
|
30579
|
-
"✓ Maker project cloned",
|
|
30580
|
-
"",
|
|
30581
|
-
...formatCloneWarnings(result.warnings),
|
|
30582
|
-
`- app_id: ${args.app_id}`,
|
|
30583
|
-
`- target_dir: ${result.targetDir}`,
|
|
30584
|
-
`- status: ${result.status}`,
|
|
30585
|
-
`- retried_with_new_pat: ${result.retriedWithNewPat ? "yes" : "no"}`,
|
|
30586
|
-
`- ai_dev_kit: ${devKitState}`,
|
|
30587
|
-
...devKitError ? [
|
|
30588
|
-
`- ai_dev_kit_error: ${devKitError}`,
|
|
30589
|
-
"- ai_dev_kit_next_step: run maker_status after clone to retry dev kit restoration"
|
|
30590
|
-
] : [],
|
|
30591
|
-
`- ai_dev_kit_installed_entries: ${devKitResult.installedEntries.join(", ") || "(none)"}`,
|
|
30592
|
-
`- ai_dev_kit_skipped_entries: ${devKitResult.skippedEntries.join(", ") || "(none)"}`,
|
|
30593
|
-
...formatProgressSummary(progressSummary),
|
|
30594
|
-
"- project config: .maker-mcp/config.json"
|
|
30595
|
-
].join("\n")
|
|
30596
|
-
}
|
|
30597
|
-
]
|
|
30598
|
-
};
|
|
30599
|
-
}
|
|
30600
|
-
if (name === "maker_submit_current_directory") {
|
|
30601
|
-
const args = request.params.arguments || {};
|
|
30602
|
-
const targetDir = resolveMakerToolTargetDir(args.target_dir);
|
|
30603
|
-
const progressReporter = createToolProgressReporter(
|
|
30604
|
-
(_b = request.params._meta) == null ? void 0 : _b.progressToken,
|
|
30605
|
-
extra,
|
|
30606
|
-
"Maker submit"
|
|
30607
|
-
);
|
|
30608
|
-
let result;
|
|
30609
|
-
let progressSummary;
|
|
30610
|
-
try {
|
|
30611
|
-
result = await pushThenBuildCurrentDirectory({
|
|
30612
|
-
targetDir,
|
|
30613
|
-
message: args.message,
|
|
30614
|
-
files: args.files,
|
|
30615
|
-
onProgress: progressReporter.report
|
|
30616
|
-
});
|
|
30617
|
-
progressSummary = progressReporter.finish();
|
|
30618
|
-
} catch (error2) {
|
|
30619
|
-
progressReporter.finish();
|
|
30620
|
-
throw error2;
|
|
30621
|
-
}
|
|
30622
|
-
return {
|
|
30623
|
-
content: [
|
|
30624
|
-
{
|
|
30625
|
-
type: "text",
|
|
30626
|
-
text: formatPushResult(targetDir, result, progressSummary)
|
|
30627
|
-
}
|
|
30628
|
-
]
|
|
30629
|
-
};
|
|
30630
|
-
}
|
|
30631
30479
|
if (name === "maker_build_current_directory") {
|
|
30632
30480
|
const args = request.params.arguments || {};
|
|
30633
30481
|
const progressReporter = createToolProgressReporter(
|
|
30634
|
-
(
|
|
30482
|
+
(_a2 = request.params._meta) == null ? void 0 : _a2.progressToken,
|
|
30635
30483
|
extra,
|
|
30636
30484
|
"Maker build"
|
|
30637
30485
|
);
|
|
@@ -30648,9 +30496,9 @@ async function startMakerMcpServer() {
|
|
|
30648
30496
|
serverUrl: args.server_url,
|
|
30649
30497
|
env: args.env,
|
|
30650
30498
|
timeoutMs: args.timeout_ms,
|
|
30499
|
+
message: args.message,
|
|
30500
|
+
files: args.files,
|
|
30651
30501
|
confirmRemoteBuildWithoutSubmit: args.confirm_remote_build_without_submit,
|
|
30652
|
-
submitLocalChangesBeforeBuild: args.submit_local_changes_before_build,
|
|
30653
|
-
rememberBuildSubmitPreference: args.remember_build_submit_preference,
|
|
30654
30502
|
onProgress: progressReporter.report
|
|
30655
30503
|
});
|
|
30656
30504
|
progressSummary = progressReporter.finish();
|
|
@@ -30713,7 +30561,7 @@ async function formatStatus(options = {}) {
|
|
|
30713
30561
|
const projectSection = identify.projectId ? [
|
|
30714
30562
|
"目标目录已绑定 Maker 项目。",
|
|
30715
30563
|
"请继续在当前绑定项目上执行状态、提交、构建等操作;不要再引导用户 clone,除非用户明确要求切换或重新拉取项目。",
|
|
30716
|
-
"本地 Maker 工作流请优先参考 taptap-maker-local skill;
|
|
30564
|
+
"本地 Maker 工作流请优先参考 taptap-maker-local skill;CLI 负责初始化/PAT/app/clone,MCP 只保留状态和同步构建。"
|
|
30717
30565
|
].join("\n") : isLikelyAiDialogueDirectory(targetDir) ? formatAiDialogueDirectoryHint(targetDir) : pat ? await formatAutoProjectListFromPat() : formatIdentifyHint();
|
|
30718
30566
|
return [
|
|
30719
30567
|
"TapTap Maker MCP status",
|
|
@@ -30774,7 +30622,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
|
|
|
30774
30622
|
"- detected_issue: current directory looks like an AI dialogue/session directory, not a Maker project directory.",
|
|
30775
30623
|
"- do_not_clone_here: yes",
|
|
30776
30624
|
"- next_step: inspect the AI client attached/extra workspace directories and choose the Maker project directory.",
|
|
30777
|
-
|
|
30625
|
+
"- if_single_attached_workspace: read maker://status or call maker_status_lite with the attached project directory.",
|
|
30778
30626
|
"- if_multiple_attached_workspaces: show the directories to the user and ask which one is the Maker project.",
|
|
30779
30627
|
"- do_not_show_app_selection_here: yes"
|
|
30780
30628
|
].join("\n");
|
|
@@ -30786,29 +30634,14 @@ function resolveMakerToolTargetDir(targetDir) {
|
|
|
30786
30634
|
return process.cwd();
|
|
30787
30635
|
}
|
|
30788
30636
|
async function formatAiDevKitStatus(projectRoot) {
|
|
30789
|
-
const
|
|
30790
|
-
if (
|
|
30791
|
-
return formatAiDevKitStatusLines("ready",
|
|
30792
|
-
}
|
|
30793
|
-
try {
|
|
30794
|
-
const installResult = await installAiDevKit({
|
|
30795
|
-
targetDir: projectRoot,
|
|
30796
|
-
preserveExisting: true
|
|
30797
|
-
});
|
|
30798
|
-
finalizeStagedDevKitGitignore(projectRoot);
|
|
30799
|
-
const after = inspectAiDevKit(projectRoot);
|
|
30800
|
-
return [
|
|
30801
|
-
...formatAiDevKitStatusLines("restored", after),
|
|
30802
|
-
`- restored_missing_entries: ${before.missingEntries.join(", ") || "(none)"}`,
|
|
30803
|
-
`- installed_entries: ${installResult.installedEntries.join(", ") || "(none)"}`
|
|
30804
|
-
].join("\n");
|
|
30805
|
-
} catch (error2) {
|
|
30806
|
-
return [
|
|
30807
|
-
...formatAiDevKitStatusLines("missing", before),
|
|
30808
|
-
`- restore_error: ${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
30809
|
-
"- next_step: 请检查网络后重新调用 maker_status,或重新执行 Maker clone 初始化流程。"
|
|
30810
|
-
].join("\n");
|
|
30637
|
+
const devKitStatus = inspectAiDevKit(projectRoot);
|
|
30638
|
+
if (devKitStatus.ready) {
|
|
30639
|
+
return formatAiDevKitStatusLines("ready", devKitStatus).join("\n");
|
|
30811
30640
|
}
|
|
30641
|
+
return [
|
|
30642
|
+
...formatAiDevKitStatusLines("missing", devKitStatus),
|
|
30643
|
+
"- next_step: 请运行 taptap-maker dev-kit update,或重新执行 taptap-maker init。"
|
|
30644
|
+
].join("\n");
|
|
30812
30645
|
}
|
|
30813
30646
|
function formatAiDevKitStatusLines(status, devKitStatus) {
|
|
30814
30647
|
return [
|
|
@@ -30820,19 +30653,6 @@ function formatAiDevKitStatusLines(status, devKitStatus) {
|
|
|
30820
30653
|
`- missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`
|
|
30821
30654
|
];
|
|
30822
30655
|
}
|
|
30823
|
-
function rememberBuildSubmitPreference(targetDir) {
|
|
30824
|
-
const identify = identifyMakerProject({ cwd: targetDir });
|
|
30825
|
-
if (!identify.projectRoot || !identify.projectId) {
|
|
30826
|
-
throw new Error(
|
|
30827
|
-
`${targetDir} is not bound to a Maker project. Cannot save build submit preference.`
|
|
30828
|
-
);
|
|
30829
|
-
}
|
|
30830
|
-
saveProjectConfig(identify.projectRoot, {
|
|
30831
|
-
...identify.config || { project_id: identify.projectId },
|
|
30832
|
-
project_id: identify.projectId,
|
|
30833
|
-
build_local_changes_policy: "auto_submit"
|
|
30834
|
-
});
|
|
30835
|
-
}
|
|
30836
30656
|
async function formatAutoProjectListFromPat() {
|
|
30837
30657
|
try {
|
|
30838
30658
|
const projects = await listMakerProjects();
|
|
@@ -30846,16 +30666,10 @@ async function formatAutoProjectListFromPat() {
|
|
|
30846
30666
|
return [
|
|
30847
30667
|
"本地已有 Maker PAT,但自动列出 Maker Apps 失败。",
|
|
30848
30668
|
`原因:${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
30849
|
-
`如果 PAT
|
|
30669
|
+
`如果 PAT 已失效,请运行 taptap-maker pat set 并粘贴新的 Maker PAT。PAT 页面:${getMakerPatTokensUrl()}`
|
|
30850
30670
|
].join("\n");
|
|
30851
30671
|
}
|
|
30852
30672
|
}
|
|
30853
|
-
function mask(value) {
|
|
30854
|
-
if (value.length <= 12) {
|
|
30855
|
-
return "***";
|
|
30856
|
-
}
|
|
30857
|
-
return `${value.slice(0, 6)}...${value.slice(-4)}`;
|
|
30858
|
-
}
|
|
30859
30673
|
function formatProjectList(projects) {
|
|
30860
30674
|
if (projects.length === 0) {
|
|
30861
30675
|
return [
|
|
@@ -30873,30 +30687,10 @@ function formatProjectList(projects) {
|
|
|
30873
30687
|
(project, index) => `${index + 1}. ${project.id}${project.name ? ` ${project.name}` : ""}${project.user_id ? ` user_id=${project.user_id}` : ""}${project.gameType ? ` gameType=${project.gameType}` : ""}${project.stage ? ` stage=${project.stage}` : ""}${project.createdAt ? ` createdAt=${project.createdAt}` : ""}${project.lastConversationAt ? ` lastConversationAt=${project.lastConversationAt}` : ""}`
|
|
30874
30688
|
),
|
|
30875
30689
|
"",
|
|
30876
|
-
"仅当当前目录未绑定且用户要初始化或 clone 时,才让用户选择 app
|
|
30690
|
+
"仅当当前目录未绑定且用户要初始化或 clone 时,才让用户选择 app 并继续 taptap-maker init。",
|
|
30877
30691
|
"如果当前目录已绑定 Maker 项目,这个列表仅作账号项目参考;请继续当前项目,除非用户明确要求切换或重新 clone。"
|
|
30878
30692
|
].join("\n");
|
|
30879
30693
|
}
|
|
30880
|
-
function formatCloneWarnings(warnings) {
|
|
30881
|
-
if (warnings.length === 0) {
|
|
30882
|
-
return [
|
|
30883
|
-
"Pre-clone local directory check",
|
|
30884
|
-
"",
|
|
30885
|
-
"- result: checked",
|
|
30886
|
-
"- local_files: none found before clone, ignoring dot-prefixed local config entries",
|
|
30887
|
-
""
|
|
30888
|
-
];
|
|
30889
|
-
}
|
|
30890
|
-
return [
|
|
30891
|
-
"Pre-clone local directory check",
|
|
30892
|
-
"",
|
|
30893
|
-
"- result: found local files before clone",
|
|
30894
|
-
"- action: kept local files and continued unless they conflicted with Maker project files",
|
|
30895
|
-
"",
|
|
30896
|
-
...warnings.map((warning) => `- ${warning}`),
|
|
30897
|
-
""
|
|
30898
|
-
];
|
|
30899
|
-
}
|
|
30900
30694
|
function formatClonePartialStateLines(targetDir) {
|
|
30901
30695
|
const resolvedTargetDir = path7.resolve(targetDir);
|
|
30902
30696
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
@@ -30921,21 +30715,21 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
30921
30715
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
30922
30716
|
`- staged_dev_kit_gitignore: ${fs6.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
30923
30717
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
30924
|
-
safeToRetry ? "- next_step: 可以直接重试
|
|
30718
|
+
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态,不要重复 clone。"
|
|
30925
30719
|
].filter(Boolean);
|
|
30926
30720
|
}
|
|
30927
30721
|
function createRemoteProxyContext(options) {
|
|
30928
30722
|
const identify = identifyMakerProject({ cwd: options.targetDir });
|
|
30929
30723
|
if (!identify.projectRoot || !identify.projectId) {
|
|
30930
30724
|
throw new Error(
|
|
30931
|
-
`${options.targetDir} is not bound to a Maker project. Run
|
|
30725
|
+
`${options.targetDir} is not bound to a Maker project. Run taptap-maker init first.`
|
|
30932
30726
|
);
|
|
30933
30727
|
}
|
|
30934
30728
|
const projectConfig = loadProjectConfig(identify.projectRoot);
|
|
30935
30729
|
const projectId = (projectConfig == null ? void 0 : projectConfig.project_id) || identify.projectId;
|
|
30936
30730
|
const tapAuth = loadTapAuth();
|
|
30937
30731
|
if (!tapAuth) {
|
|
30938
|
-
throw new Error("Tap auth not found. Run
|
|
30732
|
+
throw new Error("Tap auth not found. Run taptap-maker pat set and paste a Maker PAT first.");
|
|
30939
30733
|
}
|
|
30940
30734
|
let userId = projectConfig == null ? void 0 : projectConfig.user_id;
|
|
30941
30735
|
if (!userId) {
|
|
@@ -30944,7 +30738,7 @@ function createRemoteProxyContext(options) {
|
|
|
30944
30738
|
}
|
|
30945
30739
|
if (!userId) {
|
|
30946
30740
|
throw new Error(
|
|
30947
|
-
"Cannot resolve user_id. Re-run
|
|
30741
|
+
"Cannot resolve user_id. Re-run taptap-maker init with PAT so the project config can cache user_id."
|
|
30948
30742
|
);
|
|
30949
30743
|
}
|
|
30950
30744
|
const env = getMakerEnvironment(options.env);
|
|
@@ -31089,56 +30883,42 @@ async function buildCurrentDirectory(options) {
|
|
|
31089
30883
|
const localChanges = await readMakerProjectLocalChanges(options.targetDir);
|
|
31090
30884
|
if (localChanges.hasChanges && !options.confirmRemoteBuildWithoutSubmit) {
|
|
31091
30885
|
const config2 = loadProjectConfig(localChanges.projectRoot);
|
|
31092
|
-
|
|
31093
|
-
|
|
31094
|
-
|
|
31095
|
-
|
|
31096
|
-
|
|
31097
|
-
|
|
31098
|
-
|
|
31099
|
-
|
|
31100
|
-
|
|
31101
|
-
|
|
31102
|
-
|
|
31103
|
-
|
|
31104
|
-
|
|
31105
|
-
|
|
31106
|
-
|
|
31107
|
-
|
|
31108
|
-
|
|
31109
|
-
|
|
31110
|
-
|
|
31111
|
-
|
|
31112
|
-
|
|
31113
|
-
|
|
31114
|
-
|
|
31115
|
-
|
|
31116
|
-
}
|
|
31117
|
-
let buildResult;
|
|
31118
|
-
try {
|
|
31119
|
-
buildResult = await runRemoteBuildCurrentDirectory(options, localChanges.projectRoot);
|
|
31120
|
-
} catch (error2) {
|
|
31121
|
-
return {
|
|
31122
|
-
mode: "build_failed_after_submit",
|
|
31123
|
-
projectRoot: localChanges.projectRoot,
|
|
31124
|
-
projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
|
|
31125
|
-
submitResult,
|
|
31126
|
-
buildFailure: toMakerBuildFailure(error2),
|
|
31127
|
-
buildLocalChangesPolicy
|
|
31128
|
-
};
|
|
31129
|
-
}
|
|
30886
|
+
(_a2 = options.onProgress) == null ? void 0 : _a2.call(options, {
|
|
30887
|
+
progress: 0,
|
|
30888
|
+
total: 100,
|
|
30889
|
+
phase: "sync",
|
|
30890
|
+
message: "Syncing local Maker changes before remote build"
|
|
30891
|
+
});
|
|
30892
|
+
const submitResult = await (options.submitLocalChanges || pushMakerProject)({
|
|
30893
|
+
cwd: localChanges.projectRoot,
|
|
30894
|
+
message: options.message,
|
|
30895
|
+
files: options.files,
|
|
30896
|
+
onProgress: options.onProgress
|
|
30897
|
+
});
|
|
30898
|
+
if (submitResult.failure || !submitResult.pushed && submitResult.status !== "clean") {
|
|
30899
|
+
return {
|
|
30900
|
+
mode: "submit_failed_before_build",
|
|
30901
|
+
projectRoot: localChanges.projectRoot,
|
|
30902
|
+
projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
|
|
30903
|
+
submitResult
|
|
30904
|
+
};
|
|
30905
|
+
}
|
|
30906
|
+
let buildResult;
|
|
30907
|
+
try {
|
|
30908
|
+
buildResult = await runRemoteBuildCurrentDirectory(options, localChanges.projectRoot);
|
|
30909
|
+
} catch (error2) {
|
|
31130
30910
|
return {
|
|
31131
|
-
|
|
30911
|
+
mode: "build_failed_after_submit",
|
|
30912
|
+
projectRoot: localChanges.projectRoot,
|
|
30913
|
+
projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
|
|
31132
30914
|
submitResult,
|
|
31133
|
-
|
|
30915
|
+
buildFailure: toMakerBuildFailure(error2)
|
|
31134
30916
|
};
|
|
31135
30917
|
}
|
|
31136
|
-
|
|
31137
|
-
|
|
31138
|
-
|
|
31139
|
-
|
|
31140
|
-
})
|
|
31141
|
-
);
|
|
30918
|
+
return {
|
|
30919
|
+
...buildResult,
|
|
30920
|
+
submitResult
|
|
30921
|
+
};
|
|
31142
30922
|
}
|
|
31143
30923
|
return runRemoteBuildCurrentDirectory(options, options.targetDir);
|
|
31144
30924
|
}
|
|
@@ -31205,42 +30985,6 @@ async function runRemoteBuildCurrentDirectory(options, targetDir) {
|
|
|
31205
30985
|
await client.close();
|
|
31206
30986
|
}
|
|
31207
30987
|
}
|
|
31208
|
-
async function pushThenBuildCurrentDirectory(options) {
|
|
31209
|
-
const submitResult = await (options.pushLocalChanges || pushMakerProject)({
|
|
31210
|
-
cwd: options.targetDir,
|
|
31211
|
-
message: options.message,
|
|
31212
|
-
files: options.files,
|
|
31213
|
-
onProgress: options.onProgress
|
|
31214
|
-
});
|
|
31215
|
-
if (!submitResult.pushed) {
|
|
31216
|
-
return {
|
|
31217
|
-
targetDir: options.targetDir,
|
|
31218
|
-
submitResult
|
|
31219
|
-
};
|
|
31220
|
-
}
|
|
31221
|
-
let buildResult;
|
|
31222
|
-
try {
|
|
31223
|
-
buildResult = await runRemoteBuildCurrentDirectory(
|
|
31224
|
-
{
|
|
31225
|
-
targetDir: options.targetDir,
|
|
31226
|
-
callRemoteBuild: options.callRemoteBuild,
|
|
31227
|
-
onProgress: options.onProgress
|
|
31228
|
-
},
|
|
31229
|
-
options.targetDir
|
|
31230
|
-
);
|
|
31231
|
-
} catch (error2) {
|
|
31232
|
-
return {
|
|
31233
|
-
targetDir: options.targetDir,
|
|
31234
|
-
submitResult,
|
|
31235
|
-
buildFailure: toMakerBuildFailure(error2)
|
|
31236
|
-
};
|
|
31237
|
-
}
|
|
31238
|
-
return {
|
|
31239
|
-
targetDir: options.targetDir,
|
|
31240
|
-
submitResult,
|
|
31241
|
-
buildResult
|
|
31242
|
-
};
|
|
31243
|
-
}
|
|
31244
30988
|
function toMakerBuildFailure(error2) {
|
|
31245
30989
|
return {
|
|
31246
30990
|
name: error2 instanceof Error ? error2.name : typeof error2,
|
|
@@ -31248,26 +30992,6 @@ function toMakerBuildFailure(error2) {
|
|
|
31248
30992
|
...error2 instanceof Error && error2.stack ? { stack: error2.stack } : {}
|
|
31249
30993
|
};
|
|
31250
30994
|
}
|
|
31251
|
-
function formatLocalChangesBeforeBuildMessage(files, options = {}) {
|
|
31252
|
-
const visibleFiles = files.slice(0, 20);
|
|
31253
|
-
const hiddenCount = Math.max(0, files.length - visibleFiles.length);
|
|
31254
|
-
return [
|
|
31255
|
-
"Current Maker project has local changes that are not submitted.",
|
|
31256
|
-
"",
|
|
31257
|
-
"当前有本地修改还没有提交。直接构建只会构建 Maker 云端已有版本,可能看不到这些新修改。",
|
|
31258
|
-
"请先询问用户选择:",
|
|
31259
|
-
"- 提交本地改动并触发构建(以后都是如此):再次调用 maker_build_current_directory,并设置 submit_local_changes_before_build=true 和 remember_build_submit_preference=true;工具会先 commit + push,再继续执行远端 build 并返回构建结果。后续构建遇到本地改动会默认自动提交并继续构建。",
|
|
31260
|
-
"- 如果用户明确说不提交、直接构建云端版本,再调用 maker_build_current_directory,并设置 confirm_remote_build_without_submit=true。",
|
|
31261
|
-
"",
|
|
31262
|
-
options.hasUnpushedCommits ? `unpushed_commits: ${options.ahead || "yes"}` : "",
|
|
31263
|
-
options.hasUnpushedCommits ? "note: 本地已有 commit 还没有推送到 Maker 远端;需要先 push,远端构建才会包含这些改动。" : "",
|
|
31264
|
-
options.hasUnpushedCommits ? "" : "",
|
|
31265
|
-
"local_changes:",
|
|
31266
|
-
...visibleFiles.map((file2) => `- ${file2}`),
|
|
31267
|
-
visibleFiles.length === 0 ? "- (none)" : "",
|
|
31268
|
-
...hiddenCount > 0 ? [`- ... and ${hiddenCount} more`] : []
|
|
31269
|
-
].filter((line) => line !== "").join("\n");
|
|
31270
|
-
}
|
|
31271
30995
|
function createBuildArgs(projectRoot, options) {
|
|
31272
30996
|
const buildArgs = {};
|
|
31273
30997
|
if (options.entry) {
|
|
@@ -31329,13 +31053,13 @@ function formatBuildResult(result, progressSummary) {
|
|
|
31329
31053
|
"",
|
|
31330
31054
|
`- project_root: ${result.projectRoot}`,
|
|
31331
31055
|
`- project_id: ${result.projectId}`,
|
|
31332
|
-
"- build_local_changes_policy: auto_submit",
|
|
31333
31056
|
`- branch: ${result.submitResult.branch}`,
|
|
31334
31057
|
`- status: ${result.submitResult.status}`,
|
|
31335
31058
|
`- committed: ${result.submitResult.committed ? "yes" : "no"}`,
|
|
31336
31059
|
result.submitResult.commitHash ? `- commit_hash: ${result.submitResult.commitHash}` : "",
|
|
31337
31060
|
result.submitResult.message ? `- commit_message: ${result.submitResult.message}` : "",
|
|
31338
31061
|
result.submitResult.ahead ? `- git_state: ${result.submitResult.ahead}` : "",
|
|
31062
|
+
result.submitResult.transientRetries ? `- transient_git_retries: ${result.submitResult.transientRetries}` : "",
|
|
31339
31063
|
...formatProgressSummary(progressSummary),
|
|
31340
31064
|
"",
|
|
31341
31065
|
"note: Maker build was not started because submit did not produce a pushed state.",
|
|
@@ -31353,13 +31077,13 @@ function formatBuildResult(result, progressSummary) {
|
|
|
31353
31077
|
"",
|
|
31354
31078
|
`- project_root: ${result.projectRoot}`,
|
|
31355
31079
|
`- project_id: ${result.projectId}`,
|
|
31356
|
-
result.buildLocalChangesPolicy ? `- build_local_changes_policy: ${result.buildLocalChangesPolicy}` : "",
|
|
31357
31080
|
`- branch: ${result.submitResult.branch}`,
|
|
31358
31081
|
`- status: ${result.submitResult.status}`,
|
|
31359
31082
|
`- committed: ${result.submitResult.committed ? "yes" : "no"}`,
|
|
31360
31083
|
result.submitResult.commitHash ? `- commit_hash: ${result.submitResult.commitHash}` : "",
|
|
31361
31084
|
result.submitResult.message ? `- commit_message: ${result.submitResult.message}` : "",
|
|
31362
31085
|
result.submitResult.ahead ? `- git_state: ${result.submitResult.ahead}` : "",
|
|
31086
|
+
result.submitResult.transientRetries ? `- transient_git_retries: ${result.submitResult.transientRetries}` : "",
|
|
31363
31087
|
...formatProgressSummary(progressSummary),
|
|
31364
31088
|
"",
|
|
31365
31089
|
...formatMakerBuildFailureLines(result.buildFailure)
|
|
@@ -31373,6 +31097,7 @@ function formatBuildResult(result, progressSummary) {
|
|
|
31373
31097
|
result.submitResult.commitHash ? ` - commit_hash: ${result.submitResult.commitHash}` : "",
|
|
31374
31098
|
result.submitResult.message ? ` - commit_message: ${result.submitResult.message}` : "",
|
|
31375
31099
|
result.submitResult.ahead ? ` - git_state: ${result.submitResult.ahead}` : "",
|
|
31100
|
+
result.submitResult.transientRetries ? ` - transient_git_retries: ${result.submitResult.transientRetries}` : "",
|
|
31376
31101
|
""
|
|
31377
31102
|
].filter(Boolean) : [];
|
|
31378
31103
|
const lines = [
|
|
@@ -31384,9 +31109,6 @@ function formatBuildResult(result, progressSummary) {
|
|
|
31384
31109
|
`- server_url: ${result.serverUrl}`,
|
|
31385
31110
|
`- env: ${result.env}`
|
|
31386
31111
|
];
|
|
31387
|
-
if (result.buildLocalChangesPolicy) {
|
|
31388
|
-
lines.push(`- build_local_changes_policy: ${result.buildLocalChangesPolicy}`);
|
|
31389
|
-
}
|
|
31390
31112
|
lines.push(
|
|
31391
31113
|
`- timeout_ms: ${result.timeoutMs}`,
|
|
31392
31114
|
`- build_args: ${JSON.stringify(result.buildArgs)}`,
|
|
@@ -31399,64 +31121,6 @@ function formatBuildResult(result, progressSummary) {
|
|
|
31399
31121
|
lines.push("remote_result:", indent(result.resultText));
|
|
31400
31122
|
return lines.join("\n");
|
|
31401
31123
|
}
|
|
31402
|
-
function formatPushResult(targetDir, result, progressSummary) {
|
|
31403
|
-
const submitResult = result.submitResult;
|
|
31404
|
-
const lines = [
|
|
31405
|
-
result.buildResult ? "✓ Maker project pushed, then remote Maker build finished" : submitResult.pushed ? "✗ Maker project pushed, but remote build result is missing" : submitResult.status === "clean" ? "Maker project has no changes to push" : "✗ Maker project push failed",
|
|
31406
|
-
"",
|
|
31407
|
-
`- target_dir: ${targetDir}`,
|
|
31408
|
-
`- branch: ${submitResult.branch}`,
|
|
31409
|
-
`- status: ${submitResult.status}`,
|
|
31410
|
-
`- committed: ${submitResult.committed ? "yes" : "no"}`,
|
|
31411
|
-
submitResult.commitHash ? `- commit_hash: ${submitResult.commitHash}` : "",
|
|
31412
|
-
submitResult.message ? `- commit_message: ${submitResult.message}` : "",
|
|
31413
|
-
submitResult.ahead ? `- git_state: ${submitResult.ahead}` : "",
|
|
31414
|
-
...formatProgressSummary(progressSummary)
|
|
31415
|
-
].filter(Boolean);
|
|
31416
|
-
if (result.buildResult) {
|
|
31417
|
-
return [
|
|
31418
|
-
...lines,
|
|
31419
|
-
"",
|
|
31420
|
-
"remote_build:",
|
|
31421
|
-
indent(
|
|
31422
|
-
[
|
|
31423
|
-
`- project_id: ${result.buildResult.projectId}`,
|
|
31424
|
-
`- project_path: ${result.buildResult.projectPath}`,
|
|
31425
|
-
`- server_url: ${result.buildResult.serverUrl}`,
|
|
31426
|
-
`- env: ${result.buildResult.env}`,
|
|
31427
|
-
`- timeout_ms: ${result.buildResult.timeoutMs}`,
|
|
31428
|
-
`- build_args: ${JSON.stringify(result.buildResult.buildArgs)}`,
|
|
31429
|
-
"",
|
|
31430
|
-
"remote_result:",
|
|
31431
|
-
indent(result.buildResult.resultText)
|
|
31432
|
-
].join("\n")
|
|
31433
|
-
)
|
|
31434
|
-
].join("\n");
|
|
31435
|
-
}
|
|
31436
|
-
if (result.buildFailure) {
|
|
31437
|
-
return [
|
|
31438
|
-
...lines,
|
|
31439
|
-
"",
|
|
31440
|
-
"note: Maker project was pushed successfully, but remote build failed.",
|
|
31441
|
-
"",
|
|
31442
|
-
...formatMakerBuildFailureLines(result.buildFailure)
|
|
31443
|
-
].join("\n");
|
|
31444
|
-
}
|
|
31445
|
-
if (!submitResult.failure) {
|
|
31446
|
-
return [
|
|
31447
|
-
...lines,
|
|
31448
|
-
"",
|
|
31449
|
-
submitResult.pushed ? "note: This is an internal contract error: pushed=true requires remote_build or build_failure." : "note: Maker build was not started because no push was performed."
|
|
31450
|
-
].join("\n");
|
|
31451
|
-
}
|
|
31452
|
-
return [
|
|
31453
|
-
...lines,
|
|
31454
|
-
"",
|
|
31455
|
-
...formatPushRecoveryLines(submitResult),
|
|
31456
|
-
"",
|
|
31457
|
-
...formatMakerFailureLines(submitResult.failure)
|
|
31458
|
-
].filter(Boolean).join("\n");
|
|
31459
|
-
}
|
|
31460
31124
|
function formatPushRecoveryLines(submitResult) {
|
|
31461
31125
|
if (submitResult.pushed || submitResult.status !== "failed_after_commit") {
|
|
31462
31126
|
return [];
|
|
@@ -31466,9 +31130,7 @@ function formatPushRecoveryLines(submitResult) {
|
|
|
31466
31130
|
"- committed_but_unpushed: yes",
|
|
31467
31131
|
submitResult.commitHash ? `- local_commit: ${submitResult.commitHash}` : "",
|
|
31468
31132
|
submitResult.ahead ? `- git_state: ${submitResult.ahead}` : "",
|
|
31469
|
-
"- retry_tool:
|
|
31470
|
-
"- retry_build_tool: maker_build_current_directory",
|
|
31471
|
-
"- retry_build_args: submit_local_changes_before_build=true",
|
|
31133
|
+
"- retry_tool: maker_build_current_directory",
|
|
31472
31134
|
"- do_not_use_generic_git_push: yes",
|
|
31473
31135
|
"- user_message: 本地提交已经保留,但还没推送到 Maker 远端;直接重试 Maker 提交/构建工具即可。"
|
|
31474
31136
|
].filter(Boolean);
|
|
@@ -31487,6 +31149,9 @@ function formatMakerFailureLines(failure) {
|
|
|
31487
31149
|
"failure:",
|
|
31488
31150
|
`- stage: ${failure.stage}`,
|
|
31489
31151
|
`- classification: ${failure.classification}`,
|
|
31152
|
+
`- retryable: ${failure.retryable ? "yes" : "no"}`,
|
|
31153
|
+
failure.retryReason ? `- retry_reason: ${failure.retryReason}` : "",
|
|
31154
|
+
failure.retryAttempts ? `- retry_attempts: ${failure.retryAttempts}` : "",
|
|
31490
31155
|
`- exit_code: ${failure.exitCode ?? "(none)"}`,
|
|
31491
31156
|
failure.command ? `- command: ${failure.command}` : "",
|
|
31492
31157
|
failure.stderr ? `- stderr:
|
|
@@ -31539,13 +31204,758 @@ function formatToolException(toolName, error2) {
|
|
|
31539
31204
|
"debug:",
|
|
31540
31205
|
stack ? indent(stack) : indent(message),
|
|
31541
31206
|
"",
|
|
31542
|
-
"next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试
|
|
31207
|
+
"next_action: 请把上面的完整错误反馈给开发者;如果本地已有 commit 但 push 未完成,不要重复 commit,直接重试 maker_build_current_directory。"
|
|
31543
31208
|
].join("\n");
|
|
31544
31209
|
}
|
|
31545
31210
|
function indent(value) {
|
|
31546
31211
|
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
31547
31212
|
}
|
|
31548
31213
|
|
|
31214
|
+
// src/maker/cli/commands.ts
|
|
31215
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
31216
|
+
import crypto from "node:crypto";
|
|
31217
|
+
import fs7 from "node:fs";
|
|
31218
|
+
import os4 from "node:os";
|
|
31219
|
+
import path8 from "node:path";
|
|
31220
|
+
import readline from "node:readline/promises";
|
|
31221
|
+
import { stdin as input, stdout as output } from "node:process";
|
|
31222
|
+
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
31223
|
+
var DEFAULT_PACKAGE = "@taptap/instant-games-open-mcp";
|
|
31224
|
+
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit"]);
|
|
31225
|
+
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
31226
|
+
"json",
|
|
31227
|
+
"skip_confirm",
|
|
31228
|
+
"skip_mcp_install",
|
|
31229
|
+
"pat_stdin",
|
|
31230
|
+
"pat_from_stdin",
|
|
31231
|
+
"h",
|
|
31232
|
+
"help"
|
|
31233
|
+
]);
|
|
31234
|
+
var PAT_ARG_WARNING = "Warning: passing Maker PAT via command-line arguments exposes it via ps/shell history; prefer the interactive prompt or --pat-stdin.\n";
|
|
31235
|
+
async function runMakerCli(argv) {
|
|
31236
|
+
const parsed = parseArgs(argv);
|
|
31237
|
+
const ctx = { json: Boolean(parsed.options.json) };
|
|
31238
|
+
const [command, subcommand] = parsed.command;
|
|
31239
|
+
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
31240
|
+
printHelp();
|
|
31241
|
+
return;
|
|
31242
|
+
}
|
|
31243
|
+
if (command === "init") {
|
|
31244
|
+
await runInit(parsed, ctx);
|
|
31245
|
+
return;
|
|
31246
|
+
}
|
|
31247
|
+
if (command === "doctor") {
|
|
31248
|
+
await runDoctor(parsed, ctx);
|
|
31249
|
+
return;
|
|
31250
|
+
}
|
|
31251
|
+
if (command === "apps") {
|
|
31252
|
+
await runApps(parsed, ctx);
|
|
31253
|
+
return;
|
|
31254
|
+
}
|
|
31255
|
+
if (command === "pat" && subcommand === "set") {
|
|
31256
|
+
await runPatSet(parsed, ctx);
|
|
31257
|
+
return;
|
|
31258
|
+
}
|
|
31259
|
+
if (command === "mcp" && subcommand === "install") {
|
|
31260
|
+
await runMcpInstall(parsed, ctx);
|
|
31261
|
+
return;
|
|
31262
|
+
}
|
|
31263
|
+
if (command === "mcp" && subcommand === "verify") {
|
|
31264
|
+
await runMcpVerify(parsed, ctx);
|
|
31265
|
+
return;
|
|
31266
|
+
}
|
|
31267
|
+
if (command === "dev-kit" && subcommand === "update") {
|
|
31268
|
+
await runDevKitUpdate(parsed, ctx);
|
|
31269
|
+
return;
|
|
31270
|
+
}
|
|
31271
|
+
throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
|
|
31272
|
+
}
|
|
31273
|
+
function parseArgs(argv) {
|
|
31274
|
+
const command = [];
|
|
31275
|
+
const positionals = [];
|
|
31276
|
+
const options = {};
|
|
31277
|
+
for (let index = 0; index < argv.length; index += 1) {
|
|
31278
|
+
const arg = argv[index];
|
|
31279
|
+
if (arg.startsWith("--")) {
|
|
31280
|
+
const equalIndex = arg.indexOf("=");
|
|
31281
|
+
if (equalIndex > 0) {
|
|
31282
|
+
options[toOptionKey(arg.slice(2, equalIndex))] = arg.slice(equalIndex + 1);
|
|
31283
|
+
continue;
|
|
31284
|
+
}
|
|
31285
|
+
const key = toOptionKey(arg.slice(2));
|
|
31286
|
+
if (BOOLEAN_OPTIONS.has(key)) {
|
|
31287
|
+
options[key] = true;
|
|
31288
|
+
continue;
|
|
31289
|
+
}
|
|
31290
|
+
const next = argv[index + 1];
|
|
31291
|
+
if (next && !next.startsWith("-")) {
|
|
31292
|
+
options[key] = next;
|
|
31293
|
+
index += 1;
|
|
31294
|
+
} else {
|
|
31295
|
+
options[key] = true;
|
|
31296
|
+
}
|
|
31297
|
+
continue;
|
|
31298
|
+
}
|
|
31299
|
+
if (arg.startsWith("-") && arg.length > 1) {
|
|
31300
|
+
options[arg.slice(1)] = true;
|
|
31301
|
+
continue;
|
|
31302
|
+
}
|
|
31303
|
+
if (command.length === 0) {
|
|
31304
|
+
command.push(arg);
|
|
31305
|
+
continue;
|
|
31306
|
+
}
|
|
31307
|
+
if (command.length === 1 && TWO_PART_COMMANDS.has(command[0])) {
|
|
31308
|
+
command.push(arg);
|
|
31309
|
+
} else {
|
|
31310
|
+
positionals.push(arg);
|
|
31311
|
+
}
|
|
31312
|
+
}
|
|
31313
|
+
return { command, options, positionals };
|
|
31314
|
+
}
|
|
31315
|
+
function toOptionKey(value) {
|
|
31316
|
+
return value.replace(/-/g, "_");
|
|
31317
|
+
}
|
|
31318
|
+
async function runInit(parsed, ctx) {
|
|
31319
|
+
const targetDir = path8.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
31320
|
+
const env = makerEnvOption(parsed);
|
|
31321
|
+
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
31322
|
+
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
31323
|
+
const pkg = stringOption(parsed, "package") || DEFAULT_PACKAGE;
|
|
31324
|
+
emit(ctx, "init_start", "TapTap Maker local initialization started", {
|
|
31325
|
+
target_dir: targetDir,
|
|
31326
|
+
env
|
|
31327
|
+
});
|
|
31328
|
+
saveInitState(targetDir, {
|
|
31329
|
+
status: "started",
|
|
31330
|
+
target_dir: targetDir,
|
|
31331
|
+
env
|
|
31332
|
+
});
|
|
31333
|
+
const git = ensureGitAvailable();
|
|
31334
|
+
emit(ctx, "doctor", "Git is available", { version: git.version });
|
|
31335
|
+
const pat = await resolvePat(parsed, ctx);
|
|
31336
|
+
emit(ctx, "pat", "Maker PAT ready", { saved: getPatPath() });
|
|
31337
|
+
const tapAuth = await requestTapAuthWithPat(pat);
|
|
31338
|
+
emit(ctx, "tap_auth", "TapTap token exchanged and saved", {
|
|
31339
|
+
kid: mask(tapAuth.kid),
|
|
31340
|
+
saved: getTapAuthPath()
|
|
31341
|
+
});
|
|
31342
|
+
const projects = await listMakerProjects({ pat });
|
|
31343
|
+
const selected = await resolveProjectSelection(parsed, projects, {
|
|
31344
|
+
skipConfirm
|
|
31345
|
+
});
|
|
31346
|
+
emit(ctx, "app", "Maker app selected", {
|
|
31347
|
+
app_id: selected.id,
|
|
31348
|
+
name: selected.name,
|
|
31349
|
+
user_id: selected.user_id
|
|
31350
|
+
});
|
|
31351
|
+
saveInitState(targetDir, {
|
|
31352
|
+
status: "app_selected",
|
|
31353
|
+
target_dir: targetDir,
|
|
31354
|
+
env,
|
|
31355
|
+
selected_app_id: selected.id
|
|
31356
|
+
});
|
|
31357
|
+
await prepareDevKit(targetDir, ctx);
|
|
31358
|
+
const cloneResult = await cloneMakerProject({
|
|
31359
|
+
appId: selected.id,
|
|
31360
|
+
targetDir,
|
|
31361
|
+
pat,
|
|
31362
|
+
userId: selected.user_id,
|
|
31363
|
+
sceEndpoint: selected.sce_endpoint || process.env.SCE_MCP_URL,
|
|
31364
|
+
onProgress: (progress) => emitProgress(ctx, "clone", progress)
|
|
31365
|
+
});
|
|
31366
|
+
emit(ctx, "clone", "Maker project cloned or fetched", cloneResult);
|
|
31367
|
+
if (!skipMcpInstall) {
|
|
31368
|
+
const ides = parseIdeList(stringOption(parsed, "register_mcp") || "codex,cursor,claude");
|
|
31369
|
+
const installResults = installMcpConfigs({
|
|
31370
|
+
ides,
|
|
31371
|
+
env,
|
|
31372
|
+
pkg,
|
|
31373
|
+
mcpName: DEFAULT_MCP_NAME
|
|
31374
|
+
});
|
|
31375
|
+
for (const result of installResults) {
|
|
31376
|
+
emit(ctx, "mcp_install", result.message, result);
|
|
31377
|
+
}
|
|
31378
|
+
}
|
|
31379
|
+
saveInitState(targetDir, {
|
|
31380
|
+
status: "completed",
|
|
31381
|
+
target_dir: targetDir,
|
|
31382
|
+
env,
|
|
31383
|
+
selected_app_id: selected.id
|
|
31384
|
+
});
|
|
31385
|
+
emit(ctx, "done", "TapTap Maker initialization completed", {
|
|
31386
|
+
target_dir: targetDir,
|
|
31387
|
+
app_id: selected.id,
|
|
31388
|
+
next_step: "Restart or reload the AI client MCP session when you want MCP tools/resources to appear."
|
|
31389
|
+
});
|
|
31390
|
+
}
|
|
31391
|
+
async function runDoctor(parsed, ctx) {
|
|
31392
|
+
const targetDir = path8.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
31393
|
+
const git = checkGitEnvironment();
|
|
31394
|
+
const pat = loadPat();
|
|
31395
|
+
const tapAuth = loadTapAuth();
|
|
31396
|
+
const identify = identifyMakerProject({ cwd: targetDir });
|
|
31397
|
+
const devKit = inspectAiDevKit(identify.projectRoot || targetDir);
|
|
31398
|
+
if (ctx.json) {
|
|
31399
|
+
writeJson({
|
|
31400
|
+
git,
|
|
31401
|
+
auth: {
|
|
31402
|
+
pat: Boolean(pat),
|
|
31403
|
+
tap_auth: Boolean(tapAuth)
|
|
31404
|
+
},
|
|
31405
|
+
project: identify,
|
|
31406
|
+
dev_kit: devKit
|
|
31407
|
+
});
|
|
31408
|
+
return;
|
|
31409
|
+
}
|
|
31410
|
+
process.stdout.write(
|
|
31411
|
+
[
|
|
31412
|
+
"TapTap Maker doctor",
|
|
31413
|
+
"",
|
|
31414
|
+
"Git",
|
|
31415
|
+
formatGitEnvironmentStatus(git),
|
|
31416
|
+
"",
|
|
31417
|
+
"Auth",
|
|
31418
|
+
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
31419
|
+
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
31420
|
+
pat ? "" : `- pat_page: ${getMakerPatTokensUrl(makerEnvOption(parsed))}`,
|
|
31421
|
+
"",
|
|
31422
|
+
"Project",
|
|
31423
|
+
`- target_dir: ${targetDir}`,
|
|
31424
|
+
`- project_id: ${identify.projectId || "(none)"}`,
|
|
31425
|
+
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
31426
|
+
"",
|
|
31427
|
+
"AI dev kit",
|
|
31428
|
+
`- ready: ${devKit.ready ? "yes" : "no"}`,
|
|
31429
|
+
`- missing_entries: ${devKit.missingEntries.join(", ") || "(none)"}`,
|
|
31430
|
+
"",
|
|
31431
|
+
formatMakerSkillStatus({ projectRoot: identify.projectRoot || targetDir }),
|
|
31432
|
+
""
|
|
31433
|
+
].filter(Boolean).join("\n")
|
|
31434
|
+
);
|
|
31435
|
+
}
|
|
31436
|
+
async function runApps(parsed, ctx) {
|
|
31437
|
+
const pat = stringOption(parsed, "pat");
|
|
31438
|
+
if (pat) {
|
|
31439
|
+
warnPatArgExposure();
|
|
31440
|
+
}
|
|
31441
|
+
const projects = await listMakerProjects({ pat });
|
|
31442
|
+
if (ctx.json) {
|
|
31443
|
+
writeJson(projects);
|
|
31444
|
+
return;
|
|
31445
|
+
}
|
|
31446
|
+
process.stdout.write(`${formatProjectList2(projects)}
|
|
31447
|
+
`);
|
|
31448
|
+
}
|
|
31449
|
+
async function runPatSet(parsed, ctx) {
|
|
31450
|
+
const pat = await resolvePatSet(parsed);
|
|
31451
|
+
saveManualMakerPat(pat);
|
|
31452
|
+
const tapAuth = await requestTapAuthWithPat(pat);
|
|
31453
|
+
emit(ctx, "pat", "Maker PAT and TapTap token saved", {
|
|
31454
|
+
pat_path: getPatPath(),
|
|
31455
|
+
tap_auth_path: getTapAuthPath(),
|
|
31456
|
+
kid: mask(tapAuth.kid)
|
|
31457
|
+
});
|
|
31458
|
+
}
|
|
31459
|
+
async function resolvePatSet(parsed) {
|
|
31460
|
+
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
31461
|
+
const pat = fs7.readFileSync(0, "utf8").trim();
|
|
31462
|
+
if (!pat) {
|
|
31463
|
+
throw new Error("No PAT found on stdin.");
|
|
31464
|
+
}
|
|
31465
|
+
return pat;
|
|
31466
|
+
}
|
|
31467
|
+
const fromPositional = parsed.positionals[0];
|
|
31468
|
+
const fromOption = stringOption(parsed, "pat");
|
|
31469
|
+
if (fromPositional || fromOption) {
|
|
31470
|
+
warnPatArgExposure();
|
|
31471
|
+
return fromPositional || fromOption;
|
|
31472
|
+
}
|
|
31473
|
+
return promptRequired("PAT");
|
|
31474
|
+
}
|
|
31475
|
+
async function runMcpInstall(parsed, ctx) {
|
|
31476
|
+
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
31477
|
+
const results = installMcpConfigs({
|
|
31478
|
+
ides: ides.length > 0 ? ides : ["codex", "cursor", "claude"],
|
|
31479
|
+
env: makerEnvOption(parsed),
|
|
31480
|
+
pkg: stringOption(parsed, "package") || DEFAULT_PACKAGE,
|
|
31481
|
+
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME
|
|
31482
|
+
});
|
|
31483
|
+
if (ctx.json) {
|
|
31484
|
+
writeJson(results);
|
|
31485
|
+
return;
|
|
31486
|
+
}
|
|
31487
|
+
process.stdout.write(`${results.map((result) => result.message).join("\n")}
|
|
31488
|
+
`);
|
|
31489
|
+
}
|
|
31490
|
+
async function runMcpVerify(parsed, ctx) {
|
|
31491
|
+
var _a2;
|
|
31492
|
+
const mode = mcpVerifyModeOption(parsed);
|
|
31493
|
+
const pkg = stringOption(parsed, "package") || DEFAULT_PACKAGE;
|
|
31494
|
+
const command = mode === "npx" ? getNpxCliCommand(pkg) : getCurrentCliCommand();
|
|
31495
|
+
const result = spawnSync4(command.command, [...command.args, "help"], {
|
|
31496
|
+
encoding: "utf8"
|
|
31497
|
+
});
|
|
31498
|
+
const payload = {
|
|
31499
|
+
mode,
|
|
31500
|
+
package: mode === "npx" ? pkg : void 0,
|
|
31501
|
+
command: formatShellCommand([command.command, ...command.args, "help"]),
|
|
31502
|
+
status: result.status,
|
|
31503
|
+
ok: result.status === 0,
|
|
31504
|
+
stdout: result.stdout,
|
|
31505
|
+
stderr: result.stderr,
|
|
31506
|
+
error: (_a2 = result.error) == null ? void 0 : _a2.message
|
|
31507
|
+
};
|
|
31508
|
+
if (ctx.json) {
|
|
31509
|
+
writeJson(payload);
|
|
31510
|
+
return;
|
|
31511
|
+
}
|
|
31512
|
+
process.stdout.write(
|
|
31513
|
+
[
|
|
31514
|
+
payload.ok ? "✓ MCP config command can spawn taptap-maker" : "✗ MCP config command spawn failed",
|
|
31515
|
+
`- mode: ${payload.mode}`,
|
|
31516
|
+
`- command: ${payload.command}`,
|
|
31517
|
+
mode === "npx" ? "- scope: verifies the npx command written by taptap-maker mcp install" : "- scope: verifies only the currently running CLI binary",
|
|
31518
|
+
`- status: ${payload.status}`,
|
|
31519
|
+
payload.error ? `- error: ${payload.error}` : "",
|
|
31520
|
+
payload.stderr ? `- stderr:
|
|
31521
|
+
${indent2(payload.stderr)}` : "",
|
|
31522
|
+
""
|
|
31523
|
+
].filter(Boolean).join("\n")
|
|
31524
|
+
);
|
|
31525
|
+
}
|
|
31526
|
+
async function runDevKitUpdate(parsed, ctx) {
|
|
31527
|
+
const targetDir = path8.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
31528
|
+
const result = await installAiDevKit({
|
|
31529
|
+
targetDir,
|
|
31530
|
+
preserveExisting: true
|
|
31531
|
+
});
|
|
31532
|
+
finalizeStagedDevKitGitignore(targetDir);
|
|
31533
|
+
emit(ctx, "dev_kit", "AI dev kit updated", result);
|
|
31534
|
+
}
|
|
31535
|
+
async function resolvePat(parsed, ctx) {
|
|
31536
|
+
const fromArgs = stringOption(parsed, "pat");
|
|
31537
|
+
if (fromArgs) {
|
|
31538
|
+
warnPatArgExposure();
|
|
31539
|
+
saveManualMakerPat(fromArgs);
|
|
31540
|
+
return fromArgs;
|
|
31541
|
+
}
|
|
31542
|
+
const cached2 = loadPat();
|
|
31543
|
+
if (cached2 == null ? void 0 : cached2.token) {
|
|
31544
|
+
return cached2.token;
|
|
31545
|
+
}
|
|
31546
|
+
if (booleanOption(parsed, "skip_confirm")) {
|
|
31547
|
+
throw new Error(
|
|
31548
|
+
`Maker PAT missing. Create one at ${getMakerPatTokensUrl(makerEnvOption(parsed))}`
|
|
31549
|
+
);
|
|
31550
|
+
}
|
|
31551
|
+
emit(ctx, "pat_required", "Maker PAT is required", {
|
|
31552
|
+
pat_page: getMakerPatTokensUrl(makerEnvOption(parsed))
|
|
31553
|
+
});
|
|
31554
|
+
const pat = await promptRequired("Paste Maker PAT");
|
|
31555
|
+
saveManualMakerPat(pat);
|
|
31556
|
+
return pat;
|
|
31557
|
+
}
|
|
31558
|
+
async function resolveProjectSelection(parsed, projects, options) {
|
|
31559
|
+
const appId = stringOption(parsed, "app_id") || parsed.positionals[0];
|
|
31560
|
+
if (appId) {
|
|
31561
|
+
return projects.find((project) => project.id === appId) || { id: appId };
|
|
31562
|
+
}
|
|
31563
|
+
if (projects.length === 0) {
|
|
31564
|
+
throw new Error("No Maker apps found for this PAT.");
|
|
31565
|
+
}
|
|
31566
|
+
if (options.skipConfirm) {
|
|
31567
|
+
throw new Error("Missing --app-id in non-interactive init mode.");
|
|
31568
|
+
}
|
|
31569
|
+
process.stdout.write(`${formatProjectList2(projects)}
|
|
31570
|
+
`);
|
|
31571
|
+
const answer = await promptRequired("Choose app by index or app_id");
|
|
31572
|
+
const byIndex = Number(answer);
|
|
31573
|
+
if (Number.isInteger(byIndex) && byIndex >= 1 && byIndex <= projects.length) {
|
|
31574
|
+
return projects[byIndex - 1];
|
|
31575
|
+
}
|
|
31576
|
+
const selected = projects.find((project) => project.id === answer.trim());
|
|
31577
|
+
if (!selected) {
|
|
31578
|
+
throw new Error(`Unknown Maker app selection: ${answer}`);
|
|
31579
|
+
}
|
|
31580
|
+
return selected;
|
|
31581
|
+
}
|
|
31582
|
+
async function prepareDevKit(targetDir, ctx) {
|
|
31583
|
+
const before = inspectAiDevKit(targetDir);
|
|
31584
|
+
if (before.ready) {
|
|
31585
|
+
writeDevKitStagedGitignore(
|
|
31586
|
+
path8.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
31587
|
+
listPresentDevKitManagedEntries(targetDir)
|
|
31588
|
+
);
|
|
31589
|
+
emit(ctx, "dev_kit", "AI dev kit already present", before);
|
|
31590
|
+
return;
|
|
31591
|
+
}
|
|
31592
|
+
try {
|
|
31593
|
+
const result = await installAiDevKit({ targetDir });
|
|
31594
|
+
emit(ctx, "dev_kit", "AI dev kit prepared", result);
|
|
31595
|
+
} catch (error2) {
|
|
31596
|
+
emit(ctx, "dev_kit_warning", "AI dev kit preparation failed; clone will continue", {
|
|
31597
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
31598
|
+
});
|
|
31599
|
+
}
|
|
31600
|
+
}
|
|
31601
|
+
function installMcpConfigs(options) {
|
|
31602
|
+
return options.ides.map((ide) => installMcpConfig(ide, options));
|
|
31603
|
+
}
|
|
31604
|
+
function installMcpConfig(ide, options) {
|
|
31605
|
+
try {
|
|
31606
|
+
return installMcpConfigUnsafe(ide, options);
|
|
31607
|
+
} catch (error2) {
|
|
31608
|
+
return {
|
|
31609
|
+
ide,
|
|
31610
|
+
ok: false,
|
|
31611
|
+
message: `✗ ${ide} MCP config update failed: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
31612
|
+
};
|
|
31613
|
+
}
|
|
31614
|
+
}
|
|
31615
|
+
function installMcpConfigUnsafe(ide, options) {
|
|
31616
|
+
if (ide === "codex") {
|
|
31617
|
+
const configPath = path8.join(os4.homedir(), ".codex", "config.toml");
|
|
31618
|
+
mergeCodexMcpConfig(configPath, options);
|
|
31619
|
+
return {
|
|
31620
|
+
ide,
|
|
31621
|
+
ok: true,
|
|
31622
|
+
path: configPath,
|
|
31623
|
+
message: `✓ Codex MCP config updated: ${configPath}`
|
|
31624
|
+
};
|
|
31625
|
+
}
|
|
31626
|
+
if (ide === "cursor") {
|
|
31627
|
+
const configPath = path8.join(os4.homedir(), ".cursor", "mcp.json");
|
|
31628
|
+
mergeJsonMcpConfig(configPath, options);
|
|
31629
|
+
return {
|
|
31630
|
+
ide,
|
|
31631
|
+
ok: true,
|
|
31632
|
+
path: configPath,
|
|
31633
|
+
message: `✓ Cursor MCP config updated: ${configPath}`
|
|
31634
|
+
};
|
|
31635
|
+
}
|
|
31636
|
+
if (ide === "claude") {
|
|
31637
|
+
const claudeResult = tryClaudeMcpAdd(options);
|
|
31638
|
+
if (claudeResult.ok) {
|
|
31639
|
+
return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
|
|
31640
|
+
}
|
|
31641
|
+
const configPath = path8.join(os4.homedir(), ".claude.json");
|
|
31642
|
+
mergeJsonMcpConfig(configPath, options);
|
|
31643
|
+
return {
|
|
31644
|
+
ide,
|
|
31645
|
+
ok: true,
|
|
31646
|
+
path: configPath,
|
|
31647
|
+
message: `✓ Claude fallback MCP config updated: ${configPath}`
|
|
31648
|
+
};
|
|
31649
|
+
}
|
|
31650
|
+
return { ide, ok: false, message: `Skipped unknown IDE: ${ide}` };
|
|
31651
|
+
}
|
|
31652
|
+
function mergeJsonMcpConfig(configPath, options) {
|
|
31653
|
+
backupIfExists(configPath);
|
|
31654
|
+
const existing = readJsonObject(configPath);
|
|
31655
|
+
const mcpServers = asObject(existing.mcpServers);
|
|
31656
|
+
mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
|
|
31657
|
+
existing.mcpServers = mcpServers;
|
|
31658
|
+
fs7.mkdirSync(path8.dirname(configPath), { recursive: true });
|
|
31659
|
+
fs7.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
|
|
31660
|
+
`, "utf8");
|
|
31661
|
+
}
|
|
31662
|
+
function mergeCodexMcpConfig(configPath, options) {
|
|
31663
|
+
backupIfExists(configPath);
|
|
31664
|
+
const existing = fs7.existsSync(configPath) ? fs7.readFileSync(configPath, "utf8") : "";
|
|
31665
|
+
const sectionPattern = new RegExp(
|
|
31666
|
+
`\\n?\\[mcp_servers\\."${escapeRegExp2(options.mcpName)}"(?:\\.[^\\]]+)?\\][\\s\\S]*?(?=\\n\\[(?!mcp_servers\\."${escapeRegExp2(options.mcpName)}"(?:\\.|\\]))|$)`,
|
|
31667
|
+
"g"
|
|
31668
|
+
);
|
|
31669
|
+
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
31670
|
+
const command = getNpxCommand();
|
|
31671
|
+
const section = [
|
|
31672
|
+
`[mcp_servers."${options.mcpName}"]`,
|
|
31673
|
+
`command = "${escapeToml(command)}"`,
|
|
31674
|
+
`args = ["-y", "-p", "${escapeToml(options.pkg)}", "taptap-maker"]`,
|
|
31675
|
+
"",
|
|
31676
|
+
`[mcp_servers."${options.mcpName}".env]`,
|
|
31677
|
+
`TAPTAP_MCP_ENV = "${options.env}"`,
|
|
31678
|
+
""
|
|
31679
|
+
].join("\n");
|
|
31680
|
+
fs7.mkdirSync(path8.dirname(configPath), { recursive: true });
|
|
31681
|
+
fs7.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
|
|
31682
|
+
}
|
|
31683
|
+
function tryClaudeMcpAdd(options) {
|
|
31684
|
+
const command = process.platform === "win32" ? "claude.cmd" : "claude";
|
|
31685
|
+
const result = spawnSync4(
|
|
31686
|
+
command,
|
|
31687
|
+
[
|
|
31688
|
+
"mcp",
|
|
31689
|
+
"add",
|
|
31690
|
+
"--scope",
|
|
31691
|
+
"user",
|
|
31692
|
+
"--transport",
|
|
31693
|
+
"stdio",
|
|
31694
|
+
"--env",
|
|
31695
|
+
`TAPTAP_MCP_ENV=${options.env}`,
|
|
31696
|
+
options.mcpName,
|
|
31697
|
+
"--",
|
|
31698
|
+
getNpxCommand(),
|
|
31699
|
+
"-y",
|
|
31700
|
+
"-p",
|
|
31701
|
+
options.pkg,
|
|
31702
|
+
"taptap-maker"
|
|
31703
|
+
],
|
|
31704
|
+
{ encoding: "utf8" }
|
|
31705
|
+
);
|
|
31706
|
+
return { ok: result.status === 0 };
|
|
31707
|
+
}
|
|
31708
|
+
function createJsonMcpServerConfig(options) {
|
|
31709
|
+
return {
|
|
31710
|
+
command: getNpxCommand(),
|
|
31711
|
+
args: ["-y", "-p", options.pkg, "taptap-maker"],
|
|
31712
|
+
env: {
|
|
31713
|
+
TAPTAP_MCP_ENV: options.env
|
|
31714
|
+
}
|
|
31715
|
+
};
|
|
31716
|
+
}
|
|
31717
|
+
function getCurrentCliCommand() {
|
|
31718
|
+
if (process.argv[1]) {
|
|
31719
|
+
return { command: process.execPath, args: [process.argv[1]] };
|
|
31720
|
+
}
|
|
31721
|
+
return { command: process.platform === "win32" ? "taptap-maker.cmd" : "taptap-maker", args: [] };
|
|
31722
|
+
}
|
|
31723
|
+
function getNpxCliCommand(pkg) {
|
|
31724
|
+
return { command: getNpxCommand(), args: ["-y", "-p", pkg, "taptap-maker"] };
|
|
31725
|
+
}
|
|
31726
|
+
function getNpxCommand() {
|
|
31727
|
+
return process.platform === "win32" ? "npx.cmd" : "npx";
|
|
31728
|
+
}
|
|
31729
|
+
function readJsonObject(filePath) {
|
|
31730
|
+
if (!fs7.existsSync(filePath)) {
|
|
31731
|
+
return {};
|
|
31732
|
+
}
|
|
31733
|
+
return JSON.parse(fs7.readFileSync(filePath, "utf8"));
|
|
31734
|
+
}
|
|
31735
|
+
function asObject(value) {
|
|
31736
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
31737
|
+
return value;
|
|
31738
|
+
}
|
|
31739
|
+
return {};
|
|
31740
|
+
}
|
|
31741
|
+
function backupIfExists(filePath) {
|
|
31742
|
+
if (!fs7.existsSync(filePath)) {
|
|
31743
|
+
return;
|
|
31744
|
+
}
|
|
31745
|
+
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
|
|
31746
|
+
fs7.copyFileSync(filePath, `${filePath}.bak.${stamp}`);
|
|
31747
|
+
}
|
|
31748
|
+
function saveInitState(targetDir, state) {
|
|
31749
|
+
fs7.mkdirSync(getMakerHome(), { recursive: true });
|
|
31750
|
+
const key = crypto.createHash("sha256").update(path8.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
31751
|
+
fs7.writeFileSync(
|
|
31752
|
+
path8.join(getMakerHome(), `init-state-${key}.json`),
|
|
31753
|
+
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
31754
|
+
`,
|
|
31755
|
+
"utf8"
|
|
31756
|
+
);
|
|
31757
|
+
}
|
|
31758
|
+
function formatProjectList2(projects) {
|
|
31759
|
+
if (projects.length === 0) {
|
|
31760
|
+
return "No Maker apps found.";
|
|
31761
|
+
}
|
|
31762
|
+
return [
|
|
31763
|
+
`Maker apps (${projects.length})`,
|
|
31764
|
+
"",
|
|
31765
|
+
...projects.map(
|
|
31766
|
+
(project, index) => `${index + 1}. ${project.id}${project.name ? ` ${project.name}` : ""}${project.user_id ? ` user_id=${project.user_id}` : ""}${project.gameType ? ` gameType=${project.gameType}` : ""}${project.stage ? ` stage=${project.stage}` : ""}${project.lastConversationAt ? ` lastConversationAt=${project.lastConversationAt}` : ""}`
|
|
31767
|
+
)
|
|
31768
|
+
].join("\n");
|
|
31769
|
+
}
|
|
31770
|
+
function emit(ctx, step, message, data) {
|
|
31771
|
+
if (ctx.json) {
|
|
31772
|
+
writeJson({ step, status: "ok", message, data });
|
|
31773
|
+
return;
|
|
31774
|
+
}
|
|
31775
|
+
process.stdout.write(`${message}
|
|
31776
|
+
`);
|
|
31777
|
+
}
|
|
31778
|
+
function emitProgress(ctx, step, progress) {
|
|
31779
|
+
if (ctx.json) {
|
|
31780
|
+
writeJson({ step, status: "progress", progress });
|
|
31781
|
+
return;
|
|
31782
|
+
}
|
|
31783
|
+
process.stdout.write(`- ${progress.phase || step}: ${progress.message}
|
|
31784
|
+
`);
|
|
31785
|
+
}
|
|
31786
|
+
function writeJson(value) {
|
|
31787
|
+
process.stdout.write(`${JSON.stringify(value)}
|
|
31788
|
+
`);
|
|
31789
|
+
}
|
|
31790
|
+
async function promptRequired(label) {
|
|
31791
|
+
if (!process.stdin.isTTY) {
|
|
31792
|
+
throw new Error(`${label} is required in non-interactive mode.`);
|
|
31793
|
+
}
|
|
31794
|
+
const rl = readline.createInterface({ input, output });
|
|
31795
|
+
try {
|
|
31796
|
+
const answer = await rl.question(`${label}: `);
|
|
31797
|
+
if (!answer.trim()) {
|
|
31798
|
+
throw new Error(`${label} cannot be empty.`);
|
|
31799
|
+
}
|
|
31800
|
+
return answer.trim();
|
|
31801
|
+
} finally {
|
|
31802
|
+
rl.close();
|
|
31803
|
+
}
|
|
31804
|
+
}
|
|
31805
|
+
function warnPatArgExposure() {
|
|
31806
|
+
process.stderr.write(PAT_ARG_WARNING);
|
|
31807
|
+
}
|
|
31808
|
+
function formatUnknownCommand(command) {
|
|
31809
|
+
if (command.length === 0) {
|
|
31810
|
+
return "(empty)";
|
|
31811
|
+
}
|
|
31812
|
+
const [primary, secondary] = command;
|
|
31813
|
+
if (!secondary) {
|
|
31814
|
+
return primary;
|
|
31815
|
+
}
|
|
31816
|
+
return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
|
|
31817
|
+
}
|
|
31818
|
+
function isKnownSubcommand(command, subcommand) {
|
|
31819
|
+
return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "dev-kit" && subcommand === "update";
|
|
31820
|
+
}
|
|
31821
|
+
function stringOption(parsed, key) {
|
|
31822
|
+
const value = parsed.options[key];
|
|
31823
|
+
return typeof value === "string" ? value : void 0;
|
|
31824
|
+
}
|
|
31825
|
+
function booleanOption(parsed, key) {
|
|
31826
|
+
return parsed.options[key] === true || parsed.options[key] === "true";
|
|
31827
|
+
}
|
|
31828
|
+
function makerEnvOption(parsed) {
|
|
31829
|
+
const env = stringOption(parsed, "env");
|
|
31830
|
+
if (env === "rnd" || env === "production") {
|
|
31831
|
+
return env;
|
|
31832
|
+
}
|
|
31833
|
+
return getMakerEnvironment();
|
|
31834
|
+
}
|
|
31835
|
+
function mcpVerifyModeOption(parsed) {
|
|
31836
|
+
const mode = stringOption(parsed, "mode") || "npx";
|
|
31837
|
+
if (mode === "npx" || mode === "self") {
|
|
31838
|
+
return mode;
|
|
31839
|
+
}
|
|
31840
|
+
throw new Error("Invalid mcp verify --mode. Use npx or self.");
|
|
31841
|
+
}
|
|
31842
|
+
function parseIdeList(value) {
|
|
31843
|
+
return value.split(",").map((item) => item.trim().toLowerCase()).filter(Boolean);
|
|
31844
|
+
}
|
|
31845
|
+
function mask(value) {
|
|
31846
|
+
if (value.length <= 12) {
|
|
31847
|
+
return "***";
|
|
31848
|
+
}
|
|
31849
|
+
return `${value.slice(0, 6)}...${value.slice(-4)}`;
|
|
31850
|
+
}
|
|
31851
|
+
function escapeRegExp2(value) {
|
|
31852
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
31853
|
+
}
|
|
31854
|
+
function escapeToml(value) {
|
|
31855
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
31856
|
+
}
|
|
31857
|
+
function indent2(value) {
|
|
31858
|
+
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
31859
|
+
}
|
|
31860
|
+
function formatShellCommand(parts) {
|
|
31861
|
+
return parts.map((part) => /\s/.test(part) ? `"${part.replace(/(["\\$`])/g, "\\$1")}"` : part).join(" ");
|
|
31862
|
+
}
|
|
31863
|
+
function printHelp() {
|
|
31864
|
+
process.stdout.write(
|
|
31865
|
+
[
|
|
31866
|
+
"Usage:",
|
|
31867
|
+
" taptap-maker Start MCP server mode",
|
|
31868
|
+
" taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
|
|
31869
|
+
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
31870
|
+
" [--package @taptap/instant-games-open-mcp] [--json]",
|
|
31871
|
+
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
31872
|
+
" taptap-maker apps [--pat PAT] [--json] # warns: PAT appears in ps/history",
|
|
31873
|
+
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
31874
|
+
" taptap-maker pat set [PAT|--pat PAT] [--json] # warns: PAT appears in ps/history",
|
|
31875
|
+
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
31876
|
+
" [--package @taptap/instant-games-open-mcp] [--json]",
|
|
31877
|
+
" taptap-maker mcp verify [--package @taptap/instant-games-open-mcp]",
|
|
31878
|
+
" [--mode npx|self] [--json]",
|
|
31879
|
+
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
31880
|
+
"",
|
|
31881
|
+
"MCP verify defaults to the npx command written into AI client config.",
|
|
31882
|
+
"",
|
|
31883
|
+
"Windows note:",
|
|
31884
|
+
" Generated MCP configs use npx.cmd automatically on Windows.",
|
|
31885
|
+
""
|
|
31886
|
+
].join("\n")
|
|
31887
|
+
);
|
|
31888
|
+
}
|
|
31889
|
+
function formatCliError(error2) {
|
|
31890
|
+
if (error2 instanceof MakerGitNotFoundError) {
|
|
31891
|
+
return error2.message;
|
|
31892
|
+
}
|
|
31893
|
+
return error2 instanceof Error ? error2.message : String(error2);
|
|
31894
|
+
}
|
|
31895
|
+
|
|
31896
|
+
// src/maker/crashLog.ts
|
|
31897
|
+
import fs8 from "node:fs";
|
|
31898
|
+
import path9 from "node:path";
|
|
31899
|
+
var DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
31900
|
+
var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
|
|
31901
|
+
function appendMakerCrashLog(source, error2, options = {}) {
|
|
31902
|
+
const makerHome = getMakerHome();
|
|
31903
|
+
fs8.mkdirSync(makerHome, { recursive: true });
|
|
31904
|
+
const logPath = path9.join(makerHome, "mcp-crash.log");
|
|
31905
|
+
const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
|
|
31906
|
+
const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
|
|
31907
|
+
const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
|
|
31908
|
+
const entry = truncateUtf8(
|
|
31909
|
+
[`[${(/* @__PURE__ */ new Date()).toISOString()}] ${source}`, message, ""].join("\n"),
|
|
31910
|
+
Math.min(maxEntryBytes, maxBytes)
|
|
31911
|
+
);
|
|
31912
|
+
const entryBytes = Buffer.byteLength(entry, "utf8");
|
|
31913
|
+
rotateIfNeeded(logPath, maxBytes, entryBytes);
|
|
31914
|
+
fs8.appendFileSync(logPath, entry, "utf8");
|
|
31915
|
+
}
|
|
31916
|
+
function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
|
|
31917
|
+
if (!fs8.existsSync(logPath)) {
|
|
31918
|
+
return;
|
|
31919
|
+
}
|
|
31920
|
+
const currentBytes = fs8.statSync(logPath).size;
|
|
31921
|
+
if (currentBytes + incomingBytes <= maxBytes) {
|
|
31922
|
+
return;
|
|
31923
|
+
}
|
|
31924
|
+
const rotatedPath = `${logPath}.1`;
|
|
31925
|
+
writeFileTail(logPath, rotatedPath, maxBytes);
|
|
31926
|
+
fs8.writeFileSync(logPath, "", "utf8");
|
|
31927
|
+
}
|
|
31928
|
+
function writeFileTail(sourcePath, targetPath, maxBytes) {
|
|
31929
|
+
const size = fs8.statSync(sourcePath).size;
|
|
31930
|
+
const bytesToRead = Math.min(size, maxBytes);
|
|
31931
|
+
const start = Math.max(0, size - bytesToRead);
|
|
31932
|
+
const fd = fs8.openSync(sourcePath, "r");
|
|
31933
|
+
try {
|
|
31934
|
+
const buffer = Buffer.alloc(bytesToRead);
|
|
31935
|
+
fs8.readSync(fd, buffer, 0, bytesToRead, start);
|
|
31936
|
+
fs8.writeFileSync(targetPath, buffer);
|
|
31937
|
+
} finally {
|
|
31938
|
+
fs8.closeSync(fd);
|
|
31939
|
+
}
|
|
31940
|
+
}
|
|
31941
|
+
function truncateUtf8(value, maxBytes) {
|
|
31942
|
+
if (Buffer.byteLength(value, "utf8") <= maxBytes) {
|
|
31943
|
+
return value;
|
|
31944
|
+
}
|
|
31945
|
+
const suffix = `
|
|
31946
|
+
[truncated to ${maxBytes} bytes]
|
|
31947
|
+
`;
|
|
31948
|
+
const suffixBytes = Buffer.byteLength(suffix, "utf8");
|
|
31949
|
+
const prefixBytes = Math.max(0, maxBytes - suffixBytes);
|
|
31950
|
+
return `${Buffer.from(value, "utf8").subarray(0, prefixBytes).toString("utf8")}${suffix}`;
|
|
31951
|
+
}
|
|
31952
|
+
function resolveEnvBytes(key, fallback) {
|
|
31953
|
+
return positiveInteger(Number(process.env[key])) || fallback;
|
|
31954
|
+
}
|
|
31955
|
+
function positiveInteger(value) {
|
|
31956
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0 ? Math.floor(value) : void 0;
|
|
31957
|
+
}
|
|
31958
|
+
|
|
31549
31959
|
// src/maker/index.ts
|
|
31550
31960
|
installCrashLogging();
|
|
31551
31961
|
async function main() {
|
|
@@ -31555,33 +31965,40 @@ async function main() {
|
|
|
31555
31965
|
return;
|
|
31556
31966
|
}
|
|
31557
31967
|
if (command === "help" || command === "--help" || command === "-h") {
|
|
31558
|
-
|
|
31968
|
+
printHelp2();
|
|
31559
31969
|
return;
|
|
31560
31970
|
}
|
|
31561
|
-
|
|
31562
|
-
`taptap-maker does not expose user CLI subcommands. Start it without arguments as an MCP server.`
|
|
31563
|
-
);
|
|
31971
|
+
await runMakerCli(process.argv.slice(2));
|
|
31564
31972
|
}
|
|
31565
|
-
function
|
|
31973
|
+
function printHelp2() {
|
|
31566
31974
|
process.stdout.write(
|
|
31567
31975
|
[
|
|
31568
31976
|
"Usage:",
|
|
31569
31977
|
" taptap-maker Start MCP server mode",
|
|
31978
|
+
" taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
|
|
31979
|
+
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
31980
|
+
" [--package @taptap/instant-games-open-mcp] [--json]",
|
|
31981
|
+
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
31982
|
+
" taptap-maker apps [--pat PAT] [--json]",
|
|
31983
|
+
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
31984
|
+
" taptap-maker pat set [PAT|--pat PAT] [--json] # warns: PAT appears in ps/history",
|
|
31985
|
+
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
31986
|
+
" [--package @taptap/instant-games-open-mcp] [--json]",
|
|
31987
|
+
" taptap-maker mcp verify Verify CLI spawn path",
|
|
31988
|
+
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
31570
31989
|
" taptap-maker help Show this help",
|
|
31571
31990
|
"",
|
|
31572
|
-
"
|
|
31573
|
-
"
|
|
31574
|
-
" maker_submit_current_directory, maker_build_current_directory.",
|
|
31991
|
+
"Windows note:",
|
|
31992
|
+
" Generated MCP configs use npx.cmd automatically on Windows.",
|
|
31575
31993
|
"",
|
|
31576
|
-
"
|
|
31577
|
-
"but are not the default user onboarding path.",
|
|
31994
|
+
"MCP server mode is still used by AI clients after configuration reload.",
|
|
31578
31995
|
""
|
|
31579
31996
|
].join("\n")
|
|
31580
31997
|
);
|
|
31581
31998
|
}
|
|
31582
31999
|
main().catch((error2) => {
|
|
31583
32000
|
logCrash("main.catch", error2);
|
|
31584
|
-
process.stderr.write(`❌ ${
|
|
32001
|
+
process.stderr.write(`❌ ${formatCliError(error2)}
|
|
31585
32002
|
`);
|
|
31586
32003
|
process.exit(1);
|
|
31587
32004
|
});
|
|
@@ -31601,15 +32018,7 @@ function installCrashLogging() {
|
|
|
31601
32018
|
}
|
|
31602
32019
|
function logCrash(source, error2) {
|
|
31603
32020
|
try {
|
|
31604
|
-
|
|
31605
|
-
fs7.mkdirSync(makerHome, { recursive: true });
|
|
31606
|
-
const logPath = path8.join(makerHome, "mcp-crash.log");
|
|
31607
|
-
const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
|
|
31608
|
-
fs7.appendFileSync(
|
|
31609
|
-
logPath,
|
|
31610
|
-
[`[${(/* @__PURE__ */ new Date()).toISOString()}] ${source}`, message, ""].join("\n"),
|
|
31611
|
-
"utf8"
|
|
31612
|
-
);
|
|
32021
|
+
appendMakerCrashLog(source, error2);
|
|
31613
32022
|
} catch {
|
|
31614
32023
|
}
|
|
31615
32024
|
}
|