@taptap/maker 0.0.14 → 0.0.16

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
@@ -3233,8 +3233,8 @@ var require_utils = __commonJS({
3233
3233
  }
3234
3234
  return ind;
3235
3235
  }
3236
- function removeDotSegments(path16) {
3237
- let input2 = path16;
3236
+ function removeDotSegments(path17) {
3237
+ let input2 = path17;
3238
3238
  const output2 = [];
3239
3239
  let nextSlash = -1;
3240
3240
  let len = 0;
@@ -3433,8 +3433,8 @@ var require_schemes = __commonJS({
3433
3433
  wsComponent.secure = void 0;
3434
3434
  }
3435
3435
  if (wsComponent.resourceName) {
3436
- const [path16, query] = wsComponent.resourceName.split("?");
3437
- wsComponent.path = path16 && path16 !== "/" ? path16 : void 0;
3436
+ const [path17, query] = wsComponent.resourceName.split("?");
3437
+ wsComponent.path = path17 && path17 !== "/" ? path17 : 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, fs14, exportName) {
12494
+ function addFormats(ajv, list, fs15, exportName) {
12495
12495
  var _a3;
12496
12496
  var _b;
12497
12497
  (_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
12498
12498
  for (const f of list)
12499
- ajv.addFormat(f, fs14[f]);
12499
+ ajv.addFormat(f, fs15[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 fs14 = __require("fs");
12513
- function checkPathExt(path16, options) {
12512
+ var fs15 = __require("fs");
12513
+ function checkPathExt(path17, 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 && path16.substr(-p.length).toLowerCase() === p) {
12524
+ if (p && path17.substr(-p.length).toLowerCase() === p) {
12525
12525
  return true;
12526
12526
  }
12527
12527
  }
12528
12528
  return false;
12529
12529
  }
12530
- function checkStat(stat, path16, options) {
12530
+ function checkStat(stat, path17, options) {
12531
12531
  if (!stat.isSymbolicLink() && !stat.isFile()) {
12532
12532
  return false;
12533
12533
  }
12534
- return checkPathExt(path16, options);
12534
+ return checkPathExt(path17, options);
12535
12535
  }
12536
- function isexe(path16, options, cb) {
12537
- fs14.stat(path16, function(er, stat) {
12538
- cb(er, er ? false : checkStat(stat, path16, options));
12536
+ function isexe(path17, options, cb) {
12537
+ fs15.stat(path17, function(er, stat) {
12538
+ cb(er, er ? false : checkStat(stat, path17, options));
12539
12539
  });
12540
12540
  }
12541
- function sync(path16, options) {
12542
- return checkStat(fs14.statSync(path16), path16, options);
12541
+ function sync(path17, options) {
12542
+ return checkStat(fs15.statSync(path17), path17, 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 fs14 = __require("fs");
12553
- function isexe(path16, options, cb) {
12554
- fs14.stat(path16, function(er, stat) {
12552
+ var fs15 = __require("fs");
12553
+ function isexe(path17, options, cb) {
12554
+ fs15.stat(path17, function(er, stat) {
12555
12555
  cb(er, er ? false : checkStat(stat, options));
12556
12556
  });
12557
12557
  }
12558
- function sync(path16, options) {
12559
- return checkStat(fs14.statSync(path16), options);
12558
+ function sync(path17, options) {
12559
+ return checkStat(fs15.statSync(path17), 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 fs14 = __require("fs");
12583
+ var fs15 = __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(path16, options, cb) {
12592
+ function isexe(path17, 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(path16, options || {}, function(er, is) {
12602
+ isexe(path17, 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(path16, options || {}, function(er, is) {
12611
+ core(path17, 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(path16, options) {
12621
+ function sync(path17, options) {
12622
12622
  try {
12623
- return core.sync(path16, options || {});
12623
+ return core.sync(path17, 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 path16 = __require("path");
12639
+ var path17 = __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 = path16.join(pathPart, cmd);
12677
+ const pCmd = path17.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 = path16.join(pathPart, cmd);
12704
+ const pCmd = path17.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 path16 = __require("path");
12752
+ var path17 = __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 ? path16.delimiter : void 0
12770
+ pathExt: withoutPathExt ? path17.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 = path16.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12779
+ resolved = path17.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 [path16, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
- const binary = path16.split("/").pop();
12833
+ const [path17, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
+ const binary = path17.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 fs14 = __require("fs");
12847
+ var fs15 = __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 = fs14.openSync(command, "r");
12855
- fs14.readSync(fd, buffer, 0, size, 0);
12856
- fs14.closeSync(fd);
12854
+ fd = fs15.openSync(command, "r");
12855
+ fs15.readSync(fd, buffer, 0, size, 0);
12856
+ fs15.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 path16 = __require("path");
12869
+ var path17 = __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 = path16.normalize(parsed.command);
12894
+ parsed.command = path17.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 spawnSync8(command, args, options) {
12990
+ function spawnSync9(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,16 @@ var require_cross_spawn = __commonJS({
12995
12995
  }
12996
12996
  module.exports = spawn5;
12997
12997
  module.exports.spawn = spawn5;
12998
- module.exports.sync = spawnSync8;
12998
+ module.exports.sync = spawnSync9;
12999
12999
  module.exports._parse = parse3;
13000
13000
  module.exports._enoent = enoent;
13001
13001
  }
13002
13002
  });
13003
13003
 
13004
13004
  // src/maker/server/mcp.ts
13005
- import { execFileSync, spawn as spawn4, spawnSync as spawnSync5 } from "node:child_process";
13006
- import fs10 from "node:fs";
13007
- import path11 from "node:path";
13005
+ import { execFileSync, spawn as spawn4, spawnSync as spawnSync6 } from "node:child_process";
13006
+ import fs11 from "node:fs";
13007
+ import path12 from "node:path";
13008
13008
 
13009
13009
  // node_modules/zod/v3/helpers/util.js
13010
13010
  var util;
@@ -13365,8 +13365,8 @@ function getErrorMap() {
13365
13365
 
13366
13366
  // node_modules/zod/v3/helpers/parseUtil.js
13367
13367
  var makeIssue = (params) => {
13368
- const { data, path: path16, errorMaps, issueData } = params;
13369
- const fullPath = [...path16, ...issueData.path || []];
13368
+ const { data, path: path17, errorMaps, issueData } = params;
13369
+ const fullPath = [...path17, ...issueData.path || []];
13370
13370
  const fullIssue = {
13371
13371
  ...issueData,
13372
13372
  path: fullPath
@@ -13481,11 +13481,11 @@ var errorUtil;
13481
13481
 
13482
13482
  // node_modules/zod/v3/types.js
13483
13483
  var ParseInputLazyPath = class {
13484
- constructor(parent, value, path16, key) {
13484
+ constructor(parent, value, path17, key) {
13485
13485
  this._cachedPath = [];
13486
13486
  this.parent = parent;
13487
13487
  this.data = value;
13488
- this._path = path16;
13488
+ this._path = path17;
13489
13489
  this._key = key;
13490
13490
  }
13491
13491
  get path() {
@@ -17134,10 +17134,10 @@ function mergeDefs(...defs) {
17134
17134
  function cloneDef(schema) {
17135
17135
  return mergeDefs(schema._zod.def);
17136
17136
  }
17137
- function getElementAtPath(obj, path16) {
17138
- if (!path16)
17137
+ function getElementAtPath(obj, path17) {
17138
+ if (!path17)
17139
17139
  return obj;
17140
- return path16.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
17140
+ return path17.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
17141
17141
  }
17142
17142
  function promiseAllObject(promisesObj) {
17143
17143
  const keys = Object.keys(promisesObj);
@@ -17522,11 +17522,11 @@ function aborted(x, startIndex = 0) {
17522
17522
  }
17523
17523
  return false;
17524
17524
  }
17525
- function prefixIssues(path16, issues) {
17525
+ function prefixIssues(path17, issues) {
17526
17526
  return issues.map((iss) => {
17527
17527
  var _a3;
17528
17528
  (_a3 = iss).path ?? (_a3.path = []);
17529
- iss.path.unshift(path16);
17529
+ iss.path.unshift(path17);
17530
17530
  return iss;
17531
17531
  });
17532
17532
  }
@@ -31293,6 +31293,16 @@ function checkMakerPythonEnvironment(options = {}) {
31293
31293
  if (fallbackEnvironment) {
31294
31294
  return fallbackEnvironment;
31295
31295
  }
31296
+ if ((saved == null ? void 0 : saved.status) === "setup_failed") {
31297
+ return {
31298
+ ...base,
31299
+ ready: false,
31300
+ status: "setup_failed",
31301
+ missing: ["python"],
31302
+ error: saved.error,
31303
+ nextAction: "上次 Python 环境准备失败。请检查网络、代理或目录权限后重试 `taptap-maker python setup`;也可以自行安装 Python 3.12 并确保 pip 可用。"
31304
+ };
31305
+ }
31296
31306
  const status = sawWindowsStoreAlias ? "store_alias_only" : "missing";
31297
31307
  return {
31298
31308
  ...base,
@@ -31300,7 +31310,7 @@ function checkMakerPythonEnvironment(options = {}) {
31300
31310
  status,
31301
31311
  missing: ["python"],
31302
31312
  error: status === "store_alias_only" ? "Only Windows Store Python app execution aliases were found." : unsupportedSystemPython ? `Apple/Xcode Python was found at ${unsupportedSystemPython}, but Maker needs a private or user-managed Python toolchain for diagnostics.` : void 0,
31303
- nextAction: status === "store_alias_only" ? "检测到 Windows Store Python alias,但这不是真实 Python。请运行 `taptap-maker python setup` 自动准备 Maker 私有 Python。" : "未检测到可用 Python。请运行 `taptap-maker python setup` 自动准备 Maker 私有 Python。"
31313
+ nextAction: status === "store_alias_only" ? "检测到 Windows Store Python alias,但这不是真实 Python。请运行 `taptap-maker python setup` 准备 Python 环境。" : "未检测到可用 Python。请运行 `taptap-maker python setup` 准备 Python 环境。"
31304
31314
  };
31305
31315
  }
31306
31316
  function setupMakerPythonEnvironment(options = {}) {
@@ -31311,44 +31321,52 @@ function setupMakerPythonEnvironment(options = {}) {
31311
31321
  }
31312
31322
  const platform = options.platform || process.platform;
31313
31323
  const runner = options.spawn || spawnSync4;
31314
- const uvPath = ensureUvInstalled(platform, runner);
31315
- const uvEnv = createUvPythonEnv();
31316
- const install = runner(
31317
- uvPath,
31318
- ["python", "install", DEFAULT_PYTHON_VERSION, "--managed-python"],
31319
- {
31324
+ try {
31325
+ const uvPath = ensureUvInstalled(platform, runner);
31326
+ const uvEnv = createUvPythonEnv();
31327
+ const install = runner(
31328
+ uvPath,
31329
+ ["python", "install", DEFAULT_PYTHON_VERSION, "--managed-python"],
31330
+ {
31331
+ encoding: "utf8",
31332
+ env: uvEnv
31333
+ }
31334
+ );
31335
+ if (install.status !== 0) {
31336
+ throw new Error(formatSetupFailure("uv python install failed", install));
31337
+ }
31338
+ const find = runner(uvPath, ["python", "find", DEFAULT_PYTHON_VERSION], {
31320
31339
  encoding: "utf8",
31321
31340
  env: uvEnv
31341
+ });
31342
+ if (find.status !== 0 || !find.stdout.trim()) {
31343
+ throw new Error(formatSetupFailure("uv python find failed", find));
31344
+ }
31345
+ const python = find.stdout.trim().split(/\r?\n/)[0];
31346
+ const result = inspectPythonCandidate({ provider: "uv-managed", command: python }, runner);
31347
+ if (!(result == null ? void 0 : result.pipVersion)) {
31348
+ throw new Error("Python 3.12 was installed, but pip is not available.");
31349
+ }
31350
+ const environment = resultToEnvironment(result, {
31351
+ platform,
31352
+ configPath: getMakerPythonConfigPath(),
31353
+ setupCommand: "taptap-maker python setup",
31354
+ pathCommand: "taptap-maker python path",
31355
+ uv: {
31356
+ path: uvPath,
31357
+ installed: true,
31358
+ version: readUvVersion(uvPath, runner)
31359
+ }
31360
+ });
31361
+ savePythonRuntimeConfig(environment);
31362
+ return { changed: true, environment, uvInstalled: true };
31363
+ } catch (error2) {
31364
+ try {
31365
+ savePythonSetupFailure(error2);
31366
+ } catch {
31322
31367
  }
31323
- );
31324
- if (install.status !== 0) {
31325
- throw new Error(formatSetupFailure("uv python install failed", install));
31326
- }
31327
- const find = runner(uvPath, ["python", "find", DEFAULT_PYTHON_VERSION], {
31328
- encoding: "utf8",
31329
- env: uvEnv
31330
- });
31331
- if (find.status !== 0 || !find.stdout.trim()) {
31332
- throw new Error(formatSetupFailure("uv python find failed", find));
31333
- }
31334
- const python = find.stdout.trim().split(/\r?\n/)[0];
31335
- const result = inspectPythonCandidate({ provider: "uv-managed", command: python }, runner);
31336
- if (!(result == null ? void 0 : result.pipVersion)) {
31337
- throw new Error("uv managed Python was installed, but pip is not available.");
31368
+ throw error2;
31338
31369
  }
31339
- const environment = resultToEnvironment(result, {
31340
- platform,
31341
- configPath: getMakerPythonConfigPath(),
31342
- setupCommand: "taptap-maker python setup",
31343
- pathCommand: "taptap-maker python path",
31344
- uv: {
31345
- path: uvPath,
31346
- installed: true,
31347
- version: readUvVersion(uvPath, runner)
31348
- }
31349
- });
31350
- savePythonRuntimeConfig(environment);
31351
- return { changed: true, environment, uvInstalled: true };
31352
31370
  }
31353
31371
  function formatMakerPythonEnvironmentStatus(environment) {
31354
31372
  return [
@@ -31429,7 +31447,7 @@ function resultToEnvironment(result, base) {
31429
31447
  pipVersion: result.pipVersion,
31430
31448
  missing: [`python>=${MINIMUM_PYTHON_VERSION}`],
31431
31449
  error: `Python ${result.version} is below the minimum supported ${MINIMUM_PYTHON_VERSION}.`,
31432
- nextAction: `当前 Python 版本低于 Maker Lua 诊断最低要求 ${MINIMUM_PYTHON_VERSION}。请运行 \`taptap-maker python setup\` 自动准备 Maker 私有 Python ${DEFAULT_PYTHON_VERSION}。`
31450
+ nextAction: `当前 Python 版本低于 Maker Lua 诊断最低要求 ${MINIMUM_PYTHON_VERSION}。请运行 \`taptap-maker python setup\` 准备 Python ${DEFAULT_PYTHON_VERSION} 环境。`
31433
31451
  };
31434
31452
  }
31435
31453
  const ready = Boolean(result.pipVersion);
@@ -31444,7 +31462,7 @@ function resultToEnvironment(result, base) {
31444
31462
  pipVersion: result.pipVersion,
31445
31463
  missing: ready ? [] : ["pip"],
31446
31464
  warning: shouldRecommendUpgrade ? `Python ${RECOMMENDED_PYTHON_VERSION} or newer is recommended for Maker Lua diagnostics; current version is ${result.version}.` : void 0,
31447
- nextAction: ready ? shouldRecommendUpgrade ? `本地 Python 满足最低要求 ${MINIMUM_PYTHON_VERSION},但推荐使用 ${RECOMMENDED_PYTHON_VERSION} 或更新版本;如需统一环境,可运行 \`taptap-maker python setup\` 准备 Maker 私有 Python ${DEFAULT_PYTHON_VERSION}。` : "本地 Python 运行时可用;Maker Lua 诊断脚本可以复用该解释器。" : "检测到 Python,但 pip 不可用。请运行 `taptap-maker python setup` 自动准备 Maker 私有 Python。"
31465
+ nextAction: ready ? shouldRecommendUpgrade ? `本地 Python 满足最低要求 ${MINIMUM_PYTHON_VERSION},但推荐使用 ${RECOMMENDED_PYTHON_VERSION} 或更新版本;如需统一环境,可运行 \`taptap-maker python setup\` 准备 Python ${DEFAULT_PYTHON_VERSION} 环境。` : "本地 Python 运行时可用;Maker Lua 诊断脚本可以复用该解释器。" : "检测到 Python,但 pip 不可用。请运行 `taptap-maker python setup` 准备 Python 环境。"
31448
31466
  };
31449
31467
  }
31450
31468
  function ensureUvInstalled(platform, runner) {
@@ -31554,7 +31572,10 @@ function loadPythonRuntimeConfig() {
31554
31572
  }
31555
31573
  try {
31556
31574
  const data = JSON.parse(fs6.readFileSync(configPath, "utf8"));
31557
- return typeof data.python === "string" ? data : void 0;
31575
+ if (typeof data.python === "string" || data.status === "setup_failed") {
31576
+ return data;
31577
+ }
31578
+ return void 0;
31558
31579
  } catch {
31559
31580
  return void 0;
31560
31581
  }
@@ -31572,6 +31593,15 @@ function savePythonRuntimeConfig(environment) {
31572
31593
  fs6.mkdirSync(path7.dirname(getMakerPythonConfigPath()), { recursive: true });
31573
31594
  fs6.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31574
31595
  }
31596
+ function savePythonSetupFailure(error2) {
31597
+ const config2 = {
31598
+ status: "setup_failed",
31599
+ error: error2 instanceof Error ? error2.message : String(error2),
31600
+ saved_at: (/* @__PURE__ */ new Date()).toISOString()
31601
+ };
31602
+ fs6.mkdirSync(path7.dirname(getMakerPythonConfigPath()), { recursive: true });
31603
+ fs6.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31604
+ }
31575
31605
  function formatSetupFailure(message, result) {
31576
31606
  var _a3, _b, _c;
31577
31607
  return [
@@ -31583,9 +31613,253 @@ function formatSetupFailure(message, result) {
31583
31613
  ].filter(Boolean).join("\n");
31584
31614
  }
31585
31615
 
31586
- // src/maker/cli/skill.ts
31616
+ // src/maker/system/luaLsp.ts
31617
+ import { spawnSync as spawnSync5 } from "node:child_process";
31587
31618
  import fs7 from "node:fs";
31588
31619
  import path8 from "node:path";
31620
+ var LUA_LSP_PACKAGE = "maker-lua-lsp";
31621
+ var LUA_LSP_IDES = "codex,cursor,claude";
31622
+ var LUA_LSP_SETUP_TIMEOUT_MS = 12e4;
31623
+ var PYTHON_SCRIPTS_DIR_SCRIPT = [
31624
+ "import sysconfig",
31625
+ 'print(sysconfig.get_path("scripts") or "")'
31626
+ ].join("; ");
31627
+ function getMakerLuaLspConfigPath() {
31628
+ return path8.join(getMakerHome(), "lua-lsp.json");
31629
+ }
31630
+ function checkMakerLuaLspEnvironment(options = {}) {
31631
+ const runner = options.spawn || spawnSync5;
31632
+ const python = options.pythonEnvironment || checkMakerPythonEnvironment(options);
31633
+ const platform = options.platform || python.platform || process.platform;
31634
+ const base = createLuaLspBase(platform);
31635
+ if (!python.ready || !python.python) {
31636
+ return {
31637
+ ...base,
31638
+ ready: false,
31639
+ status: "python_missing",
31640
+ missing: ["python"],
31641
+ error: python.error,
31642
+ nextAction: "本地 Lua 诊断需要 Python 环境。请先运行 `taptap-maker python setup`,它会继续准备 maker-lua-lsp。"
31643
+ };
31644
+ }
31645
+ const resolved = resolveLuaLspCommand(python, platform, runner);
31646
+ const command = resolved.command || LUA_LSP_PACKAGE;
31647
+ const version2 = readLuaLspVersion(command, runner);
31648
+ if (version2) {
31649
+ return {
31650
+ ...base,
31651
+ ready: true,
31652
+ status: "ready",
31653
+ command,
31654
+ version: version2,
31655
+ python: python.python,
31656
+ scriptsDir: resolved.scriptsDir,
31657
+ missing: [],
31658
+ nextAction: "maker-lua-lsp 已安装;本地 Lua 诊断可用。"
31659
+ };
31660
+ }
31661
+ const saved = loadLuaLspRuntimeConfig();
31662
+ if ((saved == null ? void 0 : saved.status) === "setup_failed") {
31663
+ return {
31664
+ ...base,
31665
+ ready: false,
31666
+ status: "setup_failed",
31667
+ command: saved.command || resolved.command,
31668
+ python: python.python,
31669
+ scriptsDir: resolved.scriptsDir,
31670
+ missing: [LUA_LSP_PACKAGE],
31671
+ error: saved.error,
31672
+ nextAction: "上次 maker-lua-lsp 安装失败。请查看错误后重试 `taptap-maker lua-lsp setup`;失败不会阻塞远端构建。"
31673
+ };
31674
+ }
31675
+ return {
31676
+ ...base,
31677
+ ready: false,
31678
+ status: "missing",
31679
+ command: resolved.command,
31680
+ python: python.python,
31681
+ scriptsDir: resolved.scriptsDir,
31682
+ missing: [LUA_LSP_PACKAGE],
31683
+ nextAction: "未检测到 maker-lua-lsp。请运行 `taptap-maker lua-lsp setup`,或运行 `taptap-maker python setup` 自动准备完整本地 Lua 诊断环境。"
31684
+ };
31685
+ }
31686
+ function setupMakerLuaLspEnvironment(options = {}) {
31687
+ const runner = options.spawn || spawnSync5;
31688
+ const python = options.pythonEnvironment || ensurePythonForLuaLsp(options);
31689
+ const platform = options.platform || python.platform || process.platform;
31690
+ if (!python.ready || !python.python) {
31691
+ const environment2 = {
31692
+ ...createLuaLspBase(platform),
31693
+ ready: false,
31694
+ status: "python_missing",
31695
+ python: python.python,
31696
+ missing: ["python"],
31697
+ error: python.error,
31698
+ nextAction: "maker-lua-lsp 安装需要 Python >= 3.8 和 pip。请先运行 `taptap-maker python setup`。"
31699
+ };
31700
+ saveLuaLspRuntimeConfig(environment2);
31701
+ return { changed: false, environment: environment2, python };
31702
+ }
31703
+ const pipInstall = runner(python.python, ["-m", "pip", "install", "--upgrade", LUA_LSP_PACKAGE], {
31704
+ encoding: "utf8",
31705
+ timeout: LUA_LSP_SETUP_TIMEOUT_MS
31706
+ });
31707
+ if (pipInstall.status !== 0) {
31708
+ const environment2 = formatLuaLspSetupFailure(
31709
+ platform,
31710
+ python,
31711
+ "maker-lua-lsp pip install failed",
31712
+ pipInstall
31713
+ );
31714
+ saveLuaLspRuntimeConfig(environment2);
31715
+ return { changed: false, environment: environment2, python };
31716
+ }
31717
+ const resolved = resolveLuaLspCommand(python, platform, runner);
31718
+ const command = resolved.command || LUA_LSP_PACKAGE;
31719
+ const ideInstall = runner(command, ["install", "--ide", LUA_LSP_IDES], {
31720
+ encoding: "utf8",
31721
+ timeout: LUA_LSP_SETUP_TIMEOUT_MS
31722
+ });
31723
+ if (ideInstall.status !== 0) {
31724
+ const environment2 = formatLuaLspSetupFailure(
31725
+ platform,
31726
+ python,
31727
+ "maker-lua-lsp IDE install failed",
31728
+ ideInstall,
31729
+ command,
31730
+ resolved.scriptsDir
31731
+ );
31732
+ saveLuaLspRuntimeConfig(environment2);
31733
+ return { changed: false, environment: environment2, python };
31734
+ }
31735
+ const environment = {
31736
+ ...createLuaLspBase(platform),
31737
+ ready: true,
31738
+ status: "ready",
31739
+ command,
31740
+ version: readLuaLspVersion(command, runner),
31741
+ python: python.python,
31742
+ scriptsDir: resolved.scriptsDir,
31743
+ missing: [],
31744
+ nextAction: "maker-lua-lsp 已安装并完成 Codex/Cursor/Claude 配置。"
31745
+ };
31746
+ saveLuaLspRuntimeConfig(environment);
31747
+ return { changed: true, environment, python };
31748
+ }
31749
+ function formatMakerLuaLspEnvironmentStatus(environment) {
31750
+ return [
31751
+ "Lua LSP environment",
31752
+ "",
31753
+ `- lsp_status: ${environment.status}`,
31754
+ `- ready: ${environment.ready ? "yes" : "no"}`,
31755
+ environment.command ? `- command: ${environment.command}` : "",
31756
+ environment.version ? `- version: ${environment.version}` : "",
31757
+ environment.python ? `- python: ${environment.python}` : "",
31758
+ environment.scriptsDir ? `- scripts_dir: ${environment.scriptsDir}` : "",
31759
+ `- config: ${environment.configPath}`,
31760
+ `- missing: ${environment.missing.join(", ") || "(none)"}`,
31761
+ environment.error ? `- error: ${environment.error}` : "",
31762
+ `- install_command: ${environment.installCommand}`,
31763
+ `- setup_command: ${environment.setupCommand}`,
31764
+ `- doctor_command: ${environment.doctorCommand}`,
31765
+ `- next_action: ${environment.nextAction}`
31766
+ ].filter(Boolean).join("\n");
31767
+ }
31768
+ function ensurePythonForLuaLsp(options) {
31769
+ const current = checkMakerPythonEnvironment(options);
31770
+ if (current.ready) {
31771
+ return current;
31772
+ }
31773
+ try {
31774
+ return setupMakerPythonEnvironment(options).environment;
31775
+ } catch (error2) {
31776
+ return {
31777
+ ...current,
31778
+ status: "setup_failed",
31779
+ error: error2 instanceof Error ? error2.message : String(error2)
31780
+ };
31781
+ }
31782
+ }
31783
+ function createLuaLspBase(platform) {
31784
+ return {
31785
+ platform,
31786
+ configPath: getMakerLuaLspConfigPath(),
31787
+ setupCommand: "taptap-maker lua-lsp setup",
31788
+ doctorCommand: "taptap-maker lua-lsp doctor",
31789
+ installCommand: `${LUA_LSP_PACKAGE} install --ide ${LUA_LSP_IDES}`
31790
+ };
31791
+ }
31792
+ function resolveLuaLspCommand(python, platform, runner) {
31793
+ const scriptsDir = readPythonScriptsDir(python.python, runner);
31794
+ if (scriptsDir) {
31795
+ const command = path8.join(
31796
+ scriptsDir,
31797
+ platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
31798
+ );
31799
+ if (fs7.existsSync(command)) {
31800
+ return { command, scriptsDir };
31801
+ }
31802
+ return { scriptsDir };
31803
+ }
31804
+ return {};
31805
+ }
31806
+ function readPythonScriptsDir(python, runner) {
31807
+ if (!python) {
31808
+ return void 0;
31809
+ }
31810
+ const result = runner(python, ["-c", PYTHON_SCRIPTS_DIR_SCRIPT], { encoding: "utf8" });
31811
+ return result.status === 0 ? result.stdout.trim().split(/\r?\n/)[0] || void 0 : void 0;
31812
+ }
31813
+ function readLuaLspVersion(command, runner) {
31814
+ const result = runner(command, ["--version"], { encoding: "utf8" });
31815
+ return result.status === 0 ? result.stdout.trim() || "installed" : void 0;
31816
+ }
31817
+ function formatLuaLspSetupFailure(platform, python, message, result, command, scriptsDir) {
31818
+ var _a3, _b, _c;
31819
+ return {
31820
+ ...createLuaLspBase(platform),
31821
+ ready: false,
31822
+ status: "setup_failed",
31823
+ command,
31824
+ python: python.python,
31825
+ scriptsDir,
31826
+ missing: [LUA_LSP_PACKAGE],
31827
+ error: [
31828
+ message,
31829
+ `- status: ${result.status ?? "(none)"}`,
31830
+ ((_a3 = result.error) == null ? void 0 : _a3.message) ? `- error: ${result.error.message}` : "",
31831
+ ((_b = result.stderr) == null ? void 0 : _b.trim()) ? `- stderr: ${result.stderr.trim()}` : "",
31832
+ ((_c = result.stdout) == null ? void 0 : _c.trim()) ? `- stdout: ${result.stdout.trim()}` : ""
31833
+ ].filter(Boolean).join("\n"),
31834
+ nextAction: "maker-lua-lsp 安装失败,但不会阻塞远端构建。请检查网络、pip、权限或脚本输出后重试 `taptap-maker lua-lsp setup`。"
31835
+ };
31836
+ }
31837
+ function loadLuaLspRuntimeConfig() {
31838
+ const configPath = getMakerLuaLspConfigPath();
31839
+ if (!fs7.existsSync(configPath)) {
31840
+ return void 0;
31841
+ }
31842
+ try {
31843
+ return JSON.parse(fs7.readFileSync(configPath, "utf8"));
31844
+ } catch {
31845
+ return void 0;
31846
+ }
31847
+ }
31848
+ function saveLuaLspRuntimeConfig(environment) {
31849
+ const config2 = {
31850
+ status: environment.status,
31851
+ command: environment.command,
31852
+ python: environment.python,
31853
+ error: environment.error,
31854
+ saved_at: (/* @__PURE__ */ new Date()).toISOString()
31855
+ };
31856
+ fs7.mkdirSync(path8.dirname(getMakerLuaLspConfigPath()), { recursive: true });
31857
+ fs7.writeFileSync(getMakerLuaLspConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31858
+ }
31859
+
31860
+ // src/maker/cli/skill.ts
31861
+ import fs8 from "node:fs";
31862
+ import path9 from "node:path";
31589
31863
  import { fileURLToPath } from "node:url";
31590
31864
  var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
31591
31865
  var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
@@ -31604,7 +31878,7 @@ var BUNDLED_SKILLS = [
31604
31878
  function formatMakerSkillStatus(_options = {}) {
31605
31879
  const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
31606
31880
  name: skill.name,
31607
- path: path8.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
31881
+ path: path9.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
31608
31882
  }));
31609
31883
  return [
31610
31884
  "TapTap Maker workflow guide documents",
@@ -31637,11 +31911,11 @@ function formatMakerSkillStatus(_options = {}) {
31637
31911
  }
31638
31912
  function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
31639
31913
  const candidates = [
31640
- path8.join(process.cwd(), "skills", skillName),
31914
+ path9.join(process.cwd(), "skills", skillName),
31641
31915
  getBundledSkillSourceDir(skillName)
31642
31916
  ].filter(Boolean);
31643
31917
  for (const candidate of candidates) {
31644
- if (fs7.existsSync(path8.join(candidate, "SKILL.md"))) {
31918
+ if (fs8.existsSync(path9.join(candidate, "SKILL.md"))) {
31645
31919
  return candidate;
31646
31920
  }
31647
31921
  }
@@ -31654,13 +31928,13 @@ function getBundledSkillSourceDir(skillName) {
31654
31928
  return null;
31655
31929
  }
31656
31930
  const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
31657
- const packageRoot = path8.dirname(path8.dirname(bundlePath));
31658
- return path8.join(packageRoot, "skills", skillName);
31931
+ const packageRoot = path9.dirname(path9.dirname(bundlePath));
31932
+ return path9.join(packageRoot, "skills", skillName);
31659
31933
  }
31660
31934
 
31661
31935
  // src/maker/server/runtimeLogs.ts
31662
- import fs8 from "node:fs";
31663
- import path9 from "node:path";
31936
+ import fs9 from "node:fs";
31937
+ import path10 from "node:path";
31664
31938
  var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
31665
31939
  var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
31666
31940
  var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
@@ -31801,19 +32075,19 @@ async function pullRuntimeLogs(options) {
31801
32075
  }
31802
32076
  function resetRuntimeLogs(projectRoot) {
31803
32077
  const runtimeDir = getRuntimeLogDir(projectRoot);
31804
- fs8.mkdirSync(runtimeDir, { recursive: true });
32078
+ fs9.mkdirSync(runtimeDir, { recursive: true });
31805
32079
  for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
31806
- fs8.rmSync(path9.join(runtimeDir, file2), { force: true });
32080
+ fs9.rmSync(path10.join(runtimeDir, file2), { force: true });
31807
32081
  }
31808
32082
  return runtimeDir;
31809
32083
  }
31810
32084
  function readRuntimeLogState(projectRoot) {
31811
32085
  const statePath = getRuntimeLogStatePath(projectRoot);
31812
- if (!fs8.existsSync(statePath)) {
32086
+ if (!fs9.existsSync(statePath)) {
31813
32087
  return null;
31814
32088
  }
31815
32089
  try {
31816
- const state = JSON.parse(fs8.readFileSync(statePath, "utf8"));
32090
+ const state = JSON.parse(fs9.readFileSync(statePath, "utf8"));
31817
32091
  return isRuntimeLogState(state) ? state : null;
31818
32092
  } catch {
31819
32093
  return null;
@@ -31841,9 +32115,9 @@ function normalizeRuntimeLogQueryResult(result) {
31841
32115
  };
31842
32116
  }
31843
32117
  function writeRuntimeLogRawResponse(projectRoot, raw) {
31844
- const rawPath = path9.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
31845
- fs8.mkdirSync(path9.dirname(rawPath), { recursive: true });
31846
- fs8.writeFileSync(
32118
+ const rawPath = path10.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
32119
+ fs9.mkdirSync(path10.dirname(rawPath), { recursive: true });
32120
+ fs9.writeFileSync(
31847
32121
  rawPath,
31848
32122
  `${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
31849
32123
  `,
@@ -31852,7 +32126,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
31852
32126
  return rawPath;
31853
32127
  }
31854
32128
  function appendRuntimeLogs(projectRoot, logs) {
31855
- fs8.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
32129
+ fs9.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
31856
32130
  if (logs.length === 0) {
31857
32131
  return { files: [], written: 0 };
31858
32132
  }
@@ -31860,7 +32134,7 @@ function appendRuntimeLogs(projectRoot, logs) {
31860
32134
  let written = 0;
31861
32135
  for (const log of logs) {
31862
32136
  const line = JSON.stringify(compactRuntimeLogEntry(log));
31863
- fs8.appendFileSync(filePath, `${line}
32137
+ fs9.appendFileSync(filePath, `${line}
31864
32138
  `, "utf8");
31865
32139
  written += 1;
31866
32140
  }
@@ -31868,11 +32142,11 @@ function appendRuntimeLogs(projectRoot, logs) {
31868
32142
  }
31869
32143
  function writeRuntimeLogState(projectRoot, state) {
31870
32144
  const statePath = getRuntimeLogStatePath(projectRoot);
31871
- fs8.mkdirSync(path9.dirname(statePath), { recursive: true });
32145
+ fs9.mkdirSync(path10.dirname(statePath), { recursive: true });
31872
32146
  const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
31873
- fs8.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
32147
+ fs9.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
31874
32148
  `, "utf8");
31875
- fs8.renameSync(tempPath, statePath);
32149
+ fs9.renameSync(tempPath, statePath);
31876
32150
  }
31877
32151
  function writeRuntimeLogFailureState(projectRoot, options) {
31878
32152
  const nowIso = new Date(options.nowMs()).toISOString();
@@ -31904,13 +32178,13 @@ function isNonRetryableRuntimeLogError(error2) {
31904
32178
  );
31905
32179
  }
31906
32180
  function getRuntimeLogDir(projectRoot) {
31907
- return path9.join(projectRoot, ".maker", "logs", "runtime");
32181
+ return path10.join(projectRoot, ".maker", "logs", "runtime");
31908
32182
  }
31909
32183
  function getRuntimeLogStatePath(projectRoot) {
31910
- return path9.join(getRuntimeLogDir(projectRoot), "state.json");
32184
+ return path10.join(getRuntimeLogDir(projectRoot), "state.json");
31911
32185
  }
31912
32186
  function getRuntimeLogPath(projectRoot) {
31913
- return path9.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
32187
+ return path10.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
31914
32188
  }
31915
32189
  function resolveNextRuntimeLogCursor(result) {
31916
32190
  const maxLogTime = result.logs.reduce((max, log) => {
@@ -32035,8 +32309,8 @@ function compactRuntimeLogEntry(entry) {
32035
32309
  }
32036
32310
 
32037
32311
  // src/maker/server/proxyAssets.ts
32038
- import fs9 from "node:fs";
32039
- import path10 from "node:path";
32312
+ import fs10 from "node:fs";
32313
+ import path11 from "node:path";
32040
32314
  var IMAGE_ASSET_DIRS = ["assets/image"];
32041
32315
  var VIDEO_ASSET_DIRS = ["assets/video"];
32042
32316
  var AUDIO_ASSET_DIRS = ["assets/audio"];
@@ -32280,8 +32554,8 @@ async function materializeAsset(options) {
32280
32554
  };
32281
32555
  }
32282
32556
  const bytes = Buffer.from(await response.arrayBuffer());
32283
- fs9.mkdirSync(path10.dirname(absolutePath), { recursive: true });
32284
- fs9.writeFileSync(absolutePath, bytes);
32557
+ fs10.mkdirSync(path11.dirname(absolutePath), { recursive: true });
32558
+ fs10.writeFileSync(absolutePath, bytes);
32285
32559
  return { localPath: relativePath, absolutePath, download: { success: true } };
32286
32560
  } catch (error2) {
32287
32561
  return {
@@ -32295,12 +32569,12 @@ async function materializeAsset(options) {
32295
32569
  function createUniqueAssetPath(options) {
32296
32570
  const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
32297
32571
  for (let index = 1; index <= 9999; index += 1) {
32298
- const relativePath = path10.posix.join(
32572
+ const relativePath = path11.posix.join(
32299
32573
  options.relativeDir,
32300
32574
  `${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
32301
32575
  );
32302
- const absolutePath = path10.join(options.targetDir, ...relativePath.split("/"));
32303
- if (!fs9.existsSync(absolutePath)) {
32576
+ const absolutePath = path11.join(options.targetDir, ...relativePath.split("/"));
32577
+ if (!fs10.existsSync(absolutePath)) {
32304
32578
  return { relativePath, absolutePath };
32305
32579
  }
32306
32580
  }
@@ -32383,7 +32657,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
32383
32657
  if (!isKnownAssetPath(localPath, assetDirs)) {
32384
32658
  return false;
32385
32659
  }
32386
- const basename = path10.posix.basename(localPath);
32660
+ const basename = path11.posix.basename(localPath);
32387
32661
  const stem = basename.replace(/\.[^.]+$/, "");
32388
32662
  return basename === value || stem === value || record2.name === value || record2.taskId === value;
32389
32663
  });
@@ -32396,13 +32670,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
32396
32670
  }
32397
32671
  function findLocalAssetByName(targetDir, value, assetDirs) {
32398
32672
  var _a3;
32399
- const hasExtension = Boolean(path10.extname(value));
32673
+ const hasExtension = Boolean(path11.extname(value));
32400
32674
  const candidates = [];
32401
32675
  for (const assetDir of assetDirs) {
32402
- const absoluteDir = path10.join(targetDir, ...assetDir.split("/"));
32676
+ const absoluteDir = path11.join(targetDir, ...assetDir.split("/"));
32403
32677
  let entries;
32404
32678
  try {
32405
- entries = fs9.readdirSync(absoluteDir);
32679
+ entries = fs10.readdirSync(absoluteDir);
32406
32680
  } catch {
32407
32681
  continue;
32408
32682
  }
@@ -32411,11 +32685,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
32411
32685
  if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
32412
32686
  continue;
32413
32687
  }
32414
- const absolutePath = path10.join(absoluteDir, entry);
32688
+ const absolutePath = path11.join(absoluteDir, entry);
32415
32689
  try {
32416
32690
  candidates.push({
32417
- localPath: path10.posix.join(assetDir, entry),
32418
- mtimeMs: fs9.statSync(absolutePath).mtimeMs
32691
+ localPath: path11.posix.join(assetDir, entry),
32692
+ mtimeMs: fs10.statSync(absolutePath).mtimeMs
32419
32693
  });
32420
32694
  } catch {
32421
32695
  }
@@ -32425,7 +32699,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
32425
32699
  return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
32426
32700
  }
32427
32701
  function isKnownAssetPath(relativePath, assetDirs) {
32428
- if (relativePath.startsWith("../") || path10.isAbsolute(relativePath)) {
32702
+ if (relativePath.startsWith("../") || path11.isAbsolute(relativePath)) {
32429
32703
  return false;
32430
32704
  }
32431
32705
  return assetDirs.some(
@@ -32439,31 +32713,31 @@ function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
32439
32713
  const registry2 = readGeneratedAssetRegistry(targetDir);
32440
32714
  registry2[localPath] = record2;
32441
32715
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
32442
- fs9.mkdirSync(path10.dirname(registryPath), { recursive: true });
32443
- fs9.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
32716
+ fs10.mkdirSync(path11.dirname(registryPath), { recursive: true });
32717
+ fs10.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
32444
32718
  `, "utf8");
32445
32719
  }
32446
32720
  function readGeneratedAssetRegistry(targetDir) {
32447
32721
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
32448
- if (!fs9.existsSync(registryPath)) {
32722
+ if (!fs10.existsSync(registryPath)) {
32449
32723
  return {};
32450
32724
  }
32451
32725
  try {
32452
- const parsed = JSON.parse(fs9.readFileSync(registryPath, "utf8"));
32726
+ const parsed = JSON.parse(fs10.readFileSync(registryPath, "utf8"));
32453
32727
  return isRecord(parsed) ? parsed : {};
32454
32728
  } catch {
32455
32729
  return {};
32456
32730
  }
32457
32731
  }
32458
32732
  function getGeneratedAssetRegistryPath(targetDir) {
32459
- return path10.join(targetDir, ".maker", "assets", "generated-assets.json");
32733
+ return path11.join(targetDir, ".maker", "assets", "generated-assets.json");
32460
32734
  }
32461
32735
  function normalizeAssetRegistryKey(targetDir, value) {
32462
32736
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
32463
32737
  return void 0;
32464
32738
  }
32465
- const relative = path10.isAbsolute(value) ? path10.relative(targetDir, value) : value;
32466
- return relative.split(path10.sep).join("/");
32739
+ const relative = path11.isAbsolute(value) ? path11.relative(targetDir, value) : value;
32740
+ return relative.split(path11.sep).join("/");
32467
32741
  }
32468
32742
  function isRecord(value) {
32469
32743
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -32492,7 +32766,7 @@ function extensionFromUrl(url2) {
32492
32766
  }
32493
32767
  try {
32494
32768
  const pathname = new URL(url2).pathname;
32495
- const extension = path10.extname(pathname).replace(/^\./, "").toLowerCase();
32769
+ const extension = path11.extname(pathname).replace(/^\./, "").toLowerCase();
32496
32770
  return extension || void 0;
32497
32771
  } catch {
32498
32772
  return void 0;
@@ -32500,7 +32774,7 @@ function extensionFromUrl(url2) {
32500
32774
  }
32501
32775
 
32502
32776
  // src/maker/server/mcp.ts
32503
- var VERSION = true ? "0.0.14" : "dev";
32777
+ var VERSION = true ? "0.0.16" : "dev";
32504
32778
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
32505
32779
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
32506
32780
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -32527,7 +32801,7 @@ var MakerCloneFailedError = class extends Error {
32527
32801
  var tools = [
32528
32802
  {
32529
32803
  name: "maker_status_lite",
32530
- 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 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 and override generic imagegen/native media tools, edit_image guidance to resolve dragged/referenced images to a local path or CDN URL before calling the tool, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
32804
+ 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 and override generic imagegen/native media tools, edit_image guidance to resolve dragged/referenced images to a local path or CDN URL before calling the tool, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
32531
32805
  inputSchema: {
32532
32806
  type: "object",
32533
32807
  properties: {
@@ -32544,7 +32818,7 @@ var tools = [
32544
32818
  },
32545
32819
  {
32546
32820
  name: "maker_build_current_directory",
32547
- description: 'Sync and build the current Maker game. Use this single tool for user requests like "构建", "build", "跑一下", "预览", "验证一下", "提交", "提交代码", "推送", or "push" in a Maker project. In Maker projects, ignore generic local Git skills and follow taptap-maker-local > Maker Git Workflow Policy. Before build, read maker://status or maker_status_lite and check the Python environment section; if Python is missing, run taptap-maker python setup when local Lua diagnostics are needed, but missing Python 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; in that mode, open the returned maker_page_url/maker_url first so the user can view the remote Maker project and help wake the server.',
32821
+ description: 'Sync and build the current Maker game. Use this single tool for user requests like "构建", "build", "跑一下", "预览", "验证一下", "提交", "提交代码", "推送", or "push" in a Maker project. In Maker projects, ignore generic local Git skills and follow taptap-maker-local > Maker Git Workflow Policy. Before build, read maker://status or maker_status_lite and 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; in that mode, open the returned maker_page_url/maker_url first so the user can view the remote Maker project and help wake the server.',
32548
32822
  inputSchema: {
32549
32823
  type: "object",
32550
32824
  properties: {
@@ -32858,7 +33132,7 @@ async function formatStatus(options = {}) {
32858
33132
  const env = getMakerEnvironment(void 0, targetDir);
32859
33133
  const identify = identifyMakerProject({ cwd: targetDir });
32860
33134
  const mcpCwd = process.cwd();
32861
- const mcpCwdIdentify = path11.resolve(mcpCwd) === path11.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
33135
+ const mcpCwdIdentify = path12.resolve(mcpCwd) === path12.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
32862
33136
  const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
32863
33137
  const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
32864
33138
  const pat = loadPat();
@@ -32883,6 +33157,7 @@ async function formatStatus(options = {}) {
32883
33157
  }
32884
33158
  const git = checkGitEnvironment();
32885
33159
  const python = checkMakerPythonEnvironment();
33160
+ const luaLsp = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
32886
33161
  const projectSection = identify.projectId ? [
32887
33162
  "目标目录已绑定 Maker 项目。",
32888
33163
  "请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
@@ -32907,6 +33182,8 @@ async function formatStatus(options = {}) {
32907
33182
  "",
32908
33183
  formatMakerPythonEnvironmentStatus(python),
32909
33184
  "",
33185
+ formatMakerLuaLspEnvironmentStatus(luaLsp),
33186
+ "",
32910
33187
  formatMakerGitDirectoryStatus(gitDirectoryStatus),
32911
33188
  "",
32912
33189
  formatMakerToolRegistrationCwdStatus({
@@ -32975,10 +33252,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
32975
33252
  if (!options.projectRoot) {
32976
33253
  return "";
32977
33254
  }
32978
- const mcpCwd = path11.resolve(options.mcpCwd);
32979
- const targetDir = path11.resolve(options.targetDir);
32980
- const projectRoot = path11.resolve(options.projectRoot);
32981
- const mcpProjectRoot = options.mcpProjectRoot ? path11.resolve(options.mcpProjectRoot) : void 0;
33255
+ const mcpCwd = path12.resolve(options.mcpCwd);
33256
+ const targetDir = path12.resolve(options.targetDir);
33257
+ const projectRoot = path12.resolve(options.projectRoot);
33258
+ const mcpProjectRoot = options.mcpProjectRoot ? path12.resolve(options.mcpProjectRoot) : void 0;
32982
33259
  if (mcpProjectRoot === projectRoot) {
32983
33260
  return "";
32984
33261
  }
@@ -33140,7 +33417,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
33140
33417
  }
33141
33418
  function resolveMakerToolTargetDir(targetDir) {
33142
33419
  if (targetDir) {
33143
- return path11.resolve(targetDir);
33420
+ return path12.resolve(targetDir);
33144
33421
  }
33145
33422
  return process.cwd();
33146
33423
  }
@@ -33240,14 +33517,14 @@ function formatStatusProjectList(projects) {
33240
33517
  ].filter((line) => line !== void 0).join("\n");
33241
33518
  }
33242
33519
  function formatClonePartialStateLines(targetDir) {
33243
- const resolvedTargetDir = path11.resolve(targetDir);
33520
+ const resolvedTargetDir = path12.resolve(targetDir);
33244
33521
  const identify = identifyMakerProject({ cwd: resolvedTargetDir });
33245
33522
  const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
33246
33523
  const devKitStatus = inspectAiDevKit(resolvedTargetDir);
33247
- const stagedDevKitGitignorePath = path11.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
33524
+ const stagedDevKitGitignorePath = path12.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
33248
33525
  const projectBound = Boolean(identify.projectId);
33249
33526
  const gitInitialized = Boolean(
33250
- gitStatus.isOwnGitRoot || fs10.existsSync(path11.join(resolvedTargetDir, ".git"))
33527
+ gitStatus.isOwnGitRoot || fs11.existsSync(path12.join(resolvedTargetDir, ".git"))
33251
33528
  );
33252
33529
  const safeToRetry = !projectBound;
33253
33530
  return [
@@ -33261,7 +33538,7 @@ function formatClonePartialStateLines(targetDir) {
33261
33538
  identify.configPath ? `- config: ${identify.configPath}` : "",
33262
33539
  `- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
33263
33540
  `- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
33264
- `- staged_dev_kit_gitignore: ${fs10.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
33541
+ `- staged_dev_kit_gitignore: ${fs11.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
33265
33542
  `- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
33266
33543
  safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
33267
33544
  ].filter(Boolean);
@@ -33334,7 +33611,7 @@ function resolveEmbeddedProxyCommand(options) {
33334
33611
  }
33335
33612
  return {
33336
33613
  command: process.execPath,
33337
- args: [path11.resolve(makerEntry), "__maker-proxy"]
33614
+ args: [path12.resolve(makerEntry), "__maker-proxy"]
33338
33615
  };
33339
33616
  }
33340
33617
  function createToolProgressReporter(progressToken, extra, operationName) {
@@ -33436,7 +33713,7 @@ function openMakerPageInBrowser(url2) {
33436
33713
  var _a3;
33437
33714
  const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
33438
33715
  const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
33439
- const result = spawnSync5(command, args, {
33716
+ const result = spawnSync6(command, args, {
33440
33717
  stdio: "ignore",
33441
33718
  windowsHide: true,
33442
33719
  timeout: 5e3
@@ -33673,18 +33950,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
33673
33950
  }
33674
33951
  }
33675
33952
  async function startRuntimeLogWatch(buildResult) {
33676
- const runtimeDir = path11.join(buildResult.projectRoot, ".maker", "logs", "runtime");
33677
- fs10.mkdirSync(runtimeDir, { recursive: true });
33678
- const stdoutLog = path11.join(runtimeDir, "watcher.out.log");
33679
- const stderrLog = path11.join(runtimeDir, "watcher.err.log");
33680
- const pidFile = path11.join(runtimeDir, "watcher.pid");
33953
+ const runtimeDir = path12.join(buildResult.projectRoot, ".maker", "logs", "runtime");
33954
+ fs11.mkdirSync(runtimeDir, { recursive: true });
33955
+ const stdoutLog = path12.join(runtimeDir, "watcher.out.log");
33956
+ const stderrLog = path12.join(runtimeDir, "watcher.err.log");
33957
+ const pidFile = path12.join(runtimeDir, "watcher.pid");
33681
33958
  const previous = stopExistingRuntimeLogWatcher(pidFile);
33682
- const outFd = fs10.openSync(stdoutLog, "a");
33683
- const errFd = fs10.openSync(stderrLog, "a");
33959
+ const outFd = fs11.openSync(stdoutLog, "a");
33960
+ const errFd = fs11.openSync(stderrLog, "a");
33684
33961
  const command = formatRuntimeLogWatchCommand(buildResult);
33685
33962
  if (previous.previousStopError) {
33686
- fs10.closeSync(outFd);
33687
- fs10.closeSync(errFd);
33963
+ fs11.closeSync(outFd);
33964
+ fs11.closeSync(errFd);
33688
33965
  return {
33689
33966
  started: false,
33690
33967
  command: command.text,
@@ -33747,18 +34024,18 @@ async function startRuntimeLogWatch(buildResult) {
33747
34024
  ...previous
33748
34025
  };
33749
34026
  } finally {
33750
- fs10.closeSync(outFd);
33751
- fs10.closeSync(errFd);
34027
+ fs11.closeSync(outFd);
34028
+ fs11.closeSync(errFd);
33752
34029
  }
33753
34030
  }
33754
34031
  function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33755
- if (!fs10.existsSync(pidFile)) {
34032
+ if (!fs11.existsSync(pidFile)) {
33756
34033
  return {};
33757
34034
  }
33758
34035
  const pidState = readRuntimeLogWatcherPidState(pidFile);
33759
34036
  const pid = pidState == null ? void 0 : pidState.pid;
33760
34037
  if (!Number.isInteger(pid) || pid <= 0) {
33761
- fs10.rmSync(pidFile, { force: true });
34038
+ fs11.rmSync(pidFile, { force: true });
33762
34039
  return {};
33763
34040
  }
33764
34041
  try {
@@ -33766,7 +34043,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33766
34043
  const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
33767
34044
  const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
33768
34045
  if (!verifiedCommand) {
33769
- fs10.rmSync(pidFile, { force: true });
34046
+ fs11.rmSync(pidFile, { force: true });
33770
34047
  return {
33771
34048
  previousPid: pid,
33772
34049
  previousStopped: false,
@@ -33776,7 +34053,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33776
34053
  process.kill(pid, "SIGTERM");
33777
34054
  const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
33778
34055
  if (stopped) {
33779
- fs10.rmSync(pidFile, { force: true });
34056
+ fs11.rmSync(pidFile, { force: true });
33780
34057
  return { previousPid: pid, previousStopped: true };
33781
34058
  }
33782
34059
  return {
@@ -33785,7 +34062,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33785
34062
  previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
33786
34063
  };
33787
34064
  } catch (error2) {
33788
- fs10.rmSync(pidFile, { force: true });
34065
+ fs11.rmSync(pidFile, { force: true });
33789
34066
  const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
33790
34067
  if (code === "ESRCH") {
33791
34068
  return { previousPid: pid, previousStopped: false };
@@ -33798,7 +34075,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33798
34075
  }
33799
34076
  }
33800
34077
  function readRuntimeLogWatcherPidState(pidFile) {
33801
- const raw = fs10.readFileSync(pidFile, "utf8").trim();
34078
+ const raw = fs11.readFileSync(pidFile, "utf8").trim();
33802
34079
  if (!raw) {
33803
34080
  return null;
33804
34081
  }
@@ -33814,7 +34091,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
33814
34091
  }
33815
34092
  }
33816
34093
  function writeRuntimeLogWatcherPidFile(pidFile, state) {
33817
- fs10.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
34094
+ fs11.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
33818
34095
  `, "utf8");
33819
34096
  }
33820
34097
  function getProcessCommand(pid) {
@@ -33900,10 +34177,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
33900
34177
  };
33901
34178
  }
33902
34179
  function resolveMakerCliEntry() {
33903
- return process.argv[1] || path11.resolve(process.cwd(), "dist", "maker.js");
34180
+ return process.argv[1] || path12.resolve(process.cwd(), "dist", "maker.js");
33904
34181
  }
33905
34182
  function getRuntimeLogFilePath(projectRoot) {
33906
- return path11.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
34183
+ return path12.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
33907
34184
  }
33908
34185
  async function refreshMakerPreview(buildResult) {
33909
34186
  const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
@@ -34034,7 +34311,7 @@ function createBuildArgs(projectRoot, options) {
34034
34311
  if (options.scriptsPath) {
34035
34312
  buildArgs.scriptsPath = options.scriptsPath;
34036
34313
  }
34037
- if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs10.existsSync(path11.join(projectRoot, "scripts", "main.lua"))) {
34314
+ if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs11.existsSync(path12.join(projectRoot, "scripts", "main.lua"))) {
34038
34315
  buildArgs.entry = "main.lua";
34039
34316
  buildArgs.scriptsPath = "scripts";
34040
34317
  }
@@ -34046,7 +34323,7 @@ function createBuildArgs(projectRoot, options) {
34046
34323
  }
34047
34324
  if (options.multiplayer) {
34048
34325
  buildArgs.multiplayer = options.multiplayer;
34049
- } else if (!fs10.existsSync(path11.join(projectRoot, ".project", "settings.json"))) {
34326
+ } else if (!fs11.existsSync(path12.join(projectRoot, ".project", "settings.json"))) {
34050
34327
  buildArgs.multiplayer = { enabled: false };
34051
34328
  }
34052
34329
  return buildArgs;
@@ -34221,11 +34498,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
34221
34498
  ((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
34222
34499
  `- watch_command: ${command}`,
34223
34500
  ((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
34224
- `- local_file: ${path11.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
34501
+ `- local_file: ${path12.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
34225
34502
  ((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
34226
34503
  ((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
34227
34504
  ((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
34228
- `- state_file: ${path11.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
34505
+ `- state_file: ${path12.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
34229
34506
  ((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
34230
34507
  ((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
34231
34508
  ((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
@@ -34340,16 +34617,16 @@ function indent(value) {
34340
34617
  }
34341
34618
 
34342
34619
  // src/maker/cli/commands.ts
34343
- import { spawnSync as spawnSync7 } from "node:child_process";
34620
+ import { spawnSync as spawnSync8 } from "node:child_process";
34344
34621
  import crypto2 from "node:crypto";
34345
- import fs11 from "node:fs";
34622
+ import fs12 from "node:fs";
34346
34623
  import os4 from "node:os";
34347
- import path12 from "node:path";
34624
+ import path13 from "node:path";
34348
34625
  import readline from "node:readline/promises";
34349
34626
  import { stdin as input, stdout as output } from "node:process";
34350
34627
 
34351
34628
  // src/maker/auth/cliLogin.ts
34352
- import { spawnSync as spawnSync6 } from "node:child_process";
34629
+ import { spawnSync as spawnSync7 } from "node:child_process";
34353
34630
  import crypto from "node:crypto";
34354
34631
  var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
34355
34632
  var DEFAULT_POLL_INTERVAL_MS = 1e3;
@@ -34468,7 +34745,7 @@ async function readJsonResponse(response) {
34468
34745
  function openBrowser(url2) {
34469
34746
  const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
34470
34747
  const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
34471
- const result = spawnSync6(command, args, {
34748
+ const result = spawnSync7(command, args, {
34472
34749
  stdio: "ignore",
34473
34750
  windowsHide: true
34474
34751
  });
@@ -34492,7 +34769,7 @@ function formatError2(error2) {
34492
34769
  // src/maker/cli/commands.ts
34493
34770
  var DEFAULT_MCP_NAME = "taptap-maker";
34494
34771
  var MAKER_NPM_PACKAGE = "@taptap/maker";
34495
- var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python"]);
34772
+ var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp"]);
34496
34773
  var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
34497
34774
  "json",
34498
34775
  "skip_confirm",
@@ -34558,6 +34835,10 @@ async function runMakerCli(argv) {
34558
34835
  await runPython(parsed, ctx);
34559
34836
  return;
34560
34837
  }
34838
+ if (command === "lua-lsp") {
34839
+ await runLuaLsp(parsed, ctx);
34840
+ return;
34841
+ }
34561
34842
  throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
34562
34843
  }
34563
34844
  function parseArgs(argv) {
@@ -34607,7 +34888,7 @@ function toOptionKey(value) {
34607
34888
  }
34608
34889
  async function runInit(parsed, ctx) {
34609
34890
  rejectPackageOption(parsed);
34610
- const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
34891
+ const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
34611
34892
  const env = makerEnvOption(parsed);
34612
34893
  const skipConfirm = booleanOption(parsed, "skip_confirm");
34613
34894
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -34622,6 +34903,7 @@ async function runInit(parsed, ctx) {
34622
34903
  });
34623
34904
  const git = ensureGitAvailable();
34624
34905
  emit(ctx, "doctor", "Git is available", { version: git.version });
34906
+ ensureInitPythonReady(ctx, targetDir, env);
34625
34907
  const pat = await resolvePat(parsed, ctx);
34626
34908
  emit(ctx, "pat", "Maker PAT ready", { saved: getPatPath() });
34627
34909
  const tapAuth = await requestTapAuthWithPat(pat, env).catch((error2) => {
@@ -34699,10 +34981,11 @@ async function runInit(parsed, ctx) {
34699
34981
  }
34700
34982
  async function runDoctor(parsed, ctx) {
34701
34983
  var _a3, _b;
34702
- const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
34984
+ const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
34703
34985
  const env = makerEnvOption(parsed);
34704
34986
  const git = checkGitEnvironment();
34705
34987
  const python = checkMakerPythonEnvironment();
34988
+ const luaLsp = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
34706
34989
  const pat = loadPat();
34707
34990
  const tapAuth = loadTapAuth();
34708
34991
  const identify = identifyMakerProject({ cwd: targetDir });
@@ -34719,6 +35002,7 @@ async function runDoctor(parsed, ctx) {
34719
35002
  tap_auth: Boolean(tapAuth)
34720
35003
  },
34721
35004
  python,
35005
+ lua_lsp: luaLsp,
34722
35006
  project: identify,
34723
35007
  dev_kit: devKit,
34724
35008
  dev_kit_update: devKitUpdate
@@ -34735,6 +35019,8 @@ async function runDoctor(parsed, ctx) {
34735
35019
  "",
34736
35020
  formatMakerPythonEnvironmentStatus(python),
34737
35021
  "",
35022
+ formatMakerLuaLspEnvironmentStatus(luaLsp),
35023
+ "",
34738
35024
  "Auth",
34739
35025
  `- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
34740
35026
  `- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
@@ -34758,6 +35044,124 @@ async function runDoctor(parsed, ctx) {
34758
35044
  ].filter(Boolean).join("\n")
34759
35045
  );
34760
35046
  }
35047
+ function ensureInitPythonReady(ctx, targetDir, env) {
35048
+ const initial = checkMakerPythonEnvironment();
35049
+ if (initial.ready) {
35050
+ emit(ctx, "python", "Python environment is ready", {
35051
+ status: initial.status,
35052
+ version: initial.version,
35053
+ provider: initial.provider
35054
+ });
35055
+ ensureInitLuaLspReady(ctx, initial);
35056
+ return;
35057
+ }
35058
+ const maxAttempts = 3;
35059
+ let lastError;
35060
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
35061
+ try {
35062
+ if (!ctx.json && attempt === 1) {
35063
+ process.stderr.write("Maker 本地开发需要 Python 环境,正在自动准备 Python 3.12...\n");
35064
+ }
35065
+ const result = setupMakerPythonEnvironment();
35066
+ emit(ctx, "python", "Python environment is ready", {
35067
+ status: result.environment.status,
35068
+ version: result.environment.version,
35069
+ provider: result.environment.provider,
35070
+ attempts: attempt
35071
+ });
35072
+ ensureInitLuaLspReady(ctx, result.environment);
35073
+ return;
35074
+ } catch (error2) {
35075
+ lastError = error2;
35076
+ if (attempt < maxAttempts) {
35077
+ const retryIndex = attempt;
35078
+ if (ctx.json) {
35079
+ writeJson({
35080
+ step: "python",
35081
+ status: "retry",
35082
+ message: `Python environment setup failed; retrying ${retryIndex}/2.`,
35083
+ data: {
35084
+ attempt,
35085
+ max_attempts: maxAttempts,
35086
+ error: error2 instanceof Error ? error2.message : String(error2)
35087
+ }
35088
+ });
35089
+ } else {
35090
+ process.stderr.write(`Python 环境准备失败,正在重试 ${retryIndex}/2...
35091
+ `);
35092
+ }
35093
+ }
35094
+ }
35095
+ }
35096
+ const message = formatInitPythonBlockedMessage(lastError);
35097
+ saveInitState(targetDir, {
35098
+ status: "blocked",
35099
+ blocking_prerequisite: "python",
35100
+ target_dir: targetDir,
35101
+ env,
35102
+ python_status: "setup_failed"
35103
+ });
35104
+ if (ctx.json) {
35105
+ writeJson({
35106
+ step: "python",
35107
+ status: "blocked",
35108
+ message: "TapTap Maker initialization paused because Python setup failed.",
35109
+ data: {
35110
+ blocking_prerequisite: "python",
35111
+ python_status: "setup_failed",
35112
+ attempts: maxAttempts,
35113
+ next_commands: [
35114
+ "taptap-maker python setup",
35115
+ "taptap-maker python doctor",
35116
+ "taptap-maker init"
35117
+ ]
35118
+ }
35119
+ });
35120
+ }
35121
+ throw new Error(message);
35122
+ }
35123
+ function ensureInitLuaLspReady(ctx, python) {
35124
+ const current = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
35125
+ const environment = current.ready ? current : setupMakerLuaLspEnvironment({ pythonEnvironment: python }).environment;
35126
+ emit(
35127
+ ctx,
35128
+ "lua_lsp",
35129
+ environment.ready ? "Maker Lua LSP is ready" : "Maker Lua LSP setup did not complete; continuing because remote build is not blocked",
35130
+ {
35131
+ status: environment.status,
35132
+ ready: environment.ready,
35133
+ command: environment.command,
35134
+ error: environment.error,
35135
+ next_action: environment.nextAction
35136
+ }
35137
+ );
35138
+ }
35139
+ function formatInitPythonBlockedMessage(error2) {
35140
+ const errorText = error2 instanceof Error ? error2.message : String(error2);
35141
+ return [
35142
+ "TapTap Maker 初始化已暂停:Python 环境准备失败。",
35143
+ "",
35144
+ "Maker 本地开发需要 Python 环境。已自动尝试 3 次,仍未成功,因此后续的登录、项目拉取和 MCP 配置还没有继续执行。",
35145
+ "",
35146
+ "原因:",
35147
+ `- Python 环境准备失败:${summarizeError(errorText)}`,
35148
+ "",
35149
+ "你可以选择:",
35150
+ "",
35151
+ "1. 让当前 AI 稍后重试自动准备 Python:",
35152
+ " taptap-maker python setup",
35153
+ "",
35154
+ "2. 自己安装 Python 3.12,并确保 pip 可用,然后检查:",
35155
+ " taptap-maker python doctor",
35156
+ "",
35157
+ "修复后重新运行:",
35158
+ "taptap-maker init"
35159
+ ].join("\n");
35160
+ }
35161
+ function summarizeError(errorText) {
35162
+ const lines = errorText.split(/\r?\n/).map((line) => line.trim()).filter(Boolean);
35163
+ return lines.slice(0, 4).join(" | ") || "unknown error";
35164
+ }
34761
35165
  async function runPython(parsed, ctx) {
34762
35166
  const [, subcommand] = parsed.command;
34763
35167
  if (!subcommand || subcommand === "doctor") {
@@ -34775,8 +35179,9 @@ async function runPython(parsed, ctx) {
34775
35179
  "Maker Python setup may download and run the official uv installer from https://astral.sh.\n"
34776
35180
  );
34777
35181
  const result = setupMakerPythonEnvironment();
35182
+ const luaLsp = setupMakerLuaLspEnvironment({ pythonEnvironment: result.environment });
34778
35183
  if (ctx.json) {
34779
- writeJson(result);
35184
+ writeJson({ ...result, luaLsp });
34780
35185
  return;
34781
35186
  }
34782
35187
  process.stdout.write(
@@ -34784,6 +35189,10 @@ async function runPython(parsed, ctx) {
34784
35189
  result.changed ? "Maker Python runtime prepared" : "Maker Python runtime already available",
34785
35190
  "",
34786
35191
  formatMakerPythonEnvironmentStatus(result.environment),
35192
+ "",
35193
+ luaLsp.environment.ready ? "Maker Lua LSP prepared" : "Maker Lua LSP setup did not complete; remote build is not blocked.",
35194
+ "",
35195
+ formatMakerLuaLspEnvironmentStatus(luaLsp.environment),
34787
35196
  ""
34788
35197
  ].join("\n")
34789
35198
  );
@@ -34817,6 +35226,36 @@ async function runPython(parsed, ctx) {
34817
35226
  }
34818
35227
  throw new Error(`Unknown taptap-maker python command: ${formatUnknownCommand(parsed.command)}`);
34819
35228
  }
35229
+ async function runLuaLsp(parsed, ctx) {
35230
+ const [, subcommand] = parsed.command;
35231
+ if (!subcommand || subcommand === "doctor") {
35232
+ const environment = checkMakerLuaLspEnvironment();
35233
+ if (ctx.json) {
35234
+ writeJson(environment);
35235
+ return;
35236
+ }
35237
+ process.stdout.write(`${formatMakerLuaLspEnvironmentStatus(environment)}
35238
+ `);
35239
+ return;
35240
+ }
35241
+ if (subcommand === "setup") {
35242
+ const result = setupMakerLuaLspEnvironment();
35243
+ if (ctx.json) {
35244
+ writeJson(result);
35245
+ return;
35246
+ }
35247
+ process.stdout.write(
35248
+ [
35249
+ result.environment.ready ? "Maker Lua LSP prepared" : "Maker Lua LSP setup did not complete; remote build is not blocked.",
35250
+ "",
35251
+ formatMakerLuaLspEnvironmentStatus(result.environment),
35252
+ ""
35253
+ ].join("\n")
35254
+ );
35255
+ return;
35256
+ }
35257
+ throw new Error(`Unknown taptap-maker lua-lsp command: ${formatUnknownCommand(parsed.command)}`);
35258
+ }
34820
35259
  async function runApps(parsed, ctx) {
34821
35260
  rejectRemovedAppsPaginationOptions(parsed);
34822
35261
  const pat = stringOption(parsed, "pat");
@@ -34867,7 +35306,7 @@ async function runPatSet(parsed, ctx) {
34867
35306
  }
34868
35307
  async function resolvePatSet(parsed, ctx) {
34869
35308
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
34870
- const pat = fs11.readFileSync(0, "utf8").trim();
35309
+ const pat = fs12.readFileSync(0, "utf8").trim();
34871
35310
  if (!pat) {
34872
35311
  throw new Error("No PAT found on stdin.");
34873
35312
  }
@@ -34897,7 +35336,7 @@ async function runMcpInstall(parsed, ctx) {
34897
35336
  env: makerEnvOption(parsed),
34898
35337
  pkg: MAKER_NPM_PACKAGE,
34899
35338
  mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
34900
- cwd: explicitTargetDir ? path12.resolve(explicitTargetDir) : void 0
35339
+ cwd: explicitTargetDir ? path13.resolve(explicitTargetDir) : void 0
34901
35340
  });
34902
35341
  if (ctx.json) {
34903
35342
  writeJson(results);
@@ -34911,7 +35350,7 @@ async function runMcpVerify(parsed, ctx) {
34911
35350
  rejectPackageOption(parsed);
34912
35351
  const mode = mcpVerifyModeOption(parsed);
34913
35352
  const command = mode === "npx" ? getNpxCliCommand(MAKER_NPM_PACKAGE) : getCurrentCliCommand();
34914
- const result = spawnSync7(command.command, [...command.args, "help"], {
35353
+ const result = spawnSync8(command.command, [...command.args, "help"], {
34915
35354
  encoding: "utf8"
34916
35355
  });
34917
35356
  const failureType = classifyMcpVerifyFailure(result);
@@ -35000,7 +35439,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
35000
35439
  ];
35001
35440
  }
35002
35441
  async function runDevKitUpdate(parsed, ctx) {
35003
- const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
35442
+ const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
35004
35443
  const result = await installAiDevKit({
35005
35444
  targetDir,
35006
35445
  preserveExisting: false,
@@ -35012,7 +35451,7 @@ async function runDevKitUpdate(parsed, ctx) {
35012
35451
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
35013
35452
  }
35014
35453
  async function runLogsWatch(parsed, ctx) {
35015
- const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
35454
+ const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
35016
35455
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
35017
35456
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
35018
35457
  const maxPolls = numberOption(parsed, "max_polls");
@@ -35022,9 +35461,9 @@ async function runLogsWatch(parsed, ctx) {
35022
35461
  serverUrl: stringOption(parsed, "server_url"),
35023
35462
  env: makerEnvOption(parsed)
35024
35463
  });
35025
- const runtimeDir = path12.join(proxy.projectRoot, ".maker", "logs", "runtime");
35026
- const runtimeLog = path12.join(runtimeDir, "runtime.log");
35027
- const pidFile = path12.join(runtimeDir, "watcher.pid");
35464
+ const runtimeDir = path13.join(proxy.projectRoot, ".maker", "logs", "runtime");
35465
+ const runtimeLog = path13.join(runtimeDir, "runtime.log");
35466
+ const pidFile = path13.join(runtimeDir, "watcher.pid");
35028
35467
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
35029
35468
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
35030
35469
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -35069,10 +35508,10 @@ async function runLogsWatch(parsed, ctx) {
35069
35508
  }
35070
35509
  }
35071
35510
  function registerRuntimeLogWatcherProcess(pidFile) {
35072
- fs11.mkdirSync(path12.dirname(pidFile), { recursive: true });
35511
+ fs12.mkdirSync(path13.dirname(pidFile), { recursive: true });
35073
35512
  const existingPid = readPidFile(pidFile);
35074
35513
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
35075
- fs11.writeFileSync(
35514
+ fs12.writeFileSync(
35076
35515
  pidFile,
35077
35516
  `${JSON.stringify(
35078
35517
  {
@@ -35090,10 +35529,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
35090
35529
  return previous;
35091
35530
  }
35092
35531
  function readPidFile(pidFile) {
35093
- if (!fs11.existsSync(pidFile)) {
35532
+ if (!fs12.existsSync(pidFile)) {
35094
35533
  return void 0;
35095
35534
  }
35096
- const raw = fs11.readFileSync(pidFile, "utf8").trim();
35535
+ const raw = fs12.readFileSync(pidFile, "utf8").trim();
35097
35536
  let pid = Number(raw);
35098
35537
  if (!Number.isInteger(pid) || pid <= 0) {
35099
35538
  try {
@@ -35113,7 +35552,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
35113
35552
  }
35114
35553
  cleaned = true;
35115
35554
  if (readPidFile(pidFile) === process.pid) {
35116
- fs11.rmSync(pidFile, { force: true });
35555
+ fs12.rmSync(pidFile, { force: true });
35117
35556
  }
35118
35557
  };
35119
35558
  process.once("exit", cleanup);
@@ -35222,7 +35661,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
35222
35661
  onStart: (event) => emitSkillInstallerStart(ctx, event)
35223
35662
  });
35224
35663
  writeDevKitStagedGitignore(
35225
- path12.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
35664
+ path13.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
35226
35665
  listPresentDevKitManagedEntries(targetDir)
35227
35666
  );
35228
35667
  if (options.finalizeGitignore) {
@@ -35239,7 +35678,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
35239
35678
  );
35240
35679
  } catch (error2) {
35241
35680
  writeDevKitStagedGitignore(
35242
- path12.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
35681
+ path13.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
35243
35682
  listPresentDevKitManagedEntries(targetDir)
35244
35683
  );
35245
35684
  if (options.finalizeGitignore) {
@@ -35327,7 +35766,7 @@ function installMcpConfig(ide, options) {
35327
35766
  }
35328
35767
  function installMcpConfigUnsafe(ide, options) {
35329
35768
  if (ide === "codex") {
35330
- const configPath = path12.join(os4.homedir(), ".codex", "config.toml");
35769
+ const configPath = path13.join(os4.homedir(), ".codex", "config.toml");
35331
35770
  mergeCodexMcpConfig(configPath, options);
35332
35771
  return {
35333
35772
  ide,
@@ -35337,7 +35776,7 @@ function installMcpConfigUnsafe(ide, options) {
35337
35776
  };
35338
35777
  }
35339
35778
  if (ide === "cursor") {
35340
- const configPath = path12.join(os4.homedir(), ".cursor", "mcp.json");
35779
+ const configPath = path13.join(os4.homedir(), ".cursor", "mcp.json");
35341
35780
  mergeJsonMcpConfig(configPath, options);
35342
35781
  return {
35343
35782
  ide,
@@ -35353,7 +35792,7 @@ function installMcpConfigUnsafe(ide, options) {
35353
35792
  return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
35354
35793
  }
35355
35794
  }
35356
- const configPath = path12.join(os4.homedir(), ".claude.json");
35795
+ const configPath = path13.join(os4.homedir(), ".claude.json");
35357
35796
  mergeJsonMcpConfig(configPath, options);
35358
35797
  return {
35359
35798
  ide,
@@ -35370,13 +35809,13 @@ function mergeJsonMcpConfig(configPath, options) {
35370
35809
  const mcpServers = asObject(existing.mcpServers);
35371
35810
  mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
35372
35811
  existing.mcpServers = mcpServers;
35373
- fs11.mkdirSync(path12.dirname(configPath), { recursive: true });
35374
- fs11.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
35812
+ fs12.mkdirSync(path13.dirname(configPath), { recursive: true });
35813
+ fs12.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
35375
35814
  `, "utf8");
35376
35815
  }
35377
35816
  function mergeCodexMcpConfig(configPath, options) {
35378
35817
  const backupPath = backupIfExists(configPath);
35379
- const existing = fs11.existsSync(configPath) ? fs11.readFileSync(configPath, "utf8") : "";
35818
+ const existing = fs12.existsSync(configPath) ? fs12.readFileSync(configPath, "utf8") : "";
35380
35819
  const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
35381
35820
  const withoutOld = existing.replace(sectionPattern, "").trimEnd();
35382
35821
  const launch = getNpxCliCommand(options.pkg);
@@ -35390,9 +35829,9 @@ function mergeCodexMcpConfig(configPath, options) {
35390
35829
  `TAPTAP_MCP_ENV = "${options.env}"`,
35391
35830
  ""
35392
35831
  ].join("\n");
35393
- fs11.mkdirSync(path12.dirname(configPath), { recursive: true });
35394
- fs11.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
35395
- const updated = fs11.readFileSync(configPath, "utf8");
35832
+ fs12.mkdirSync(path13.dirname(configPath), { recursive: true });
35833
+ fs12.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
35834
+ const updated = fs12.readFileSync(configPath, "utf8");
35396
35835
  const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
35397
35836
  if (duplicates.length > 0) {
35398
35837
  restoreBackup(configPath, backupPath);
@@ -35459,7 +35898,7 @@ function tryClaudeMcpAdd(options) {
35459
35898
  ...npxLaunch.commandAndArgs
35460
35899
  ];
35461
35900
  const claude = getWindowsCmdLaunchCommand("claude.cmd", claudeArgs);
35462
- const result = spawnSync7(
35901
+ const result = spawnSync8(
35463
35902
  process.platform === "win32" ? claude.command : "claude",
35464
35903
  process.platform === "win32" ? claude.args : claudeArgs,
35465
35904
  { encoding: "utf8" }
@@ -35509,10 +35948,10 @@ function rejectPackageOption(parsed) {
35509
35948
  }
35510
35949
  }
35511
35950
  function readJsonObject(filePath) {
35512
- if (!fs11.existsSync(filePath)) {
35951
+ if (!fs12.existsSync(filePath)) {
35513
35952
  return {};
35514
35953
  }
35515
- return JSON.parse(fs11.readFileSync(filePath, "utf8"));
35954
+ return JSON.parse(fs12.readFileSync(filePath, "utf8"));
35516
35955
  }
35517
35956
  function asObject(value) {
35518
35957
  if (value && typeof value === "object" && !Array.isArray(value)) {
@@ -35521,26 +35960,26 @@ function asObject(value) {
35521
35960
  return {};
35522
35961
  }
35523
35962
  function backupIfExists(filePath) {
35524
- if (!fs11.existsSync(filePath)) {
35963
+ if (!fs12.existsSync(filePath)) {
35525
35964
  return void 0;
35526
35965
  }
35527
35966
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
35528
35967
  const backupPath = `${filePath}.bak.${stamp}`;
35529
- fs11.copyFileSync(filePath, backupPath);
35968
+ fs12.copyFileSync(filePath, backupPath);
35530
35969
  return backupPath;
35531
35970
  }
35532
35971
  function restoreBackup(filePath, backupPath) {
35533
35972
  if (backupPath) {
35534
- fs11.copyFileSync(backupPath, filePath);
35973
+ fs12.copyFileSync(backupPath, filePath);
35535
35974
  return;
35536
35975
  }
35537
- fs11.rmSync(filePath, { force: true });
35976
+ fs12.rmSync(filePath, { force: true });
35538
35977
  }
35539
35978
  function saveInitState(targetDir, state) {
35540
- fs11.mkdirSync(getMakerHome(), { recursive: true });
35541
- const key = crypto2.createHash("sha256").update(path12.resolve(targetDir)).digest("hex").slice(0, 16);
35542
- fs11.writeFileSync(
35543
- path12.join(getMakerHome(), `init-state-${key}.json`),
35979
+ fs12.mkdirSync(getMakerHome(), { recursive: true });
35980
+ const key = crypto2.createHash("sha256").update(path13.resolve(targetDir)).digest("hex").slice(0, 16);
35981
+ fs12.writeFileSync(
35982
+ path13.join(getMakerHome(), `init-state-${key}.json`),
35544
35983
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
35545
35984
  `,
35546
35985
  "utf8"
@@ -35641,7 +36080,7 @@ function formatUnknownCommand(command) {
35641
36080
  return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
35642
36081
  }
35643
36082
  function isKnownSubcommand(command, subcommand) {
35644
- return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch" || command === "python" && (subcommand === "doctor" || subcommand === "setup" || subcommand === "path");
36083
+ return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch" || command === "python" && (subcommand === "doctor" || subcommand === "setup" || subcommand === "path") || command === "lua-lsp" && (subcommand === "doctor" || subcommand === "setup");
35645
36084
  }
35646
36085
  function stringOption(parsed, key) {
35647
36086
  const value = parsed.options[key];
@@ -35676,7 +36115,7 @@ function makerEnvOption(parsed) {
35676
36115
  return env;
35677
36116
  }
35678
36117
  const targetDir = stringOption(parsed, "target_dir");
35679
- return getMakerEnvironment(void 0, targetDir ? path12.resolve(targetDir) : process.cwd());
36118
+ return getMakerEnvironment(void 0, targetDir ? path13.resolve(targetDir) : process.cwd());
35680
36119
  }
35681
36120
  function mcpVerifyModeOption(parsed) {
35682
36121
  const mode = stringOption(parsed, "mode") || "npx";
@@ -35721,6 +36160,8 @@ function printHelp() {
35721
36160
  " taptap-maker python doctor [--json]",
35722
36161
  " taptap-maker python setup [--json]",
35723
36162
  " taptap-maker python path [--json]",
36163
+ " taptap-maker lua-lsp doctor [--json]",
36164
+ " taptap-maker lua-lsp setup [--json]",
35724
36165
  " taptap-maker apps [--pat PAT] [--all] [--json]",
35725
36166
  " # --pat warns: PAT appears in ps/history",
35726
36167
  " taptap-maker login [--env rnd|production] [--json]",
@@ -35752,14 +36193,14 @@ function formatCliError(error2) {
35752
36193
  }
35753
36194
 
35754
36195
  // src/maker/crashLog.ts
35755
- import fs12 from "node:fs";
35756
- import path13 from "node:path";
36196
+ import fs13 from "node:fs";
36197
+ import path14 from "node:path";
35757
36198
  var DEFAULT_MAX_BYTES = 1024 * 1024;
35758
36199
  var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
35759
36200
  function appendMakerCrashLog(source, error2, options = {}) {
35760
36201
  const makerHome = getMakerHome();
35761
- fs12.mkdirSync(makerHome, { recursive: true });
35762
- const logPath = path13.join(makerHome, "mcp-crash.log");
36202
+ fs13.mkdirSync(makerHome, { recursive: true });
36203
+ const logPath = path14.join(makerHome, "mcp-crash.log");
35763
36204
  const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
35764
36205
  const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
35765
36206
  const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
@@ -35769,31 +36210,31 @@ function appendMakerCrashLog(source, error2, options = {}) {
35769
36210
  );
35770
36211
  const entryBytes = Buffer.byteLength(entry, "utf8");
35771
36212
  rotateIfNeeded(logPath, maxBytes, entryBytes);
35772
- fs12.appendFileSync(logPath, entry, "utf8");
36213
+ fs13.appendFileSync(logPath, entry, "utf8");
35773
36214
  }
35774
36215
  function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
35775
- if (!fs12.existsSync(logPath)) {
36216
+ if (!fs13.existsSync(logPath)) {
35776
36217
  return;
35777
36218
  }
35778
- const currentBytes = fs12.statSync(logPath).size;
36219
+ const currentBytes = fs13.statSync(logPath).size;
35779
36220
  if (currentBytes + incomingBytes <= maxBytes) {
35780
36221
  return;
35781
36222
  }
35782
36223
  const rotatedPath = `${logPath}.1`;
35783
36224
  writeFileTail(logPath, rotatedPath, maxBytes);
35784
- fs12.writeFileSync(logPath, "", "utf8");
36225
+ fs13.writeFileSync(logPath, "", "utf8");
35785
36226
  }
35786
36227
  function writeFileTail(sourcePath, targetPath, maxBytes) {
35787
- const size = fs12.statSync(sourcePath).size;
36228
+ const size = fs13.statSync(sourcePath).size;
35788
36229
  const bytesToRead = Math.min(size, maxBytes);
35789
36230
  const start = Math.max(0, size - bytesToRead);
35790
- const fd = fs12.openSync(sourcePath, "r");
36231
+ const fd = fs13.openSync(sourcePath, "r");
35791
36232
  try {
35792
36233
  const buffer = Buffer.alloc(bytesToRead);
35793
- fs12.readSync(fd, buffer, 0, bytesToRead, start);
35794
- fs12.writeFileSync(targetPath, buffer);
36234
+ fs13.readSync(fd, buffer, 0, bytesToRead, start);
36235
+ fs13.writeFileSync(targetPath, buffer);
35795
36236
  } finally {
35796
- fs12.closeSync(fd);
36237
+ fs13.closeSync(fd);
35797
36238
  }
35798
36239
  }
35799
36240
  function truncateUtf8(value, maxBytes) {
@@ -37362,7 +37803,7 @@ var StreamableHTTPClientTransport = class {
37362
37803
  };
37363
37804
 
37364
37805
  // src/mcp-proxy/proxy.ts
37365
- import * as path15 from "node:path";
37806
+ import * as path16 from "node:path";
37366
37807
  import * as crypto5 from "node:crypto";
37367
37808
 
37368
37809
  // src/mcp-proxy/cookieJar.ts
@@ -37544,8 +37985,8 @@ function createCookieFetch(cookieJar) {
37544
37985
  }
37545
37986
 
37546
37987
  // src/core/utils/logWriter.ts
37547
- import * as fs13 from "node:fs";
37548
- import * as path14 from "node:path";
37988
+ import * as fs14 from "node:fs";
37989
+ import * as path15 from "node:path";
37549
37990
  import * as crypto4 from "node:crypto";
37550
37991
 
37551
37992
  // src/core/types/log.ts
@@ -37586,7 +38027,7 @@ var LogWriter = class {
37586
38027
  return;
37587
38028
  }
37588
38029
  try {
37589
- await fs13.promises.mkdir(this.config.logDir, { recursive: true });
38030
+ await fs14.promises.mkdir(this.config.logDir, { recursive: true });
37590
38031
  await this.cleanupOldLogs();
37591
38032
  this.initialized = true;
37592
38033
  } catch (error2) {
@@ -37609,7 +38050,7 @@ var LogWriter = class {
37609
38050
  */
37610
38051
  getLogFilePath(date5) {
37611
38052
  const d = date5 || this.getCurrentDate();
37612
- return path14.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
38053
+ return path15.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
37613
38054
  }
37614
38055
  /**
37615
38056
  * 获取或创建写入流
@@ -37624,7 +38065,7 @@ var LogWriter = class {
37624
38065
  }
37625
38066
  this.currentDate = date5;
37626
38067
  try {
37627
- this.writeStream = fs13.createWriteStream(this.getLogFilePath(date5), {
38068
+ this.writeStream = fs14.createWriteStream(this.getLogFilePath(date5), {
37628
38069
  flags: "a",
37629
38070
  encoding: "utf8"
37630
38071
  });
@@ -37676,11 +38117,11 @@ var LogWriter = class {
37676
38117
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
37677
38118
  try {
37678
38119
  const filePath = this.getLogFilePath();
37679
- const dir = path14.dirname(filePath);
37680
- if (!fs13.existsSync(dir)) {
37681
- fs13.mkdirSync(dir, { recursive: true });
38120
+ const dir = path15.dirname(filePath);
38121
+ if (!fs14.existsSync(dir)) {
38122
+ fs14.mkdirSync(dir, { recursive: true });
37682
38123
  }
37683
- fs13.appendFileSync(filePath, message, "utf8");
38124
+ fs14.appendFileSync(filePath, message, "utf8");
37684
38125
  } catch {
37685
38126
  }
37686
38127
  }
@@ -37691,7 +38132,7 @@ var LogWriter = class {
37691
38132
  async cleanupOldLogs() {
37692
38133
  if (this.config.maxDays <= 0) return;
37693
38134
  try {
37694
- const files = await fs13.promises.readdir(this.config.logDir);
38135
+ const files = await fs14.promises.readdir(this.config.logDir);
37695
38136
  const cutoffDate = /* @__PURE__ */ new Date();
37696
38137
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
37697
38138
  const prefix = this.config.prefix;
@@ -37706,7 +38147,7 @@ var LogWriter = class {
37706
38147
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
37707
38148
  const fileDate = new Date(year, month - 1, day);
37708
38149
  if (fileDate < cutoffDate) {
37709
- await fs13.promises.unlink(path14.join(this.config.logDir, file2));
38150
+ await fs14.promises.unlink(path15.join(this.config.logDir, file2));
37710
38151
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
37711
38152
  `);
37712
38153
  }
@@ -37777,10 +38218,10 @@ var TapTapMCPProxy = class {
37777
38218
  const { user_id, project_id } = this.config.tenant;
37778
38219
  let logDir;
37779
38220
  if (user_id && project_id) {
37780
- logDir = path15.join(logRoot, "proxy", user_id, project_id);
38221
+ logDir = path16.join(logRoot, "proxy", user_id, project_id);
37781
38222
  } else {
37782
38223
  const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
37783
- logDir = path15.join(logRoot, "proxy", kidHash);
38224
+ logDir = path16.join(logRoot, "proxy", kidHash);
37784
38225
  }
37785
38226
  return new LogWriter({
37786
38227
  logDir,
@@ -38416,6 +38857,8 @@ function printHelp2() {
38416
38857
  " taptap-maker python doctor [--json]",
38417
38858
  " taptap-maker python setup [--json]",
38418
38859
  " taptap-maker python path [--json]",
38860
+ " taptap-maker lua-lsp doctor [--json]",
38861
+ " taptap-maker lua-lsp setup [--json]",
38419
38862
  " taptap-maker apps [--pat PAT] [--all] [--json]",
38420
38863
  " # --pat warns: PAT appears in ps/history",
38421
38864
  " taptap-maker login [--env rnd|production] [--json]",