@taptap/maker 0.0.25 → 0.0.26-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/maker.js CHANGED
@@ -13183,31 +13183,31 @@ var ZodError = class _ZodError extends Error {
13183
13183
  this.issues = issues;
13184
13184
  }
13185
13185
  format(_mapper) {
13186
- const mapper = _mapper || function(issue2) {
13187
- return issue2.message;
13186
+ const mapper = _mapper || function(issue3) {
13187
+ return issue3.message;
13188
13188
  };
13189
13189
  const fieldErrors = { _errors: [] };
13190
13190
  const processError = (error2) => {
13191
- for (const issue2 of error2.issues) {
13192
- if (issue2.code === "invalid_union") {
13193
- issue2.unionErrors.map(processError);
13194
- } else if (issue2.code === "invalid_return_type") {
13195
- processError(issue2.returnTypeError);
13196
- } else if (issue2.code === "invalid_arguments") {
13197
- processError(issue2.argumentsError);
13198
- } else if (issue2.path.length === 0) {
13199
- fieldErrors._errors.push(mapper(issue2));
13191
+ for (const issue3 of error2.issues) {
13192
+ if (issue3.code === "invalid_union") {
13193
+ issue3.unionErrors.map(processError);
13194
+ } else if (issue3.code === "invalid_return_type") {
13195
+ processError(issue3.returnTypeError);
13196
+ } else if (issue3.code === "invalid_arguments") {
13197
+ processError(issue3.argumentsError);
13198
+ } else if (issue3.path.length === 0) {
13199
+ fieldErrors._errors.push(mapper(issue3));
13200
13200
  } else {
13201
13201
  let curr = fieldErrors;
13202
13202
  let i = 0;
13203
- while (i < issue2.path.length) {
13204
- const el = issue2.path[i];
13205
- const terminal = i === issue2.path.length - 1;
13203
+ while (i < issue3.path.length) {
13204
+ const el = issue3.path[i];
13205
+ const terminal = i === issue3.path.length - 1;
13206
13206
  if (!terminal) {
13207
13207
  curr[el] = curr[el] || { _errors: [] };
13208
13208
  } else {
13209
13209
  curr[el] = curr[el] || { _errors: [] };
13210
- curr[el]._errors.push(mapper(issue2));
13210
+ curr[el]._errors.push(mapper(issue3));
13211
13211
  }
13212
13212
  curr = curr[el];
13213
13213
  i++;
@@ -13232,7 +13232,7 @@ var ZodError = class _ZodError extends Error {
13232
13232
  get isEmpty() {
13233
13233
  return this.issues.length === 0;
13234
13234
  }
13235
- flatten(mapper = (issue2) => issue2.message) {
13235
+ flatten(mapper = (issue3) => issue3.message) {
13236
13236
  const fieldErrors = /* @__PURE__ */ Object.create(null);
13237
13237
  const formErrors = [];
13238
13238
  for (const sub of this.issues) {
@@ -13256,30 +13256,30 @@ ZodError.create = (issues) => {
13256
13256
  };
13257
13257
 
13258
13258
  // node_modules/zod/v3/locales/en.js
13259
- var errorMap = (issue2, _ctx) => {
13259
+ var errorMap = (issue3, _ctx) => {
13260
13260
  let message;
13261
- switch (issue2.code) {
13261
+ switch (issue3.code) {
13262
13262
  case ZodIssueCode.invalid_type:
13263
- if (issue2.received === ZodParsedType.undefined) {
13263
+ if (issue3.received === ZodParsedType.undefined) {
13264
13264
  message = "Required";
13265
13265
  } else {
13266
- message = `Expected ${issue2.expected}, received ${issue2.received}`;
13266
+ message = `Expected ${issue3.expected}, received ${issue3.received}`;
13267
13267
  }
13268
13268
  break;
13269
13269
  case ZodIssueCode.invalid_literal:
13270
- message = `Invalid literal value, expected ${JSON.stringify(issue2.expected, util.jsonStringifyReplacer)}`;
13270
+ message = `Invalid literal value, expected ${JSON.stringify(issue3.expected, util.jsonStringifyReplacer)}`;
13271
13271
  break;
13272
13272
  case ZodIssueCode.unrecognized_keys:
13273
- message = `Unrecognized key(s) in object: ${util.joinValues(issue2.keys, ", ")}`;
13273
+ message = `Unrecognized key(s) in object: ${util.joinValues(issue3.keys, ", ")}`;
13274
13274
  break;
13275
13275
  case ZodIssueCode.invalid_union:
13276
13276
  message = `Invalid input`;
13277
13277
  break;
13278
13278
  case ZodIssueCode.invalid_union_discriminator:
13279
- message = `Invalid discriminator value. Expected ${util.joinValues(issue2.options)}`;
13279
+ message = `Invalid discriminator value. Expected ${util.joinValues(issue3.options)}`;
13280
13280
  break;
13281
13281
  case ZodIssueCode.invalid_enum_value:
13282
- message = `Invalid enum value. Expected ${util.joinValues(issue2.options)}, received '${issue2.received}'`;
13282
+ message = `Invalid enum value. Expected ${util.joinValues(issue3.options)}, received '${issue3.received}'`;
13283
13283
  break;
13284
13284
  case ZodIssueCode.invalid_arguments:
13285
13285
  message = `Invalid function arguments`;
@@ -13291,50 +13291,50 @@ var errorMap = (issue2, _ctx) => {
13291
13291
  message = `Invalid date`;
13292
13292
  break;
13293
13293
  case ZodIssueCode.invalid_string:
13294
- if (typeof issue2.validation === "object") {
13295
- if ("includes" in issue2.validation) {
13296
- message = `Invalid input: must include "${issue2.validation.includes}"`;
13297
- if (typeof issue2.validation.position === "number") {
13298
- message = `${message} at one or more positions greater than or equal to ${issue2.validation.position}`;
13294
+ if (typeof issue3.validation === "object") {
13295
+ if ("includes" in issue3.validation) {
13296
+ message = `Invalid input: must include "${issue3.validation.includes}"`;
13297
+ if (typeof issue3.validation.position === "number") {
13298
+ message = `${message} at one or more positions greater than or equal to ${issue3.validation.position}`;
13299
13299
  }
13300
- } else if ("startsWith" in issue2.validation) {
13301
- message = `Invalid input: must start with "${issue2.validation.startsWith}"`;
13302
- } else if ("endsWith" in issue2.validation) {
13303
- message = `Invalid input: must end with "${issue2.validation.endsWith}"`;
13300
+ } else if ("startsWith" in issue3.validation) {
13301
+ message = `Invalid input: must start with "${issue3.validation.startsWith}"`;
13302
+ } else if ("endsWith" in issue3.validation) {
13303
+ message = `Invalid input: must end with "${issue3.validation.endsWith}"`;
13304
13304
  } else {
13305
- util.assertNever(issue2.validation);
13305
+ util.assertNever(issue3.validation);
13306
13306
  }
13307
- } else if (issue2.validation !== "regex") {
13308
- message = `Invalid ${issue2.validation}`;
13307
+ } else if (issue3.validation !== "regex") {
13308
+ message = `Invalid ${issue3.validation}`;
13309
13309
  } else {
13310
13310
  message = "Invalid";
13311
13311
  }
13312
13312
  break;
13313
13313
  case ZodIssueCode.too_small:
13314
- if (issue2.type === "array")
13315
- message = `Array must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `more than`} ${issue2.minimum} element(s)`;
13316
- else if (issue2.type === "string")
13317
- message = `String must contain ${issue2.exact ? "exactly" : issue2.inclusive ? `at least` : `over`} ${issue2.minimum} character(s)`;
13318
- else if (issue2.type === "number")
13319
- message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`;
13320
- else if (issue2.type === "bigint")
13321
- message = `Number must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${issue2.minimum}`;
13322
- else if (issue2.type === "date")
13323
- message = `Date must be ${issue2.exact ? `exactly equal to ` : issue2.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue2.minimum))}`;
13314
+ if (issue3.type === "array")
13315
+ message = `Array must contain ${issue3.exact ? "exactly" : issue3.inclusive ? `at least` : `more than`} ${issue3.minimum} element(s)`;
13316
+ else if (issue3.type === "string")
13317
+ message = `String must contain ${issue3.exact ? "exactly" : issue3.inclusive ? `at least` : `over`} ${issue3.minimum} character(s)`;
13318
+ else if (issue3.type === "number")
13319
+ message = `Number must be ${issue3.exact ? `exactly equal to ` : issue3.inclusive ? `greater than or equal to ` : `greater than `}${issue3.minimum}`;
13320
+ else if (issue3.type === "bigint")
13321
+ message = `Number must be ${issue3.exact ? `exactly equal to ` : issue3.inclusive ? `greater than or equal to ` : `greater than `}${issue3.minimum}`;
13322
+ else if (issue3.type === "date")
13323
+ message = `Date must be ${issue3.exact ? `exactly equal to ` : issue3.inclusive ? `greater than or equal to ` : `greater than `}${new Date(Number(issue3.minimum))}`;
13324
13324
  else
13325
13325
  message = "Invalid input";
13326
13326
  break;
13327
13327
  case ZodIssueCode.too_big:
13328
- if (issue2.type === "array")
13329
- message = `Array must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `less than`} ${issue2.maximum} element(s)`;
13330
- else if (issue2.type === "string")
13331
- message = `String must contain ${issue2.exact ? `exactly` : issue2.inclusive ? `at most` : `under`} ${issue2.maximum} character(s)`;
13332
- else if (issue2.type === "number")
13333
- message = `Number must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;
13334
- else if (issue2.type === "bigint")
13335
- message = `BigInt must be ${issue2.exact ? `exactly` : issue2.inclusive ? `less than or equal to` : `less than`} ${issue2.maximum}`;
13336
- else if (issue2.type === "date")
13337
- message = `Date must be ${issue2.exact ? `exactly` : issue2.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue2.maximum))}`;
13328
+ if (issue3.type === "array")
13329
+ message = `Array must contain ${issue3.exact ? `exactly` : issue3.inclusive ? `at most` : `less than`} ${issue3.maximum} element(s)`;
13330
+ else if (issue3.type === "string")
13331
+ message = `String must contain ${issue3.exact ? `exactly` : issue3.inclusive ? `at most` : `under`} ${issue3.maximum} character(s)`;
13332
+ else if (issue3.type === "number")
13333
+ message = `Number must be ${issue3.exact ? `exactly` : issue3.inclusive ? `less than or equal to` : `less than`} ${issue3.maximum}`;
13334
+ else if (issue3.type === "bigint")
13335
+ message = `BigInt must be ${issue3.exact ? `exactly` : issue3.inclusive ? `less than or equal to` : `less than`} ${issue3.maximum}`;
13336
+ else if (issue3.type === "date")
13337
+ message = `Date must be ${issue3.exact ? `exactly` : issue3.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(Number(issue3.maximum))}`;
13338
13338
  else
13339
13339
  message = "Invalid input";
13340
13340
  break;
@@ -13345,14 +13345,14 @@ var errorMap = (issue2, _ctx) => {
13345
13345
  message = `Intersection results could not be merged`;
13346
13346
  break;
13347
13347
  case ZodIssueCode.not_multiple_of:
13348
- message = `Number must be a multiple of ${issue2.multipleOf}`;
13348
+ message = `Number must be a multiple of ${issue3.multipleOf}`;
13349
13349
  break;
13350
13350
  case ZodIssueCode.not_finite:
13351
13351
  message = "Number must be finite";
13352
13352
  break;
13353
13353
  default:
13354
13354
  message = _ctx.defaultError;
13355
- util.assertNever(issue2);
13355
+ util.assertNever(issue3);
13356
13356
  }
13357
13357
  return { message };
13358
13358
  };
@@ -13392,7 +13392,7 @@ var makeIssue = (params) => {
13392
13392
  };
13393
13393
  function addIssueToContext(ctx, issueData) {
13394
13394
  const overrideMap = getErrorMap();
13395
- const issue2 = makeIssue({
13395
+ const issue3 = makeIssue({
13396
13396
  issueData,
13397
13397
  data: ctx.data,
13398
13398
  path: ctx.path,
@@ -13407,7 +13407,7 @@ function addIssueToContext(ctx, issueData) {
13407
13407
  // then global default map
13408
13408
  ].filter((x) => !!x)
13409
13409
  });
13410
- ctx.common.issues.push(issue2);
13410
+ ctx.common.issues.push(issue3);
13411
13411
  }
13412
13412
  var ParseStatus = class _ParseStatus {
13413
13413
  constructor() {
@@ -15366,10 +15366,10 @@ var ZodObject = class _ZodObject extends ZodType {
15366
15366
  ...this._def,
15367
15367
  unknownKeys: "strict",
15368
15368
  ...message !== void 0 ? {
15369
- errorMap: (issue2, ctx) => {
15369
+ errorMap: (issue3, ctx) => {
15370
15370
  var _a3, _b;
15371
- const defaultError = ((_b = (_a3 = this._def).errorMap) == null ? void 0 : _b.call(_a3, issue2, ctx).message) ?? ctx.defaultError;
15372
- if (issue2.code === "unrecognized_keys")
15371
+ const defaultError = ((_b = (_a3 = this._def).errorMap) == null ? void 0 : _b.call(_a3, issue3, ctx).message) ?? ctx.defaultError;
15372
+ if (issue3.code === "unrecognized_keys")
15373
15373
  return {
15374
15374
  message: errorUtil.errToObj(message).message ?? defaultError
15375
15375
  };
@@ -17663,7 +17663,7 @@ var initializer = (inst, def) => {
17663
17663
  };
17664
17664
  var $ZodError = $constructor("$ZodError", initializer);
17665
17665
  var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
17666
- function flattenError(error2, mapper = (issue2) => issue2.message) {
17666
+ function flattenError(error2, mapper = (issue3) => issue3.message) {
17667
17667
  const fieldErrors = {};
17668
17668
  const formErrors = [];
17669
17669
  for (const sub of error2.issues) {
@@ -17676,29 +17676,29 @@ function flattenError(error2, mapper = (issue2) => issue2.message) {
17676
17676
  }
17677
17677
  return { formErrors, fieldErrors };
17678
17678
  }
17679
- function formatError(error2, mapper = (issue2) => issue2.message) {
17679
+ function formatError(error2, mapper = (issue3) => issue3.message) {
17680
17680
  const fieldErrors = { _errors: [] };
17681
17681
  const processError = (error3) => {
17682
- for (const issue2 of error3.issues) {
17683
- if (issue2.code === "invalid_union" && issue2.errors.length) {
17684
- issue2.errors.map((issues) => processError({ issues }));
17685
- } else if (issue2.code === "invalid_key") {
17686
- processError({ issues: issue2.issues });
17687
- } else if (issue2.code === "invalid_element") {
17688
- processError({ issues: issue2.issues });
17689
- } else if (issue2.path.length === 0) {
17690
- fieldErrors._errors.push(mapper(issue2));
17682
+ for (const issue3 of error3.issues) {
17683
+ if (issue3.code === "invalid_union" && issue3.errors.length) {
17684
+ issue3.errors.map((issues) => processError({ issues }));
17685
+ } else if (issue3.code === "invalid_key") {
17686
+ processError({ issues: issue3.issues });
17687
+ } else if (issue3.code === "invalid_element") {
17688
+ processError({ issues: issue3.issues });
17689
+ } else if (issue3.path.length === 0) {
17690
+ fieldErrors._errors.push(mapper(issue3));
17691
17691
  } else {
17692
17692
  let curr = fieldErrors;
17693
17693
  let i = 0;
17694
- while (i < issue2.path.length) {
17695
- const el = issue2.path[i];
17696
- const terminal = i === issue2.path.length - 1;
17694
+ while (i < issue3.path.length) {
17695
+ const el = issue3.path[i];
17696
+ const terminal = i === issue3.path.length - 1;
17697
17697
  if (!terminal) {
17698
17698
  curr[el] = curr[el] || { _errors: [] };
17699
17699
  } else {
17700
17700
  curr[el] = curr[el] || { _errors: [] };
17701
- curr[el]._errors.push(mapper(issue2));
17701
+ curr[el]._errors.push(mapper(issue3));
17702
17702
  }
17703
17703
  curr = curr[el];
17704
17704
  i++;
@@ -20585,35 +20585,35 @@ var error = () => {
20585
20585
  nan: "NaN"
20586
20586
  // All other type names omitted - they fall back to raw values via ?? operator
20587
20587
  };
20588
- return (issue2) => {
20589
- switch (issue2.code) {
20588
+ return (issue3) => {
20589
+ switch (issue3.code) {
20590
20590
  case "invalid_type": {
20591
- const expected = TypeDictionary[issue2.expected] ?? issue2.expected;
20592
- const receivedType = parsedType(issue2.input);
20591
+ const expected = TypeDictionary[issue3.expected] ?? issue3.expected;
20592
+ const receivedType = parsedType(issue3.input);
20593
20593
  const received = TypeDictionary[receivedType] ?? receivedType;
20594
20594
  return `Invalid input: expected ${expected}, received ${received}`;
20595
20595
  }
20596
20596
  case "invalid_value":
20597
- if (issue2.values.length === 1)
20598
- return `Invalid input: expected ${stringifyPrimitive(issue2.values[0])}`;
20599
- return `Invalid option: expected one of ${joinValues(issue2.values, "|")}`;
20597
+ if (issue3.values.length === 1)
20598
+ return `Invalid input: expected ${stringifyPrimitive(issue3.values[0])}`;
20599
+ return `Invalid option: expected one of ${joinValues(issue3.values, "|")}`;
20600
20600
  case "too_big": {
20601
- const adj = issue2.inclusive ? "<=" : "<";
20602
- const sizing = getSizing(issue2.origin);
20601
+ const adj = issue3.inclusive ? "<=" : "<";
20602
+ const sizing = getSizing(issue3.origin);
20603
20603
  if (sizing)
20604
- return `Too big: expected ${issue2.origin ?? "value"} to have ${adj}${issue2.maximum.toString()} ${sizing.unit ?? "elements"}`;
20605
- return `Too big: expected ${issue2.origin ?? "value"} to be ${adj}${issue2.maximum.toString()}`;
20604
+ return `Too big: expected ${issue3.origin ?? "value"} to have ${adj}${issue3.maximum.toString()} ${sizing.unit ?? "elements"}`;
20605
+ return `Too big: expected ${issue3.origin ?? "value"} to be ${adj}${issue3.maximum.toString()}`;
20606
20606
  }
20607
20607
  case "too_small": {
20608
- const adj = issue2.inclusive ? ">=" : ">";
20609
- const sizing = getSizing(issue2.origin);
20608
+ const adj = issue3.inclusive ? ">=" : ">";
20609
+ const sizing = getSizing(issue3.origin);
20610
20610
  if (sizing) {
20611
- return `Too small: expected ${issue2.origin} to have ${adj}${issue2.minimum.toString()} ${sizing.unit}`;
20611
+ return `Too small: expected ${issue3.origin} to have ${adj}${issue3.minimum.toString()} ${sizing.unit}`;
20612
20612
  }
20613
- return `Too small: expected ${issue2.origin} to be ${adj}${issue2.minimum.toString()}`;
20613
+ return `Too small: expected ${issue3.origin} to be ${adj}${issue3.minimum.toString()}`;
20614
20614
  }
20615
20615
  case "invalid_format": {
20616
- const _issue = issue2;
20616
+ const _issue = issue3;
20617
20617
  if (_issue.format === "starts_with") {
20618
20618
  return `Invalid string: must start with "${_issue.prefix}"`;
20619
20619
  }
@@ -20623,18 +20623,18 @@ var error = () => {
20623
20623
  return `Invalid string: must include "${_issue.includes}"`;
20624
20624
  if (_issue.format === "regex")
20625
20625
  return `Invalid string: must match pattern ${_issue.pattern}`;
20626
- return `Invalid ${FormatDictionary[_issue.format] ?? issue2.format}`;
20626
+ return `Invalid ${FormatDictionary[_issue.format] ?? issue3.format}`;
20627
20627
  }
20628
20628
  case "not_multiple_of":
20629
- return `Invalid number: must be a multiple of ${issue2.divisor}`;
20629
+ return `Invalid number: must be a multiple of ${issue3.divisor}`;
20630
20630
  case "unrecognized_keys":
20631
- return `Unrecognized key${issue2.keys.length > 1 ? "s" : ""}: ${joinValues(issue2.keys, ", ")}`;
20631
+ return `Unrecognized key${issue3.keys.length > 1 ? "s" : ""}: ${joinValues(issue3.keys, ", ")}`;
20632
20632
  case "invalid_key":
20633
- return `Invalid key in ${issue2.origin}`;
20633
+ return `Invalid key in ${issue3.origin}`;
20634
20634
  case "invalid_union":
20635
20635
  return "Invalid input";
20636
20636
  case "invalid_element":
20637
- return `Invalid value in ${issue2.origin}`;
20637
+ return `Invalid value in ${issue3.origin}`;
20638
20638
  default:
20639
20639
  return `Invalid input`;
20640
20640
  }
@@ -21419,11 +21419,11 @@ function _refine(Class2, fn, _params) {
21419
21419
  // @__NO_SIDE_EFFECTS__
21420
21420
  function _superRefine(fn) {
21421
21421
  const ch = /* @__PURE__ */ _check((payload) => {
21422
- payload.addIssue = (issue2) => {
21423
- if (typeof issue2 === "string") {
21424
- payload.issues.push(issue(issue2, payload.value, ch._zod.def));
21422
+ payload.addIssue = (issue3) => {
21423
+ if (typeof issue3 === "string") {
21424
+ payload.issues.push(issue(issue3, payload.value, ch._zod.def));
21425
21425
  } else {
21426
- const _issue = issue2;
21426
+ const _issue = issue3;
21427
21427
  if (_issue.fatal)
21428
21428
  _issue.continue = false;
21429
21429
  _issue.code ?? (_issue.code = "custom");
@@ -22697,8 +22697,8 @@ var initializer2 = (inst, issues) => {
22697
22697
  // enumerable: false,
22698
22698
  },
22699
22699
  addIssue: {
22700
- value: (issue2) => {
22701
- inst.issues.push(issue2);
22700
+ value: (issue3) => {
22701
+ inst.issues.push(issue3);
22702
22702
  inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
22703
22703
  }
22704
22704
  // enumerable: false,
@@ -23521,11 +23521,11 @@ var ZodTransform = /* @__PURE__ */ $constructor("ZodTransform", (inst, def) => {
23521
23521
  if (_ctx.direction === "backward") {
23522
23522
  throw new $ZodEncodeError(inst.constructor.name);
23523
23523
  }
23524
- payload.addIssue = (issue2) => {
23525
- if (typeof issue2 === "string") {
23526
- payload.issues.push(util_exports.issue(issue2, payload.value, def));
23524
+ payload.addIssue = (issue3) => {
23525
+ if (typeof issue3 === "string") {
23526
+ payload.issues.push(util_exports.issue(issue3, payload.value, def));
23527
23527
  } else {
23528
- const _issue = issue2;
23528
+ const _issue = issue3;
23529
23529
  if (_issue.fatal)
23530
23530
  _issue.continue = false;
23531
23531
  _issue.code ?? (_issue.code = "custom");
@@ -29157,7 +29157,7 @@ import crypto from "node:crypto";
29157
29157
  import fs5 from "node:fs";
29158
29158
  import path6 from "node:path";
29159
29159
  var MAKER_AGENTS_FILE = "AGENTS.md";
29160
- var POLICY_VERSION = "1";
29160
+ var POLICY_VERSION = "3";
29161
29161
  var POLICY_END = "<!-- <<< TapTap Maker managed AGENTS policy <<< -->";
29162
29162
  var POLICY_BLOCK_PATTERN = /(?:# TapTap Maker Project Asset Tool Policy\s*)?<!-- >>> TapTap Maker (?:managed AGENTS policy version=([^ ]+) hash=sha256:([0-9a-f]+)|asset tool policy) >>> -->[\s\S]*?<!-- <<< TapTap Maker (?:managed AGENTS policy|asset tool policy) <<< -->\n?/;
29163
29163
  function inspectMakerAgentsPolicy(targetDir) {
@@ -29253,6 +29253,51 @@ function createMakerAgentsPolicyBody() {
29253
29253
  "",
29254
29254
  "Generic code checks such as 验证代码, 跑测试, lint, or 检查实现 should not trigger a Maker",
29255
29255
  "remote build unless the user explicitly asks to build, run, or preview the Maker game.",
29256
+ "- Preview, build, test, and local-development intent must never select or change the service",
29257
+ " environment. Do not add environment parameters to Maker tool calls or user MCP config;",
29258
+ " use the default Maker service configuration.",
29259
+ "",
29260
+ "Maker MCP connection recovery:",
29261
+ "",
29262
+ "- If tools are missing, the process exits immediately, or the client reports `-32000`,",
29263
+ " `Connection closed`, or `command not found`, do not depend on Maker MCP tools for initial",
29264
+ " diagnosis. Work from local config, shell output, and client logs.",
29265
+ "- Attempt `npx -y -p @taptap/maker taptap-maker mcp verify --json`; on Windows use",
29266
+ " `npx.cmd -y -p @taptap/maker taptap-maker mcp verify --json`. Record command failure as",
29267
+ " diagnostic evidence instead of skipping the check.",
29268
+ "- This verifies only the standard `@taptap/maker` npx/CLI launch path and returns command,",
29269
+ " status, signal, stdout, stderr, error, and failure_type. It does not start the Maker MCP server",
29270
+ " and does not read or validate the client's active MCP config, WorkBuddy trust, cwd, or Roots.",
29271
+ " A successful verify result does not prove that the client MCP config works.",
29272
+ "- Then inspect and reproduce the active config path, command, ordered args, cwd, WorkBuddy",
29273
+ " enable/trust state, workspace/Roots, Node/npm/npx paths, client PATH, exit status, and stderr.",
29274
+ "- Classify the root cause from evidence before repairing it. Do not automatically change trust",
29275
+ " storage, PATH, cwd, credentials, or game code.",
29276
+ "- Treat `taptap-maker mcp install --ide <client>` as an optional recovery only after evidence",
29277
+ " confirms that the active config entry is damaged.",
29278
+ '- Never repair cwd by wrapping the command with `cd /d "<project>" && npx.cmd ...`.',
29279
+ " Maker supports Chinese project paths; command-shell quoting or client startup can fail",
29280
+ " independently of the project path.",
29281
+ "- If WorkBuddy ignores configured cwd, do not keep rewriting the cwd field. Use the active",
29282
+ " workspace/Roots and record the process actual cwd instead.",
29283
+ "- Do not assume Windows 8.3 short paths exist or differ from the original long path. Verify",
29284
+ " the result first; an unchanged or missing short path is not a usable cwd workaround.",
29285
+ "- Reproduce the configured Windows launch with the same direct argv boundary when possible.",
29286
+ " Separate outer shell quoting or stderr decoding failures from the MCP child process result,",
29287
+ " and record both without treating wrapper failures as server evidence.",
29288
+ "- AI conversations share user-level MCP config. Back up the active config before any repair,",
29289
+ " then reconnect and verify in both the current and a new conversation.",
29290
+ "- If the MCP connection is established but a tool or resource call fails, including `-32003`,",
29291
+ " use a separate evidence-first runtime-error workflow. Do not assign a fixed meaning to the",
29292
+ " error code; preserve the exact client error.",
29293
+ "- `mcp verify` is not the primary check for an already connected session because it only tests",
29294
+ " the standard npx/CLI launch path.",
29295
+ "- Collect the failed tool/resource, redacted request parameters, current `tools/list`, exact",
29296
+ " error code/message/data, complete sanitized `remote_result`, request/correlation IDs,",
29297
+ " timestamp with timezone, OS/architecture, AI client and `@taptap/maker` package versions,",
29298
+ " and stable reproduction steps. Preserve useful nested fields while removing credentials.",
29299
+ "- Do not rewrite command, cwd, PATH, trust state, credentials, or game code unless the",
29300
+ " collected evidence identifies that cause.",
29256
29301
  "",
29257
29302
  "Maker ad workflow:",
29258
29303
  "",
@@ -31104,19 +31149,19 @@ function inspectMakerDirectoryGitStatus(cwd) {
31104
31149
  const isUsableMakerGitRepo = Boolean(
31105
31150
  (makerBinding == null ? void 0 : makerBinding.projectRoot) && gitRoot && samePath(makerBinding.projectRoot, gitRoot)
31106
31151
  );
31107
- let issue2;
31152
+ let issue3;
31108
31153
  let message;
31109
31154
  if (makerBinding && gitRoot && !samePath(makerBinding.projectRoot, gitRoot)) {
31110
- issue2 = "inside_parent_git_repo";
31155
+ issue3 = "inside_parent_git_repo";
31111
31156
  message = [
31112
31157
  `${makerBinding.projectRoot} contains Maker binding config, but Git root is ${gitRoot}.`,
31113
31158
  "The Maker directory must be an independent Git repository before build or submit."
31114
31159
  ].join(" ");
31115
31160
  } else if (makerBinding && !gitRoot) {
31116
- issue2 = "missing_git_repo";
31161
+ issue3 = "missing_git_repo";
31117
31162
  message = `${makerBinding.projectRoot} is bound to Maker but is not a Git repository.`;
31118
31163
  } else if (!makerBinding) {
31119
- issue2 = "missing_maker_config";
31164
+ issue3 = "missing_maker_config";
31120
31165
  message = `${targetDir} is not bound to a Maker project. .maker-mcp/config.json is missing.`;
31121
31166
  }
31122
31167
  return {
@@ -31128,7 +31173,7 @@ function inspectMakerDirectoryGitStatus(cwd) {
31128
31173
  isGitWorkTree,
31129
31174
  isOwnGitRoot: isOwnGitRoot2,
31130
31175
  isUsableMakerGitRepo,
31131
- issue: issue2,
31176
+ issue: issue3,
31132
31177
  message
31133
31178
  };
31134
31179
  }
@@ -33321,21 +33366,29 @@ function formatMakerProjectInitializationStatus(status) {
33321
33366
  `- config: ${status.projectJsonPath}`,
33322
33367
  status.error ? `- error: ${status.error}` : "",
33323
33368
  "- impact: get_ad_config and other remote project-config tools cannot parse project metadata yet.",
33324
- "- next_action: 检查 .project/project.json 内容;必要时先调用 maker_build_current_directory 重新生成项目配置。"
33369
+ "- next_action: 从 Git 或完整副本恢复合法的 .project/project.json;不要依赖 maker_build_current_directory 覆盖已有坏文件。"
33325
33370
  ].filter(Boolean).join("\n");
33326
33371
  }
33327
33372
  if (status.status === "missing_project_json") {
33373
+ const projectDirState = inspectProjectDirectory(status.projectRoot);
33328
33374
  return [
33329
33375
  "Maker project initialization",
33330
33376
  "",
33331
33377
  "- status: missing_project_json",
33332
33378
  `- config: ${status.projectJsonPath}`,
33333
33379
  "- impact: get_ad_config and other remote project-config tools cannot read project metadata yet.",
33334
- "- next_action: 先调用 maker_build_current_directory 构建一次,生成 .project/project.json 后再重试。"
33380
+ projectDirState === "directory" ? "- next_action: 已存在 .project 但 project.json 缺失;先从 Git 或完整副本恢复,构建不会覆盖该缺失文件。" : projectDirState === "invalid" ? "- next_action: .project 路径异常;先恢复为正常目录,再检查或恢复 project.json。" : "- next_action: 先调用 maker_build_current_directory 构建一次,生成 .project/project.json 后再重试。"
33335
33381
  ].join("\n");
33336
33382
  }
33337
33383
  return "";
33338
33384
  }
33385
+ function inspectProjectDirectory(projectRoot) {
33386
+ try {
33387
+ return fs13.lstatSync(path14.join(projectRoot, ".project")).isDirectory() ? "directory" : "invalid";
33388
+ } catch (error2) {
33389
+ return error2.code === "ENOENT" ? "missing" : "invalid";
33390
+ }
33391
+ }
33339
33392
  function hasNonEmptyIdentityField(value, fieldName) {
33340
33393
  if (!value || typeof value !== "object") {
33341
33394
  return false;
@@ -33358,6 +33411,190 @@ function isNonEmptyStringLike(value) {
33358
33411
  import fs14 from "node:fs";
33359
33412
  import path15 from "node:path";
33360
33413
  var REQUIRED_SOURCE_TAGS = ["stable"];
33414
+ function inspectMakerProjectHealth(projectRoot, mode = "status") {
33415
+ const resolvedProjectRoot = path15.resolve(projectRoot);
33416
+ const paths = {
33417
+ projectDir: path15.join(resolvedProjectRoot, ".project"),
33418
+ projectJson: path15.join(resolvedProjectRoot, ".project", "project.json"),
33419
+ resourcesJson: path15.join(resolvedProjectRoot, ".project", "resources.json"),
33420
+ settingsJson: path15.join(resolvedProjectRoot, ".project", "settings.json")
33421
+ };
33422
+ const issues = [];
33423
+ const projectDirState = inspectPath(paths.projectDir, "directory");
33424
+ if (projectDirState === "wrong_type") {
33425
+ issues.push(issue2("invalid_path_type", "error", ".project", ".project 必须是目录"));
33426
+ }
33427
+ const rootCandidates = [
33428
+ ["project.json", paths.projectJson],
33429
+ ["resources.json", paths.resourcesJson],
33430
+ ["settings.json", paths.settingsJson],
33431
+ ["assets/project.json", paths.projectJson]
33432
+ ];
33433
+ for (const [name, canonicalPath] of rootCandidates) {
33434
+ const rootPath = path15.join(resolvedProjectRoot, name);
33435
+ const rootState = inspectPath(rootPath, "file");
33436
+ if (rootState === "file" && inspectPath(canonicalPath, "file") !== "file") {
33437
+ if (name === "assets/project.json" && !hasTapTapPublish(path15.join(resolvedProjectRoot, name))) {
33438
+ continue;
33439
+ }
33440
+ if (name !== "assets/project.json" && !hasMakerRootConfigSignature(rootPath, name)) {
33441
+ continue;
33442
+ }
33443
+ issues.push({
33444
+ code: "misplaced_config",
33445
+ severity: "error",
33446
+ path: name,
33447
+ expectedPath: path15.relative(resolvedProjectRoot, canonicalPath),
33448
+ message: `${name} 位于项目根目录,规范位置应为 ${path15.relative(resolvedProjectRoot, canonicalPath)}`
33449
+ });
33450
+ }
33451
+ }
33452
+ const projectDirExists = projectDirState === "directory";
33453
+ const projectJsonState = projectDirExists ? inspectPath(paths.projectJson, "file") : "missing";
33454
+ const resourcesJsonState = projectDirExists ? inspectPath(paths.resourcesJson, "file") : "missing";
33455
+ const settingsJsonState = projectDirExists ? inspectPath(paths.settingsJson, "file") : "missing";
33456
+ const projectJsonExists = projectJsonState === "file";
33457
+ const resourcesJsonExists = resourcesJsonState === "file";
33458
+ const settingsJsonExists = settingsJsonState === "file";
33459
+ const hasMisplacedConfig = issues.some((item) => item.code === "misplaced_config");
33460
+ if (!projectDirExists && !hasMisplacedConfig && issues.length === 0) {
33461
+ return createHealthResult(
33462
+ resolvedProjectRoot,
33463
+ mode,
33464
+ "not_initialized",
33465
+ paths,
33466
+ issues,
33467
+ true,
33468
+ false
33469
+ );
33470
+ }
33471
+ addCanonicalFileIssue(projectJsonState, ".project/project.json", issues, projectDirExists);
33472
+ addCanonicalFileIssue(
33473
+ resourcesJsonState,
33474
+ ".project/resources.json",
33475
+ issues,
33476
+ mode === "qrcode" || projectDirExists
33477
+ );
33478
+ addCanonicalFileIssue(settingsJsonState, ".project/settings.json", issues, false);
33479
+ if (projectDirExists && settingsJsonState === "missing" && mode !== "qrcode") {
33480
+ issues.push(
33481
+ issue2(
33482
+ "missing_settings_json",
33483
+ "warning",
33484
+ ".project/settings.json",
33485
+ ".project/settings.json 缺失,首次构建可能由 server 创建"
33486
+ )
33487
+ );
33488
+ }
33489
+ const project = projectJsonExists ? readHealthJson(paths.projectJson, "project.json", issues) : void 0;
33490
+ const resources2 = resourcesJsonExists ? readHealthJson(paths.resourcesJson, "resources.json", issues) : void 0;
33491
+ const settings = settingsJsonExists ? readHealthJson(paths.settingsJson, "settings.json", issues) : void 0;
33492
+ if (project !== void 0 && !isPlainObject3(project)) {
33493
+ issues.push(
33494
+ issue2(
33495
+ "invalid_project_json",
33496
+ "error",
33497
+ ".project/project.json",
33498
+ "project.json 必须是 JSON object"
33499
+ )
33500
+ );
33501
+ } else if (project && isPlainObject3(project)) {
33502
+ validateProjectFields(project, resources2, issues, mode);
33503
+ }
33504
+ if (resources2 !== void 0 && !isPlainObject3(resources2)) {
33505
+ issues.push(
33506
+ issue2(
33507
+ "invalid_resources_json",
33508
+ "error",
33509
+ ".project/resources.json",
33510
+ "resources.json 必须是 JSON object"
33511
+ )
33512
+ );
33513
+ }
33514
+ if (settings !== void 0) {
33515
+ if (!isPlainObject3(settings)) {
33516
+ issues.push(
33517
+ issue2(
33518
+ "invalid_settings_json",
33519
+ "error",
33520
+ ".project/settings.json",
33521
+ "settings.json 必须是 JSON object"
33522
+ )
33523
+ );
33524
+ } else {
33525
+ const settingsIssues = validateMakerProjectSettings(settings);
33526
+ if (settingsIssues.length > 0) {
33527
+ issues.push(
33528
+ issue2(
33529
+ "invalid_project_settings",
33530
+ "error",
33531
+ ".project/settings.json",
33532
+ settingsIssues.join("; ")
33533
+ )
33534
+ );
33535
+ }
33536
+ }
33537
+ }
33538
+ const hasFatalIssues = issues.some((item) => item.severity === "error");
33539
+ const status = hasMisplacedConfig ? "misplaced_config" : hasFatalIssues ? "error" : issues.length > 0 ? "warning" : "ready";
33540
+ const canBuild = !issues.some((item) => item.severity === "error" && isBuildBlockingIssue(item));
33541
+ const canGenerateTestQrcode = canGenerateQrcode(project, resources2, issues);
33542
+ return createHealthResult(
33543
+ resolvedProjectRoot,
33544
+ mode,
33545
+ status,
33546
+ paths,
33547
+ issues,
33548
+ canBuild,
33549
+ canGenerateTestQrcode
33550
+ );
33551
+ }
33552
+ function formatMakerProjectHealthStatus(health) {
33553
+ if (health.status === "ready" && health.issues.length === 0 && health.canGenerateTestQrcode) {
33554
+ return "";
33555
+ }
33556
+ const lines = [
33557
+ "Maker project structure",
33558
+ "",
33559
+ `- status: ${health.status}`,
33560
+ `- can_build: ${health.canBuild ? "yes" : "no"}`,
33561
+ `- can_generate_test_qrcode: ${health.canGenerateTestQrcode ? "yes" : "no"}`
33562
+ ];
33563
+ if (health.issues.length > 0) {
33564
+ lines.push("- issues:");
33565
+ lines.push(
33566
+ ...health.issues.map(
33567
+ (item) => ` - [${item.severity}] ${item.code}: ${item.path} - ${item.message}${item.expectedPath ? ` (expected: ${item.expectedPath})` : ""}`
33568
+ )
33569
+ );
33570
+ }
33571
+ const settingsSection = formatHealthSettingsStatus(health);
33572
+ if (settingsSection) {
33573
+ lines.push("", settingsSection);
33574
+ }
33575
+ lines.push(
33576
+ health.canBuild && !health.canGenerateTestQrcode ? "- next_action: 可以继续构建;生成测试二维码前请完善 .project/project.json 发布配置。" : health.canBuild ? "- next_action: 可以继续构建;检查器不会自动移动或覆盖文件。" : "- next_action: 修复上面的规范路径或配置问题后再构建;检查器不会自动移动或覆盖文件。"
33577
+ );
33578
+ return lines.join("\n");
33579
+ }
33580
+ function formatHealthSettingsStatus(health) {
33581
+ const settingsIssue = health.issues.find(
33582
+ (item) => item.code === "invalid_settings_json" || item.code === "invalid_project_settings"
33583
+ );
33584
+ if (!settingsIssue) {
33585
+ return "";
33586
+ }
33587
+ return [
33588
+ "Maker project settings",
33589
+ "",
33590
+ `- status: ${settingsIssue.code}`,
33591
+ `- config: ${health.paths.settingsJson}`,
33592
+ "- impact: 构建可能失败或游戏黑屏;坏配置不应提交到 Maker 远端。",
33593
+ "- issues:",
33594
+ ` - ${settingsIssue.message}`,
33595
+ "- next_action: 恢复 .project/settings.json 的构建关键字段后再构建;保留合法的 @runtime 配置。"
33596
+ ].join("\n");
33597
+ }
33361
33598
  function inspectMakerProjectSettings(projectRoot) {
33362
33599
  const resolvedProjectRoot = path15.resolve(projectRoot);
33363
33600
  const settingsJsonPath = path15.join(resolvedProjectRoot, ".project", "settings.json");
@@ -33394,6 +33631,221 @@ function inspectMakerProjectSettings(projectRoot) {
33394
33631
  status: "ready"
33395
33632
  };
33396
33633
  }
33634
+ function createHealthResult(projectRoot, mode, status, paths, issues, canBuild, canGenerateTestQrcode) {
33635
+ return {
33636
+ projectRoot,
33637
+ mode,
33638
+ status,
33639
+ canBuild,
33640
+ canGenerateTestQrcode,
33641
+ paths,
33642
+ issues
33643
+ };
33644
+ }
33645
+ function inspectPath(filePath, expectedType) {
33646
+ try {
33647
+ const stats = fs14.lstatSync(filePath);
33648
+ if (stats.isSymbolicLink()) {
33649
+ return "wrong_type";
33650
+ }
33651
+ if (expectedType === "directory") {
33652
+ return stats.isDirectory() ? "directory" : "wrong_type";
33653
+ }
33654
+ return stats.isFile() ? "file" : "directory";
33655
+ } catch (error2) {
33656
+ if (error2.code === "ENOENT") {
33657
+ return "missing";
33658
+ }
33659
+ return "wrong_type";
33660
+ }
33661
+ }
33662
+ function addCanonicalFileIssue(state, issuePath, issues, required2) {
33663
+ if (state === "directory" || state === "wrong_type") {
33664
+ issues.push(issue2("invalid_path_type", "error", issuePath, `${issuePath} 必须是普通文件`));
33665
+ } else if (state === "missing" && required2) {
33666
+ issues.push(issue2("missing_required_file", "error", issuePath, `${issuePath} 缺失`));
33667
+ }
33668
+ }
33669
+ function readHealthJson(filePath, label, issues) {
33670
+ try {
33671
+ return JSON.parse(fs14.readFileSync(filePath, "utf8"));
33672
+ } catch (error2) {
33673
+ const code = label === "project.json" ? "invalid_project_json" : label === "settings.json" ? "invalid_settings_json" : "invalid_resources_json";
33674
+ issues.push(
33675
+ issue2(
33676
+ code,
33677
+ "error",
33678
+ label === "project.json" ? ".project/project.json" : label === "settings.json" ? ".project/settings.json" : ".project/resources.json",
33679
+ `${label} 无法解析为 JSON: ${error2 instanceof Error ? error2.message : String(error2)}`
33680
+ )
33681
+ );
33682
+ return void 0;
33683
+ }
33684
+ }
33685
+ function hasTapTapPublish(filePath) {
33686
+ try {
33687
+ const value = JSON.parse(fs14.readFileSync(filePath, "utf8"));
33688
+ return isPlainObject3(value) && isPlainObject3(value.taptap_publish);
33689
+ } catch {
33690
+ return false;
33691
+ }
33692
+ }
33693
+ function hasMakerRootConfigSignature(filePath, name) {
33694
+ try {
33695
+ const value = JSON.parse(fs14.readFileSync(filePath, "utf8"));
33696
+ if (!isPlainObject3(value)) {
33697
+ return false;
33698
+ }
33699
+ const schema = value.$schema;
33700
+ if (isNonEmptyString(schema) && schema.endsWith(name.replace(".json", ".schema.json"))) {
33701
+ return true;
33702
+ }
33703
+ if (name === "project.json") {
33704
+ return isPlainObject3(value.taptap_publish) && isNonEmptyString(value.project_id) && isNonEmptyString(value.version) && (isNonEmptyString(value.entry) || isNonEmptyString(value["entry@client"]) && isNonEmptyString(value["entry@server"]));
33705
+ }
33706
+ return false;
33707
+ } catch {
33708
+ return false;
33709
+ }
33710
+ }
33711
+ function isBuildBlockingIssue(item) {
33712
+ return item.code !== "invalid_project_field" && item.code !== "invalid_publish_field";
33713
+ }
33714
+ function validateProjectFields(project, resources2, issues, mode) {
33715
+ const projectFieldSeverity = mode === "qrcode" ? "error" : "warning";
33716
+ const projectId = project.project_id;
33717
+ if (!isConfiguredString(projectId)) {
33718
+ issues.push(
33719
+ issue2(
33720
+ "invalid_project_field",
33721
+ projectFieldSeverity,
33722
+ ".project/project.json:project_id",
33723
+ mode === "qrcode" ? "project_id 不能为空或使用模板占位符" : "project_id 必须存在且不能为空"
33724
+ )
33725
+ );
33726
+ }
33727
+ const version2 = project.version;
33728
+ if (!isConfiguredString(version2)) {
33729
+ issues.push(
33730
+ issue2(
33731
+ "invalid_project_field",
33732
+ projectFieldSeverity,
33733
+ ".project/project.json:version",
33734
+ mode === "qrcode" ? "version 不能为空或使用模板占位符" : "version 必须存在且不能为空"
33735
+ )
33736
+ );
33737
+ }
33738
+ if (!hasProjectEntry(project, resources2, "qrcode")) {
33739
+ issues.push(
33740
+ issue2(
33741
+ "invalid_project_field",
33742
+ projectFieldSeverity,
33743
+ ".project/project.json:entry",
33744
+ "必须在 project.json 或 resources.json 提供 entry,或完整的客户端/服务端入口"
33745
+ )
33746
+ );
33747
+ }
33748
+ const publish = project.taptap_publish;
33749
+ if (publish === void 0) {
33750
+ issues.push(
33751
+ issue2(
33752
+ "invalid_publish_field",
33753
+ projectFieldSeverity,
33754
+ "taptap_publish",
33755
+ "生成测试二维码前必须存在 taptap_publish 配置"
33756
+ )
33757
+ );
33758
+ return;
33759
+ }
33760
+ if (!isPlainObject3(publish)) {
33761
+ issues.push(
33762
+ issue2(
33763
+ "invalid_publish_field",
33764
+ mode === "qrcode" ? "error" : "warning",
33765
+ "taptap_publish",
33766
+ "taptap_publish 必须是 JSON object"
33767
+ )
33768
+ );
33769
+ return;
33770
+ }
33771
+ const publishFieldSeverity = mode === "qrcode" ? "error" : "warning";
33772
+ const title = publish.title;
33773
+ if (!isConfiguredTitle(title)) {
33774
+ issues.push(
33775
+ issue2(
33776
+ "invalid_publish_field",
33777
+ publishFieldSeverity,
33778
+ "taptap_publish.title",
33779
+ "title 不能为空或使用模板占位符"
33780
+ )
33781
+ );
33782
+ }
33783
+ const category = publish.category;
33784
+ if (!isConfiguredString(category)) {
33785
+ issues.push(
33786
+ issue2(
33787
+ "invalid_publish_field",
33788
+ publishFieldSeverity,
33789
+ "taptap_publish.category",
33790
+ "category 不能为空或使用模板占位符"
33791
+ )
33792
+ );
33793
+ }
33794
+ const orientation = publish.screen_orientation;
33795
+ if (orientation !== "landscape" && orientation !== "portrait") {
33796
+ issues.push(
33797
+ issue2(
33798
+ "invalid_publish_field",
33799
+ publishFieldSeverity,
33800
+ "taptap_publish.screen_orientation",
33801
+ "screen_orientation 必须是 landscape 或 portrait"
33802
+ )
33803
+ );
33804
+ }
33805
+ }
33806
+ function isNonEmptyString(value) {
33807
+ return typeof value === "string" && value.trim().length > 0;
33808
+ }
33809
+ function isConfiguredString(value) {
33810
+ return isNonEmptyString(value) && !value.trim().startsWith("<") && !/[{}]/u.test(value);
33811
+ }
33812
+ function isConfiguredTitle(value) {
33813
+ if (!isNonEmptyString(value)) {
33814
+ return false;
33815
+ }
33816
+ const title = value.trim();
33817
+ return !(title.startsWith("<") && title.endsWith(">") || title.startsWith("{") && title.endsWith("}"));
33818
+ }
33819
+ function canGenerateQrcode(project, resources2, issues) {
33820
+ if (!isPlainObject3(project) || !isPlainObject3(resources2) || !isConfiguredString(project.project_id) || !isConfiguredString(project.version) || !hasProjectEntry(project, resources2, "qrcode") || !isPlainObject3(project.taptap_publish)) {
33821
+ return false;
33822
+ }
33823
+ const publish = project.taptap_publish;
33824
+ if (!isConfiguredTitle(publish.title) || !isConfiguredString(publish.category) || publish.screen_orientation !== "landscape" && publish.screen_orientation !== "portrait") {
33825
+ return false;
33826
+ }
33827
+ return !issues.some((item) => {
33828
+ if (item.severity !== "error") {
33829
+ return false;
33830
+ }
33831
+ if (item.path === "taptap_publish" || item.path.startsWith("taptap_publish.")) {
33832
+ return true;
33833
+ }
33834
+ return item.path === ".project" || item.path === ".project/project.json" || item.path.startsWith(".project/project.json:") || item.path === ".project/resources.json" || item.code === "misplaced_config" && item.path === "project.json";
33835
+ });
33836
+ }
33837
+ function hasProjectEntry(project, resources2, mode = "status") {
33838
+ const resourceConfig = isPlainObject3(resources2) ? resources2 : void 0;
33839
+ const entry = project.entry || (resourceConfig == null ? void 0 : resourceConfig.entry);
33840
+ const isValidEntry = mode === "qrcode" ? isConfiguredString : isNonEmptyString;
33841
+ if (isValidEntry(entry)) {
33842
+ return true;
33843
+ }
33844
+ return isValidEntry(project["entry@client"] || (resourceConfig == null ? void 0 : resourceConfig["entry@client"])) && isValidEntry(project["entry@server"] || (resourceConfig == null ? void 0 : resourceConfig["entry@server"]));
33845
+ }
33846
+ function issue2(code, severity, issuePath, message) {
33847
+ return { code, severity, path: issuePath, message };
33848
+ }
33397
33849
  function formatMakerProjectSettingsStatus(status) {
33398
33850
  var _a3;
33399
33851
  if (status.status === "ready" || status.status === "missing_settings_json") {
@@ -33411,7 +33863,7 @@ function formatMakerProjectSettingsStatus(status) {
33411
33863
  }
33412
33864
  if ((_a3 = status.issues) == null ? void 0 : _a3.length) {
33413
33865
  lines.push("- issues:");
33414
- lines.push(...status.issues.map((issue2) => ` - ${issue2}`));
33866
+ lines.push(...status.issues.map((issue3) => ` - ${issue3}`));
33415
33867
  }
33416
33868
  lines.push(
33417
33869
  "- next_action: 恢复 .project/settings.json 的构建关键字段后再构建;保留合法的 @runtime 配置。"
@@ -33487,6 +33939,56 @@ function sameStringSet(left, right) {
33487
33939
  import fs15 from "node:fs";
33488
33940
  import path16 from "node:path";
33489
33941
  import { randomUUID } from "node:crypto";
33942
+
33943
+ // src/maker/server/diagnosticRedaction.ts
33944
+ function isSensitiveDiagnosticKey(key) {
33945
+ const normalized = key.replace(/[-\s]/gu, "_").toLowerCase();
33946
+ return /^(?:authorization|cookie|pat|token|secret)$/u.test(normalized) || /(?:^|_)(?:access|refresh|id|api|auth|bearer|personal_access)?_?token$/u.test(normalized) || /(?:^|_)(?:client|app|api|mac)?_?secret$/u.test(normalized) || /(?:^|_)(?:api|auth|mac|private)?_?key$/u.test(normalized) || /(?:^|_)pat$/u.test(normalized);
33947
+ }
33948
+ function sanitizeDiagnosticValue(value) {
33949
+ return sanitizeValue(value, true, /* @__PURE__ */ new WeakSet());
33950
+ }
33951
+ function sanitizeRemoteDiagnosticValue(value) {
33952
+ return sanitizeValue(value, true, /* @__PURE__ */ new WeakSet());
33953
+ }
33954
+ function sanitizeValue(value, sanitizeText, visited) {
33955
+ if (typeof value === "string") {
33956
+ return sanitizeText ? sanitizeDiagnosticText(value) : value;
33957
+ }
33958
+ if (!value || typeof value !== "object") {
33959
+ return value;
33960
+ }
33961
+ if (visited.has(value)) {
33962
+ return "<circular>";
33963
+ }
33964
+ visited.add(value);
33965
+ if (Array.isArray(value)) {
33966
+ const result2 = value.map((item) => sanitizeValue(item, sanitizeText, visited));
33967
+ visited.delete(value);
33968
+ return result2;
33969
+ }
33970
+ const result = {};
33971
+ for (const [key, nestedValue] of Object.entries(value)) {
33972
+ result[key] = isSensitiveDiagnosticKey(key) ? "<redacted>" : sanitizeValue(nestedValue, sanitizeText, visited);
33973
+ }
33974
+ visited.delete(value);
33975
+ return result;
33976
+ }
33977
+ function sanitizeDiagnosticText(value) {
33978
+ try {
33979
+ const parsed = JSON.parse(value);
33980
+ if (parsed && typeof parsed === "object") {
33981
+ return JSON.stringify(sanitizeRemoteDiagnosticValue(parsed), null, 2);
33982
+ }
33983
+ } catch {
33984
+ }
33985
+ return value.replace(/\b(authorization|cookie)\b\s*:\s*[^\r\n]*/giu, "$1: <redacted>").replace(
33986
+ /\b(token|secret|mac[_-]?key|pat)\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;]+)/giu,
33987
+ "$1=<redacted>"
33988
+ ).replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{16,}(?=$|[\s,;'"()\x5B\x5D{}])/giu, "Bearer <redacted>").replace(/\beyJ[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+){2}\b/gu, "<redacted>");
33989
+ }
33990
+
33991
+ // src/maker/server/proxyAssets.ts
33490
33992
  var IMAGE_ASSET_DIRS = ["assets/image"];
33491
33993
  var VIDEO_ASSET_DIRS = ["assets/video"];
33492
33994
  var AUDIO_ASSET_DIRS = ["assets/audio"];
@@ -33653,7 +34155,13 @@ function isRemoteProxyToolErrorResult(result) {
33653
34155
  return Boolean(result.isError);
33654
34156
  }
33655
34157
  function formatRemoteProxyToolResult(result) {
33656
- return ["remote_result:", indent(formatUnknownForDiagnostics(result))].join("\n");
34158
+ return [
34159
+ "remote_result:",
34160
+ indent(formatUnknownForDiagnostics(sanitizeRemoteProxyToolResult(result)))
34161
+ ].join("\n");
34162
+ }
34163
+ function sanitizeRemoteProxyToolResult(result) {
34164
+ return sanitizeRemoteDiagnosticValue(result);
33657
34165
  }
33658
34166
  function formatUnknownForDiagnostics(value) {
33659
34167
  try {
@@ -35546,8 +36054,88 @@ function applyDefaults(config2) {
35546
36054
  };
35547
36055
  }
35548
36056
 
36057
+ // src/maker/tracking.ts
36058
+ var MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
36059
+ var MAKER_MCP_TRACKING_SOURCE = "local_mcp";
36060
+ var MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
36061
+ var MAKER_MCP_VERSION = "0.0.26-beta.2".trim() ? "0.0.26-beta.2".trim() : "dev";
36062
+ var TRACKING_ERROR_MAX_LENGTH = 500;
36063
+ function buildMakerMcpTrackingPayload(event) {
36064
+ var _a3, _b, _c;
36065
+ const userId = event.context.userId.trim();
36066
+ const projectId = event.context.projectId.trim();
36067
+ const toolName = event.toolName.trim();
36068
+ if (!userId || !projectId || !toolName) {
36069
+ return null;
36070
+ }
36071
+ const args = {
36072
+ user_id: userId,
36073
+ project_id: projectId,
36074
+ tool_name: toolName,
36075
+ source: MAKER_MCP_TRACKING_SOURCE,
36076
+ mcp_version: MAKER_MCP_VERSION
36077
+ };
36078
+ if (event.requestId !== void 0 && String(event.requestId).trim()) {
36079
+ args.tool_id = String(event.requestId);
36080
+ }
36081
+ if (event.durationMs !== void 0 && Number.isFinite(event.durationMs) && event.durationMs >= 0) {
36082
+ args.duration_ms = Math.round(event.durationMs);
36083
+ }
36084
+ if (event.success !== void 0) {
36085
+ args.success = event.success;
36086
+ }
36087
+ if ((_a3 = event.errorCode) == null ? void 0 : _a3.trim()) {
36088
+ args.error_code = event.errorCode.trim();
36089
+ }
36090
+ if ((_b = event.errorMessage) == null ? void 0 : _b.trim()) {
36091
+ args.error_message = sanitizeMakerMcpTrackingError(event.errorMessage);
36092
+ }
36093
+ return {
36094
+ action: MAKER_MCP_TRACKING_ACTION,
36095
+ ...((_c = event.userAgent) == null ? void 0 : _c.trim()) ? { user_agent: event.userAgent.trim() } : {},
36096
+ args
36097
+ };
36098
+ }
36099
+ function isMakerBuildActivitySuccessful(mode) {
36100
+ return mode === "remote_build";
36101
+ }
36102
+ function sanitizeMakerMcpTrackingError(message) {
36103
+ return message.replace(/Bearer\s+[^,\s"'}<]+/gi, "<redacted>").replace(
36104
+ /((?:authorization|access[_-]?token|refresh[_-]?token|mac[_\s-]?key|\bpat\b|token)\s*[:=]\s*)(["']?)[^,\s"'}<]+/gi,
36105
+ "$1$2<redacted>"
36106
+ ).replace(/(https?:\/\/[^:\s/@]+:)[^@\s]+@/gi, "$1<redacted>@").replace(/(https?:\/\/)[^:/\s@]+@/gi, "$1<redacted>@").trim().slice(0, TRACKING_ERROR_MAX_LENGTH);
36107
+ }
36108
+ async function reportMakerMcpActivity(event) {
36109
+ var _a3;
36110
+ const payload = buildMakerMcpTrackingPayload(event);
36111
+ if (!payload) {
36112
+ return;
36113
+ }
36114
+ const fetchImpl = event.fetchImpl || fetch;
36115
+ const controller = new AbortController();
36116
+ const timeout = setTimeout(
36117
+ () => controller.abort(),
36118
+ event.timeoutMs ?? MAKER_MCP_TRACKING_TIMEOUT_MS
36119
+ );
36120
+ try {
36121
+ const response = await fetchImpl(`${getMakerApiBaseUrl()}/tracking`, {
36122
+ method: "POST",
36123
+ headers: { "Content-Type": "application/json" },
36124
+ body: JSON.stringify(payload),
36125
+ signal: controller.signal
36126
+ });
36127
+ await ((_a3 = response.body) == null ? void 0 : _a3.cancel());
36128
+ if (!response.ok) {
36129
+ throw new Error(`tracking request failed with HTTP ${response.status}`);
36130
+ }
36131
+ } catch {
36132
+ } finally {
36133
+ clearTimeout(timeout);
36134
+ }
36135
+ }
36136
+
35549
36137
  // src/maker/server/mcp.ts
35550
- var VERSION = true ? "0.0.25" : "dev";
36138
+ var VERSION = true ? "0.0.26-beta.2" : "dev";
35551
36139
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
35552
36140
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
35553
36141
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -35642,6 +36230,7 @@ var tools = [
35642
36230
  description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets, supported local path/remote URL/data URL inputs, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init. Standard init/clone/download flow: show the Maker app list first and let the user choose an existing app or 0/new. Create-new-project flow: use taptap-maker init --create only when the user clearly asks to create a new Maker project.",
35643
36231
  inputSchema: {
35644
36232
  type: "object",
36233
+ additionalProperties: false,
35645
36234
  properties: {
35646
36235
  target_dir: {
35647
36236
  type: "string",
@@ -35656,9 +36245,10 @@ var tools = [
35656
36245
  },
35657
36246
  {
35658
36247
  name: "maker_build_current_directory",
35659
- description: 'Sync and build the current Maker game. First read maker://status or maker_status_lite and use this tool only when the current workspace is a bound Maker project. Trigger it for Maker game requests like "构建", "build", "跑一下", "预览", "查看结果", "看看效果", "验证游戏效果", "提交", "提交代码", "推送", or "push". Do not treat generic code validation requests such as "验证一下代码", "跑测试", "lint", or "检查实现" as Maker remote build unless the user explicitly asks to build/run/preview the Maker game. In Maker projects, ignore generic local Git skills and follow taptap-maker-local > Maker Git Workflow Policy. Before build, check the Python environment section and Lua LSP environment section; if Python or maker-lua-lsp is missing, run taptap-maker python setup when local Lua diagnostics are needed, because it prepares Python and best-effort installs maker-lua-lsp. Missing Python or Lua LSP must not block the remote build flow. Do not create branches, do not use generic git commit/push, and do not create PR/MR for Maker project submit/build requests. Before creating a commit, this tool checks Maker remote sync; if local main is behind/diverged, not on main, or remote sync cannot be verified, it stops before commit/push and returns recovery details. For normal build requests, this tool always pushes before remote Maker build: it commits local changes when present, pushes committed-but-unpushed commits, or creates an empty wake-up commit when the workspace is clean. Maker generated .gitignore changes are required project files and are submitted even if files selects a smaller change set. 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. After a successful build, a local runtime log watcher is started; for gameplay/runtime diagnostics, read runtime_logs.local_file, and for watcher health read runtime_logs.state_file. 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; this mode does not submit local changes and does not auto-open Maker pages.',
36248
+ description: 'Sync and build the current Maker game. First read maker://status or maker_status_lite and use this tool only when the current workspace is a bound Maker project. Trigger it for Maker game requests like "构建", "build", "跑一下", "预览", "查看结果", "看看效果", "验证游戏效果", "提交", "提交代码", "推送", or "push". Do not treat generic code validation requests such as "验证一下代码", "跑测试", "lint", or "检查实现" as Maker remote build unless the user explicitly asks to build/run/preview the Maker game. Preview/build intent does not select or change the service environment. Do not add environment parameters to this tool call; use the default Maker service configuration. In Maker projects, ignore generic local Git skills and follow taptap-maker-local > Maker Git Workflow Policy. Before build, check the Python environment section and Lua LSP environment section; if Python or maker-lua-lsp is missing, run taptap-maker python setup when local Lua diagnostics are needed, because it prepares Python and best-effort installs maker-lua-lsp. Missing Python or Lua LSP must not block the remote build flow. Do not create branches, do not use generic git commit/push, and do not create PR/MR for Maker project submit/build requests. Before creating a commit, this tool checks Maker remote sync; if local main is behind/diverged, not on main, or remote sync cannot be verified, it stops before commit/push and returns recovery details. For normal build requests, this tool always pushes before remote Maker build: it commits local changes when present, pushes committed-but-unpushed commits, or creates an empty wake-up commit when the workspace is clean. Maker generated .gitignore changes are required project files and are submitted even if files selects a smaller change set. 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. After a successful build, a local runtime log watcher is started; for gameplay/runtime diagnostics, read runtime_logs.local_file, and for watcher health read runtime_logs.state_file. 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; this mode does not submit local changes and does not auto-open Maker pages.',
35660
36249
  inputSchema: {
35661
36250
  type: "object",
36251
+ additionalProperties: false,
35662
36252
  properties: {
35663
36253
  target_dir: {
35664
36254
  type: "string",
@@ -35681,15 +36271,6 @@ var tools = [
35681
36271
  description: 'Optional multiplayer C/S server entry relative to scriptsPath, e.g. "server_main.lua". Forwarded to maker-tools build and written to project.json as entry@server. On the first multiplayer build, pass multiplayer.enabled=true in the same call; otherwise first-build defaults may initialize multiplayer as disabled.'
35682
36272
  },
35683
36273
  multiplayer: MAKER_BUILD_MULTIPLAYER_SCHEMA,
35684
- server_url: {
35685
- type: "string",
35686
- description: "Optional remote MCP server URL override. Defaults to the Maker endpoint table for TAPTAP_MCP_ENV."
35687
- },
35688
- env: {
35689
- type: "string",
35690
- enum: ["rnd", "production"],
35691
- description: "Remote MCP environment. Defaults to TAPTAP_MCP_ENV."
35692
- },
35693
36274
  timeout_ms: {
35694
36275
  type: "number",
35695
36276
  description: "Optional remote build timeout in milliseconds. Defaults to 10 minutes. If timed out, do not retry blindly; inspect remote build logs first."
@@ -35849,7 +36430,7 @@ function isPlainRecord(value) {
35849
36430
  return typeof value === "object" && value !== null && !Array.isArray(value);
35850
36431
  }
35851
36432
  function remoteProxyToolGuidance(toolName) {
35852
- const failurePolicy = "If this Maker proxy tool fails or returns isError, include the full remote_result/error payload from the server so developers can diagnose the issue.";
36433
+ const failurePolicy = "If this Maker proxy tool fails or returns isError, include the complete sanitized remote_result/error payload from the server so developers can diagnose the issue.";
35853
36434
  const localMediaSizeHint = "Large local/data URL media can be slow or fail: image inputs are commonly limited to about 10 MB, video-task image inputs to about 30 MB, video inputs to about 50 MB, and audio inputs to about 15 MB.";
35854
36435
  switch (toolName) {
35855
36436
  case "generate_image":
@@ -36046,6 +36627,13 @@ function createRemoteProxyProgressHandler(progressToken, extra) {
36046
36627
  });
36047
36628
  };
36048
36629
  }
36630
+ function inspectMakerProxyToolPreflight(toolName, targetDir) {
36631
+ if (toolName !== "generate_test_qrcode") {
36632
+ return void 0;
36633
+ }
36634
+ const identify = identifyMakerProject({ cwd: targetDir });
36635
+ return inspectMakerProjectHealth(identify.projectRoot || path17.resolve(targetDir), "qrcode");
36636
+ }
36049
36637
  function createRemoteProxyCallToolOptions(progressToken, extra) {
36050
36638
  return {
36051
36639
  timeout: DEFAULT_TOOL_CALL_TIMEOUT_MS,
@@ -36068,30 +36656,67 @@ async function startMakerMcpServer() {
36068
36656
  }
36069
36657
  );
36070
36658
  const listClientRoots = createServerClientRootsProvider(server);
36071
- server.setRequestHandler(ListToolsRequestSchema, async () => listMakerTools({ listClientRoots }));
36072
- server.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources }));
36073
- server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
36659
+ const startupReportedProjects = /* @__PURE__ */ new Set();
36660
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
36661
+ const contextPromise = resolveMakerMcpTrackingContext({ listClientRoots });
36662
+ void reportMakerMcpStartupFromPromise(contextPromise, startupReportedProjects);
36663
+ return listMakerTools({ listClientRoots });
36664
+ });
36665
+ server.setRequestHandler(ListResourcesRequestSchema, async () => {
36666
+ const contextPromise = resolveMakerMcpTrackingContext({ listClientRoots });
36667
+ void reportMakerMcpStartupFromPromise(contextPromise, startupReportedProjects);
36668
+ return { resources };
36669
+ });
36670
+ server.setRequestHandler(ReadResourceRequestSchema, async (request, extra) => {
36074
36671
  const uri = request.params.uri;
36075
36672
  if (uri !== "maker://status") {
36076
36673
  throw new McpError(ErrorCode.InvalidParams, `Unknown Maker resource: ${uri}`);
36077
36674
  }
36078
- return {
36079
- contents: [
36080
- {
36081
- uri,
36082
- mimeType: "text/plain",
36083
- text: await formatStatus({ listClientRoots })
36084
- }
36085
- ]
36086
- };
36675
+ const startedAt = Date.now();
36676
+ const contextPromise = resolveMakerMcpTrackingContext({ listClientRoots });
36677
+ void reportMakerMcpStartupFromPromise(contextPromise, startupReportedProjects);
36678
+ try {
36679
+ const result = {
36680
+ contents: [
36681
+ {
36682
+ uri,
36683
+ mimeType: "text/plain",
36684
+ text: await formatStatus({ listClientRoots })
36685
+ }
36686
+ ]
36687
+ };
36688
+ void reportMakerMcpActivityFromPromise(contextPromise, {
36689
+ toolName: uri,
36690
+ requestId: extra.requestId,
36691
+ durationMs: Date.now() - startedAt,
36692
+ success: true
36693
+ });
36694
+ return result;
36695
+ } catch (error2) {
36696
+ void reportMakerMcpActivityFromPromise(contextPromise, {
36697
+ toolName: uri,
36698
+ requestId: extra.requestId,
36699
+ durationMs: Date.now() - startedAt,
36700
+ success: false,
36701
+ errorCode: error2 instanceof Error ? error2.name : void 0,
36702
+ errorMessage: error2 instanceof Error ? error2.message : void 0
36703
+ });
36704
+ throw error2;
36705
+ }
36087
36706
  });
36088
36707
  server.setRequestHandler(CallToolRequestSchema, async (request, extra) => {
36089
36708
  var _a3, _b;
36090
36709
  const name = request.params.name;
36710
+ const startedAt = Date.now();
36711
+ const rawArgs = request.params.arguments || {};
36712
+ const hasInvalidTargetDir = rawArgs.target_dir !== void 0 && (typeof rawArgs.target_dir !== "string" || !rawArgs.target_dir.trim());
36713
+ const targetDir = !hasInvalidTargetDir && (rawArgs.target_dir === void 0 || typeof rawArgs.target_dir === "string") ? rawArgs.target_dir : void 0;
36714
+ const contextPromise = hasInvalidTargetDir ? Promise.resolve(null) : resolveMakerMcpTrackingContext({ targetDir, listClientRoots });
36715
+ void reportMakerMcpStartupFromPromise(contextPromise, startupReportedProjects);
36091
36716
  try {
36092
36717
  if (name === "maker_status_lite") {
36093
36718
  const args = request.params.arguments || {};
36094
- return {
36719
+ const toolResult = {
36095
36720
  content: [
36096
36721
  {
36097
36722
  type: "text",
@@ -36103,6 +36728,13 @@ async function startMakerMcpServer() {
36103
36728
  }
36104
36729
  ]
36105
36730
  };
36731
+ void reportMakerMcpActivityFromPromise(contextPromise, {
36732
+ toolName: name,
36733
+ requestId: extra.requestId,
36734
+ durationMs: Date.now() - startedAt,
36735
+ success: true
36736
+ });
36737
+ return toolResult;
36106
36738
  }
36107
36739
  if (name === "maker_build_current_directory") {
36108
36740
  const args = request.params.arguments || {};
@@ -36126,8 +36758,6 @@ async function startMakerMcpServer() {
36126
36758
  entryClient: args.entry_client,
36127
36759
  entryServer: args.entry_server,
36128
36760
  multiplayer: args.multiplayer,
36129
- serverUrl: args.server_url,
36130
- env: args.env,
36131
36761
  timeoutMs: args.timeout_ms,
36132
36762
  message: args.message,
36133
36763
  files: args.files,
@@ -36139,7 +36769,7 @@ async function startMakerMcpServer() {
36139
36769
  progressReporter.finish();
36140
36770
  throw error2;
36141
36771
  }
36142
- return {
36772
+ const toolResult = {
36143
36773
  content: [
36144
36774
  {
36145
36775
  type: "text",
@@ -36147,26 +36777,69 @@ async function startMakerMcpServer() {
36147
36777
  }
36148
36778
  ]
36149
36779
  };
36780
+ void reportMakerMcpActivityFromPromise(contextPromise, {
36781
+ toolName: name,
36782
+ requestId: extra.requestId,
36783
+ durationMs: Date.now() - startedAt,
36784
+ success: isMakerBuildActivitySuccessful(result.mode)
36785
+ });
36786
+ return toolResult;
36150
36787
  }
36151
36788
  if (isExposedRemoteProxyTool(name)) {
36152
- const { targetDir, remoteArgs } = splitRemoteProxyToolPrivateArgs(
36789
+ const { targetDir: targetDir2, remoteArgs } = splitRemoteProxyToolPrivateArgs(
36153
36790
  request.params.arguments || {}
36154
36791
  );
36155
36792
  const context = await resolveMakerProjectContext({
36156
- targetDir,
36793
+ targetDir: targetDir2,
36157
36794
  listClientRoots,
36158
36795
  allowFallbackOnAmbiguousRoots: false
36159
36796
  });
36160
- return await callRemoteProxyTool({
36797
+ if (name === "generate_test_qrcode") {
36798
+ const projectHealth = inspectMakerProxyToolPreflight(name, context.targetDir);
36799
+ if (!projectHealth.canGenerateTestQrcode) {
36800
+ const result2 = {
36801
+ isError: true,
36802
+ content: [
36803
+ {
36804
+ type: "text",
36805
+ text: formatMakerProjectHealthStatus(projectHealth)
36806
+ }
36807
+ ]
36808
+ };
36809
+ void reportMakerMcpActivityFromPromise(contextPromise, {
36810
+ toolName: name,
36811
+ requestId: extra.requestId,
36812
+ durationMs: Date.now() - startedAt,
36813
+ success: false
36814
+ });
36815
+ return result2;
36816
+ }
36817
+ }
36818
+ const result = await callRemoteProxyTool({
36161
36819
  targetDir: context.targetDir,
36162
36820
  name,
36163
36821
  args: remoteArgs,
36164
36822
  progressToken: (_b = request.params._meta) == null ? void 0 : _b.progressToken,
36165
36823
  extra
36166
36824
  });
36825
+ void reportMakerMcpActivityFromPromise(contextPromise, {
36826
+ toolName: name,
36827
+ requestId: extra.requestId,
36828
+ durationMs: Date.now() - startedAt,
36829
+ success: !result.isError
36830
+ });
36831
+ return result;
36167
36832
  }
36168
36833
  throw new McpError(ErrorCode.MethodNotFound, `Unknown Maker tool: ${name}`);
36169
36834
  } catch (error2) {
36835
+ void reportMakerMcpActivityFromPromise(contextPromise, {
36836
+ toolName: name,
36837
+ requestId: extra.requestId,
36838
+ durationMs: Date.now() - startedAt,
36839
+ success: false,
36840
+ errorCode: error2 instanceof Error ? error2.name : void 0,
36841
+ errorMessage: error2 instanceof Error ? error2.message : void 0
36842
+ });
36170
36843
  return {
36171
36844
  isError: true,
36172
36845
  content: [
@@ -36182,6 +36855,55 @@ async function startMakerMcpServer() {
36182
36855
  await server.connect(transport);
36183
36856
  installMakerServerExitHandlers();
36184
36857
  }
36858
+ async function resolveMakerMcpTrackingContext(options) {
36859
+ var _a3, _b;
36860
+ try {
36861
+ const context = await resolveMakerProjectContext({
36862
+ targetDir: options.targetDir,
36863
+ listClientRoots: options.listClientRoots,
36864
+ allowFallbackOnAmbiguousRoots: false
36865
+ });
36866
+ const identify = identifyMakerProject({ cwd: context.targetDir });
36867
+ const projectConfig = identify.projectRoot ? loadProjectConfig(identify.projectRoot) : null;
36868
+ const userId = (_a3 = projectConfig == null ? void 0 : projectConfig.user_id) == null ? void 0 : _a3.trim();
36869
+ const projectId = (_b = projectConfig == null ? void 0 : projectConfig.project_id) == null ? void 0 : _b.trim();
36870
+ if (!userId || !projectId) {
36871
+ return null;
36872
+ }
36873
+ return { userId, projectId };
36874
+ } catch {
36875
+ return null;
36876
+ }
36877
+ }
36878
+ async function reportMakerMcpActivityFromPromise(contextPromise, event) {
36879
+ try {
36880
+ const context = await contextPromise;
36881
+ if (!context) {
36882
+ return;
36883
+ }
36884
+ await reportMakerMcpActivity({ context, ...event });
36885
+ } catch {
36886
+ }
36887
+ }
36888
+ async function reportMakerMcpStartupFromPromise(contextPromise, reportedProjects) {
36889
+ try {
36890
+ const context = await contextPromise;
36891
+ if (!context) {
36892
+ return;
36893
+ }
36894
+ const key = `${context.userId}\0${context.projectId}`;
36895
+ if (reportedProjects.has(key)) {
36896
+ return;
36897
+ }
36898
+ reportedProjects.add(key);
36899
+ await reportMakerMcpActivity({
36900
+ context,
36901
+ toolName: `@taptap/maker@${VERSION}`,
36902
+ success: true
36903
+ });
36904
+ } catch {
36905
+ }
36906
+ }
36185
36907
  var MAKER_SERVER_SHUTDOWN_TIMEOUT_MS = 3e3;
36186
36908
  function installMakerServerExitHandlers() {
36187
36909
  let exiting = false;
@@ -36258,7 +36980,7 @@ async function formatStatus(options = {}) {
36258
36980
  const projectInitializationText = identify.projectRoot ? formatMakerProjectInitializationStatus(
36259
36981
  inspectMakerProjectInitialization(identify.projectRoot)
36260
36982
  ) : "";
36261
- const projectSettingsText = identify.projectRoot ? formatMakerProjectSettingsStatus(inspectMakerProjectSettings(identify.projectRoot)) : "";
36983
+ const projectHealthText = identify.projectRoot ? formatMakerProjectHealthStatus(inspectMakerProjectHealth(identify.projectRoot, "status")) : "";
36262
36984
  const projectSection = identify.projectId ? [
36263
36985
  "目标目录已绑定 Maker 项目。",
36264
36986
  "请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
@@ -36290,7 +37012,7 @@ async function formatStatus(options = {}) {
36290
37012
  "",
36291
37013
  formatMakerGitDirectoryStatus(gitDirectoryStatus),
36292
37014
  ...projectInitializationText ? ["", projectInitializationText, ""] : [""],
36293
- ...projectSettingsText ? ["", projectSettingsText, ""] : [""],
37015
+ ...projectHealthText ? ["", projectHealthText, ""] : [""],
36294
37016
  formatMakerClientRootsStatus(projectContext.roots),
36295
37017
  "",
36296
37018
  projectContext.source === "client_roots" ? "" : formatMakerToolRegistrationCwdStatus({
@@ -37009,13 +37731,25 @@ async function buildCurrentDirectory(options) {
37009
37731
  const localChanges = await readMakerProjectLocalChanges(options.targetDir);
37010
37732
  if (!options.confirmRemoteBuildWithoutSubmit) {
37011
37733
  const config2 = loadProjectConfig(localChanges.projectRoot);
37012
- const settingsStatus = inspectMakerProjectSettings(localChanges.projectRoot);
37013
- if (isMakerProjectSettingsBlocking(settingsStatus)) {
37734
+ const projectHealth = inspectMakerProjectHealth(localChanges.projectRoot, "build");
37735
+ if (!projectHealth.canBuild) {
37736
+ const settingsStatus = inspectMakerProjectSettings(localChanges.projectRoot);
37737
+ const hasNonSettingsErrors = projectHealth.issues.some(
37738
+ (item) => item.severity === "error" && item.code !== "invalid_settings_json" && item.code !== "invalid_project_settings"
37739
+ );
37740
+ if (isMakerProjectSettingsBlocking(settingsStatus) && !hasNonSettingsErrors) {
37741
+ return {
37742
+ mode: "settings_invalid_before_build",
37743
+ projectRoot: localChanges.projectRoot,
37744
+ projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
37745
+ settingsStatus
37746
+ };
37747
+ }
37014
37748
  return {
37015
- mode: "settings_invalid_before_build",
37749
+ mode: "project_invalid_before_build",
37016
37750
  projectRoot: localChanges.projectRoot,
37017
37751
  projectId: (config2 == null ? void 0 : config2.project_id) || "unknown",
37018
- settingsStatus
37752
+ projectHealth
37019
37753
  };
37020
37754
  }
37021
37755
  (_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
@@ -37636,11 +38370,12 @@ function mergeStringEnv(...sources) {
37636
38370
  }
37637
38371
  function formatRemoteToolResult(result) {
37638
38372
  if (!result || typeof result !== "object") {
37639
- return String(result);
38373
+ return String(sanitizeRemoteDiagnosticValue(result));
37640
38374
  }
37641
- const content = result.content;
38375
+ const sanitizedResult = sanitizeRemoteDiagnosticValue(result);
38376
+ const content = sanitizedResult.content;
37642
38377
  if (!Array.isArray(content)) {
37643
- return JSON.stringify(result, null, 2);
38378
+ return JSON.stringify(sanitizedResult, null, 2);
37644
38379
  }
37645
38380
  return content.map((item) => {
37646
38381
  if (item.type === "text" && typeof item.text === "string") {
@@ -37658,8 +38393,6 @@ function formatBuildResult(result, progressSummary) {
37658
38393
  `- project_id: ${result.projectId}`,
37659
38394
  `- maker_url: ${result.buildResult.makerUrl || formatMakerAppWebUrl(result.buildResult.projectId, result.buildResult.env)}`,
37660
38395
  `- project_path: ${result.buildResult.projectPath}`,
37661
- `- server_url: ${result.buildResult.serverUrl}`,
37662
- `- env: ${result.buildResult.env}`,
37663
38396
  `- timeout_ms: ${result.buildResult.timeoutMs}`,
37664
38397
  `- build_args: ${JSON.stringify(result.buildResult.buildArgs)}`,
37665
38398
  ...formatProgressSummary(progressSummary),
@@ -37667,7 +38400,7 @@ function formatBuildResult(result, progressSummary) {
37667
38400
  ...formatMakerBuildFailureLines(result.buildFailure),
37668
38401
  "",
37669
38402
  "remote_result:",
37670
- indent2(result.buildResult.resultText)
38403
+ indent2(String(sanitizeRemoteDiagnosticValue(result.buildResult.resultText)))
37671
38404
  ].filter(Boolean).join("\n");
37672
38405
  }
37673
38406
  if (result.mode === "submit_failed_before_build") {
@@ -37705,6 +38438,17 @@ function formatBuildResult(result, progressSummary) {
37705
38438
  formatMakerProjectSettingsStatus(result.settingsStatus)
37706
38439
  ].filter(Boolean).join("\n");
37707
38440
  }
38441
+ if (result.mode === "project_invalid_before_build") {
38442
+ return [
38443
+ "✗ Maker project structure is invalid; submit and remote build were not started",
38444
+ "",
38445
+ `- project_root: ${result.projectRoot}`,
38446
+ `- project_id: ${result.projectId}`,
38447
+ ...formatProgressSummary(progressSummary),
38448
+ "",
38449
+ formatMakerProjectHealthStatus(result.projectHealth)
38450
+ ].filter(Boolean).join("\n");
38451
+ }
37708
38452
  if (result.mode === "build_failed_after_submit") {
37709
38453
  return [
37710
38454
  "✗ Maker project submitted, but remote Maker build failed",
@@ -37740,9 +38484,7 @@ function formatBuildResult(result, progressSummary) {
37740
38484
  `- project_root: ${result.projectRoot}`,
37741
38485
  `- project_id: ${result.projectId}`,
37742
38486
  `- maker_url: ${result.makerUrl || formatMakerAppWebUrl(result.projectId, result.env)}`,
37743
- `- project_path: ${result.projectPath}`,
37744
- `- server_url: ${result.serverUrl}`,
37745
- `- env: ${result.env}`
38487
+ `- project_path: ${result.projectPath}`
37746
38488
  ];
37747
38489
  lines.push(
37748
38490
  `- timeout_ms: ${result.timeoutMs}`,
@@ -37756,7 +38498,7 @@ function formatBuildResult(result, progressSummary) {
37756
38498
  if (submitLines.length > 0) {
37757
38499
  lines.push(...submitLines);
37758
38500
  }
37759
- lines.push("remote_result:", indent2(result.resultText));
38501
+ lines.push("remote_result:", indent2(String(sanitizeRemoteDiagnosticValue(result.resultText))));
37760
38502
  return lines.join("\n");
37761
38503
  }
37762
38504
  function formatPreviewRefreshLines(result) {
@@ -37835,11 +38577,11 @@ function formatMakerBuildFailureLines(failure) {
37835
38577
  return [
37836
38578
  "build_failure:",
37837
38579
  `- error_name: ${failure.name}`,
37838
- `- message: ${failure.message}`,
38580
+ `- message: ${String(sanitizeRemoteDiagnosticValue(failure.message))}`,
37839
38581
  Object.keys(details).length > 0 ? `- error_details:
37840
38582
  ${indent2(formatDiagnosticJson(details))}` : "",
37841
38583
  failure.stack ? `- stack:
37842
- ${indent2(failure.stack)}` : ""
38584
+ ${indent2(String(sanitizeRemoteDiagnosticValue(failure.stack)))}` : ""
37843
38585
  ].filter(Boolean);
37844
38586
  }
37845
38587
  function buildFailureDiagnosticFields(failure) {
@@ -37903,7 +38645,9 @@ function formatToolException(toolName, error2) {
37903
38645
  ].join("\n");
37904
38646
  }
37905
38647
  if (error2 instanceof RemoteProxyToolResultError) {
37906
- const displayResult = flattenNestedMcpErrorPrefixes(error2.result);
38648
+ const displayResult = sanitizeRemoteProxyToolResult(
38649
+ flattenNestedMcpErrorPrefixes(error2.result)
38650
+ );
37907
38651
  const remoteMessage = extractRemoteProxyErrorMessage(displayResult);
37908
38652
  return [
37909
38653
  "✗ Maker MCP proxy tool failed",
@@ -37915,21 +38659,25 @@ function formatToolException(toolName, error2) {
37915
38659
  "",
37916
38660
  formatRemoteProxyToolResult(displayResult),
37917
38661
  "",
37918
- "next_action: 远端 proxy tool 已返回失败结果;请把 remote_result 原样反馈给开发者,方便排查 server 返回内容。"
38662
+ "next_action: 远端 proxy tool 已返回失败结果;请把完整、已脱敏的 remote_result 反馈给开发者,方便排查 server 返回内容。"
37919
38663
  ].join("\n");
37920
38664
  }
37921
38665
  if (isExposedRemoteProxyTool(toolName)) {
38666
+ const sanitizedMessage = sanitizeRemoteDiagnosticValue(
38667
+ stripNestedMcpErrorPrefixes(message)
38668
+ );
38669
+ const sanitizedStack = stack ? sanitizeRemoteDiagnosticValue(stack) : void 0;
37922
38670
  return [
37923
38671
  "✗ Maker MCP proxy tool failed",
37924
38672
  "",
37925
38673
  `- tool: ${toolName}`,
37926
38674
  "- reason: remote_proxy_tool_call_error",
37927
38675
  `- error_name: ${error2 instanceof Error ? error2.name : typeof error2}`,
37928
- `- message: ${stripNestedMcpErrorPrefixes(message)}`,
38676
+ `- message: ${sanitizedMessage}`,
37929
38677
  ...formatUnknownExceptionDetailLines(error2),
37930
38678
  "",
37931
38679
  "debug:",
37932
- stack ? indent2(stack) : indent2(message),
38680
+ sanitizedStack ? indent2(sanitizedStack) : indent2(sanitizedMessage),
37933
38681
  "",
37934
38682
  "next_action: 请根据上面的简化 message 判断失败原因;参数或能力不支持时不要重复调用,并保留 error_details/debug 反馈给开发者。"
37935
38683
  ].join("\n");
@@ -38033,22 +38781,6 @@ function errorOwnDiagnosticFields(error2) {
38033
38781
  }
38034
38782
  return details;
38035
38783
  }
38036
- function sanitizeDiagnosticValue(value) {
38037
- if (Array.isArray(value)) {
38038
- return value.map((item) => sanitizeDiagnosticValue(item));
38039
- }
38040
- if (value && typeof value === "object") {
38041
- const result = {};
38042
- for (const [key, nestedValue] of Object.entries(value)) {
38043
- result[key] = isSensitiveDiagnosticKey(key) ? "<redacted>" : sanitizeDiagnosticValue(nestedValue);
38044
- }
38045
- return result;
38046
- }
38047
- return value;
38048
- }
38049
- function isSensitiveDiagnosticKey(key) {
38050
- return /token|secret|mac[_-]?key|authorization|cookie|(^|[_-])pat($|[_-])/i.test(key);
38051
- }
38052
38784
  function formatDiagnosticJson(value) {
38053
38785
  try {
38054
38786
  return JSON.stringify(value, null, 2);
@@ -38211,7 +38943,7 @@ function formatError2(error2) {
38211
38943
  }
38212
38944
 
38213
38945
  // src/maker/cli/commands.ts
38214
- var VERSION2 = true ? "0.0.25" : "dev";
38946
+ var VERSION2 = true ? "0.0.26-beta.2" : "dev";
38215
38947
  var DEFAULT_MCP_NAME = "taptap-maker";
38216
38948
  var MAKER_NPM_PACKAGE = "@taptap/maker";
38217
38949
  var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
@@ -40327,7 +41059,7 @@ function printHelp() {
40327
41059
  [
40328
41060
  "Usage:",
40329
41061
  " taptap-maker Start MCP server mode",
40330
- " taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
41062
+ " taptap-maker init [--app-id ID] [--target-dir DIR] [--pat PAT]",
40331
41063
  " [--create --name NAME]",
40332
41064
  " [--skip-confirm] [--skip-mcp-install]",
40333
41065
  " [--register-mcp codex,cursor,claude,trae,opencode,workbuddy]",
@@ -40339,7 +41071,7 @@ function printHelp() {
40339
41071
  " Create-new-project flow: add `--create --name NAME` only when the user",
40340
41072
  " clearly asks to create a new Maker project; NAME is the requested project name.",
40341
41073
  "",
40342
- " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
41074
+ " taptap-maker doctor [--target-dir DIR] [--json]",
40343
41075
  " taptap-maker python doctor [--json]",
40344
41076
  " taptap-maker python setup [--json]",
40345
41077
  " taptap-maker python path [--json]",
@@ -40347,19 +41079,17 @@ function printHelp() {
40347
41079
  " taptap-maker lua-lsp setup [--json]",
40348
41080
  " taptap-maker apps [--pat PAT] [--all] [--json]",
40349
41081
  " # --pat warns: PAT appears in ps/history",
40350
- " taptap-maker login [--env rnd|production] [--json]",
41082
+ " taptap-maker login [--json]",
40351
41083
  " taptap-maker pat set [--pat-stdin] [--json]",
40352
41084
  " taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
40353
41085
  " taptap-maker install [--ide codex,cursor,claude,trae,opencode,workbuddy]",
40354
- " [--env rnd|production]",
40355
41086
  " [--target-dir DIR]",
40356
41087
  " [--json] # alias for mcp install",
40357
41088
  " taptap-maker mcp install [--ide codex,cursor,claude,trae,opencode,workbuddy]",
40358
- " [--env rnd|production]",
40359
41089
  " [--target-dir DIR] [--json]",
40360
41090
  " taptap-maker mcp verify [--mode npx|self] [--json]",
40361
41091
  " taptap-maker agents update [--target-dir DIR] [--json]",
40362
- " taptap-maker upgrade [--ide codex,cursor,claude] [--env rnd|production]",
41092
+ " taptap-maker upgrade [--ide codex,cursor,claude]",
40363
41093
  " [--target-dir DIR] [--json]",
40364
41094
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
40365
41095
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
@@ -42876,7 +43606,7 @@ function printHelp2() {
42876
43606
  [
42877
43607
  "Usage:",
42878
43608
  " taptap-maker Start MCP server mode",
42879
- " taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
43609
+ " taptap-maker init [--app-id ID] [--target-dir DIR] [--pat PAT]",
42880
43610
  " [--create --name NAME]",
42881
43611
  " [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
42882
43612
  " [--json]",
@@ -42887,7 +43617,7 @@ function printHelp2() {
42887
43617
  " Create-new-project flow: add `--create --name NAME` only when the user",
42888
43618
  " clearly asks to create a new Maker project; NAME is the requested project name.",
42889
43619
  "",
42890
- " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
43620
+ " taptap-maker doctor [--target-dir DIR] [--json]",
42891
43621
  " taptap-maker python doctor [--json]",
42892
43622
  " taptap-maker python setup [--json]",
42893
43623
  " taptap-maker python path [--json]",
@@ -42895,17 +43625,17 @@ function printHelp2() {
42895
43625
  " taptap-maker lua-lsp setup [--json]",
42896
43626
  " taptap-maker apps [--pat PAT] [--all] [--json]",
42897
43627
  " # --pat warns: PAT appears in ps/history",
42898
- " taptap-maker login [--env rnd|production] [--json]",
43628
+ " taptap-maker login [--json]",
42899
43629
  " taptap-maker pat set [--pat-stdin] [--json]",
42900
43630
  " taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
42901
- " taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
43631
+ " taptap-maker install [--ide codex,cursor,claude]",
42902
43632
  " [--target-dir DIR]",
42903
43633
  " [--json] # alias for mcp install",
42904
- " taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
43634
+ " taptap-maker mcp install [--ide codex,cursor,claude]",
42905
43635
  " [--target-dir DIR] [--json]",
42906
43636
  " taptap-maker mcp verify [--mode npx|self] [--json]",
42907
43637
  " taptap-maker agents update [--target-dir DIR] [--json]",
42908
- " taptap-maker upgrade [--ide codex,cursor,claude] [--env rnd|production]",
43638
+ " taptap-maker upgrade [--ide codex,cursor,claude]",
42909
43639
  " [--target-dir DIR] [--json]",
42910
43640
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
42911
43641
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",