@taptap/maker 0.0.12 → 0.0.14

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(path15) {
3237
- let input2 = path15;
3236
+ function removeDotSegments(path16) {
3237
+ let input2 = path16;
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 [path15, query] = wsComponent.resourceName.split("?");
3437
- wsComponent.path = path15 && path15 !== "/" ? path15 : void 0;
3436
+ const [path16, query] = wsComponent.resourceName.split("?");
3437
+ wsComponent.path = path16 && path16 !== "/" ? path16 : 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, fs13, exportName) {
12494
+ function addFormats(ajv, list, fs14, 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, fs13[f]);
12499
+ ajv.addFormat(f, fs14[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 fs13 = __require("fs");
12513
- function checkPathExt(path15, options) {
12512
+ var fs14 = __require("fs");
12513
+ function checkPathExt(path16, 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 && path15.substr(-p.length).toLowerCase() === p) {
12524
+ if (p && path16.substr(-p.length).toLowerCase() === p) {
12525
12525
  return true;
12526
12526
  }
12527
12527
  }
12528
12528
  return false;
12529
12529
  }
12530
- function checkStat(stat, path15, options) {
12530
+ function checkStat(stat, path16, options) {
12531
12531
  if (!stat.isSymbolicLink() && !stat.isFile()) {
12532
12532
  return false;
12533
12533
  }
12534
- return checkPathExt(path15, options);
12534
+ return checkPathExt(path16, options);
12535
12535
  }
12536
- function isexe(path15, options, cb) {
12537
- fs13.stat(path15, function(er, stat) {
12538
- cb(er, er ? false : checkStat(stat, path15, options));
12536
+ function isexe(path16, options, cb) {
12537
+ fs14.stat(path16, function(er, stat) {
12538
+ cb(er, er ? false : checkStat(stat, path16, options));
12539
12539
  });
12540
12540
  }
12541
- function sync(path15, options) {
12542
- return checkStat(fs13.statSync(path15), path15, options);
12541
+ function sync(path16, options) {
12542
+ return checkStat(fs14.statSync(path16), path16, 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 fs13 = __require("fs");
12553
- function isexe(path15, options, cb) {
12554
- fs13.stat(path15, function(er, stat) {
12552
+ var fs14 = __require("fs");
12553
+ function isexe(path16, options, cb) {
12554
+ fs14.stat(path16, function(er, stat) {
12555
12555
  cb(er, er ? false : checkStat(stat, options));
12556
12556
  });
12557
12557
  }
12558
- function sync(path15, options) {
12559
- return checkStat(fs13.statSync(path15), options);
12558
+ function sync(path16, options) {
12559
+ return checkStat(fs14.statSync(path16), 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 fs13 = __require("fs");
12583
+ var fs14 = __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(path15, options, cb) {
12592
+ function isexe(path16, 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(path15, options || {}, function(er, is) {
12602
+ isexe(path16, 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(path15, options || {}, function(er, is) {
12611
+ core(path16, 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(path15, options) {
12621
+ function sync(path16, options) {
12622
12622
  try {
12623
- return core.sync(path15, options || {});
12623
+ return core.sync(path16, 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 path15 = __require("path");
12639
+ var path16 = __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 = path15.join(pathPart, cmd);
12677
+ const pCmd = path16.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 = path15.join(pathPart, cmd);
12704
+ const pCmd = path16.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 path15 = __require("path");
12752
+ var path16 = __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 ? path15.delimiter : void 0
12770
+ pathExt: withoutPathExt ? path16.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 = path15.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
12779
+ resolved = path16.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 [path15, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
- const binary = path15.split("/").pop();
12833
+ const [path16, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
+ const binary = path16.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 fs13 = __require("fs");
12847
+ var fs14 = __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 = fs13.openSync(command, "r");
12855
- fs13.readSync(fd, buffer, 0, size, 0);
12856
- fs13.closeSync(fd);
12854
+ fd = fs14.openSync(command, "r");
12855
+ fs14.readSync(fd, buffer, 0, size, 0);
12856
+ fs14.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 path15 = __require("path");
12869
+ var path16 = __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 = path15.normalize(parsed.command);
12894
+ parsed.command = path16.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 spawnSync6(command, args, options) {
12990
+ function spawnSync8(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 = spawnSync6;
12998
+ module.exports.sync = spawnSync8;
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 } from "node:child_process";
13006
- import fs9 from "node:fs";
13007
- import path10 from "node:path";
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";
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: path15, errorMaps, issueData } = params;
13369
- const fullPath = [...path15, ...issueData.path || []];
13368
+ const { data, path: path16, errorMaps, issueData } = params;
13369
+ const fullPath = [...path16, ...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, path15, key) {
13484
+ constructor(parent, value, path16, key) {
13485
13485
  this._cachedPath = [];
13486
13486
  this.parent = parent;
13487
13487
  this.data = value;
13488
- this._path = path15;
13488
+ this._path = path16;
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, path15) {
17138
- if (!path15)
17137
+ function getElementAtPath(obj, path16) {
17138
+ if (!path16)
17139
17139
  return obj;
17140
- return path15.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
17140
+ return path16.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(path15, issues) {
17525
+ function prefixIssues(path16, issues) {
17526
17526
  return issues.map((iss) => {
17527
17527
  var _a3;
17528
17528
  (_a3 = iss).path ?? (_a3.path = []);
17529
- iss.path.unshift(path15);
17529
+ iss.path.unshift(path16);
17530
17530
  return iss;
17531
17531
  });
17532
17532
  }
@@ -31208,9 +31208,384 @@ async function requestTapAuthWithPat(manualPat, environment, options = {}) {
31208
31208
  return auth2;
31209
31209
  }
31210
31210
 
31211
- // src/maker/cli/skill.ts
31211
+ // src/maker/system/python.ts
31212
+ import { spawnSync as spawnSync4 } from "node:child_process";
31212
31213
  import fs6 from "node:fs";
31213
31214
  import path7 from "node:path";
31215
+ var PYTHON_INFO_SCRIPT = [
31216
+ "import json, sys",
31217
+ 'print(json.dumps({"executable": sys.executable, "version": ".".join(map(str, sys.version_info[:3]))}))'
31218
+ ].join("; ");
31219
+ var DEFAULT_PYTHON_VERSION = "3.12";
31220
+ var MINIMUM_PYTHON_VERSION = "3.8";
31221
+ var RECOMMENDED_PYTHON_VERSION = "3.12";
31222
+ function getMakerPythonConfigPath() {
31223
+ return path7.join(getMakerHome(), "python.json");
31224
+ }
31225
+ function getMakerUvInstallRoot() {
31226
+ return path7.join(getMakerHome(), "bin");
31227
+ }
31228
+ function getMakerUvPath(platform = process.platform) {
31229
+ return path7.join(getMakerUvInstallRoot(), platform === "win32" ? "uv.exe" : "uv");
31230
+ }
31231
+ function getMakerUvPythonInstallDir() {
31232
+ return path7.join(getMakerHome(), "python", "uv");
31233
+ }
31234
+ function checkMakerPythonEnvironment(options = {}) {
31235
+ const platform = options.platform || process.platform;
31236
+ const runner = options.spawn || spawnSync4;
31237
+ const env = options.env || process.env;
31238
+ const uvPath = getMakerUvPath(platform);
31239
+ const setupCommand = "taptap-maker python setup";
31240
+ const pathCommand = "taptap-maker python path";
31241
+ const base = {
31242
+ platform,
31243
+ configPath: getMakerPythonConfigPath(),
31244
+ setupCommand,
31245
+ pathCommand,
31246
+ uv: {
31247
+ path: uvPath,
31248
+ installed: fs6.existsSync(uvPath),
31249
+ version: readUvVersion(uvPath, runner)
31250
+ }
31251
+ };
31252
+ const configuredPython = env.TAPTAP_MAKER_PYTHON_BIN;
31253
+ if (configuredPython) {
31254
+ const result = inspectPythonCandidate(
31255
+ { provider: "configured", command: configuredPython },
31256
+ runner
31257
+ );
31258
+ if (result) {
31259
+ return resultToEnvironment(result, base);
31260
+ }
31261
+ }
31262
+ const saved = loadPythonRuntimeConfig();
31263
+ if (saved == null ? void 0 : saved.python) {
31264
+ const result = inspectPythonCandidate(
31265
+ { provider: saved.provider || "configured", command: saved.python },
31266
+ runner
31267
+ );
31268
+ if (result && !isUnsupportedSystemPython(platform, result.executable, result.provider)) {
31269
+ return resultToEnvironment(result, base);
31270
+ }
31271
+ }
31272
+ let sawWindowsStoreAlias = false;
31273
+ let unsupportedSystemPython;
31274
+ let fallbackEnvironment;
31275
+ for (const candidate of createPythonCandidates(platform, runner)) {
31276
+ if (candidate.command === "__windows_store_alias__") {
31277
+ sawWindowsStoreAlias = true;
31278
+ continue;
31279
+ }
31280
+ const result = inspectPythonCandidate(candidate, runner);
31281
+ if (result) {
31282
+ if (isUnsupportedSystemPython(platform, result.executable, result.provider)) {
31283
+ unsupportedSystemPython = result.executable;
31284
+ continue;
31285
+ }
31286
+ const environment = resultToEnvironment(result, base);
31287
+ if (environment.ready) {
31288
+ return environment;
31289
+ }
31290
+ fallbackEnvironment ||= environment;
31291
+ }
31292
+ }
31293
+ if (fallbackEnvironment) {
31294
+ return fallbackEnvironment;
31295
+ }
31296
+ const status = sawWindowsStoreAlias ? "store_alias_only" : "missing";
31297
+ return {
31298
+ ...base,
31299
+ ready: false,
31300
+ status,
31301
+ missing: ["python"],
31302
+ 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。"
31304
+ };
31305
+ }
31306
+ function setupMakerPythonEnvironment(options = {}) {
31307
+ const before = checkMakerPythonEnvironment(options);
31308
+ if (before.ready) {
31309
+ savePythonRuntimeConfig(before);
31310
+ return { changed: false, environment: before, uvInstalled: before.uv.installed };
31311
+ }
31312
+ const platform = options.platform || process.platform;
31313
+ 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
+ {
31320
+ encoding: "utf8",
31321
+ env: uvEnv
31322
+ }
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.");
31338
+ }
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
+ }
31353
+ function formatMakerPythonEnvironmentStatus(environment) {
31354
+ return [
31355
+ "Python environment",
31356
+ "",
31357
+ `- python_status: ${environment.status}`,
31358
+ `- ready: ${environment.ready ? "yes" : "no"}`,
31359
+ environment.provider ? `- provider: ${environment.provider}` : "",
31360
+ environment.python ? `- python: ${environment.python}` : "",
31361
+ environment.version ? `- python_version: ${environment.version}` : "",
31362
+ `- python_version_requirement: >=${MINIMUM_PYTHON_VERSION}`,
31363
+ `- recommended_python_version: >=${RECOMMENDED_PYTHON_VERSION}`,
31364
+ environment.pipVersion ? `- pip_version: ${environment.pipVersion}` : "",
31365
+ `- config: ${environment.configPath}`,
31366
+ `- uv_installed: ${environment.uv.installed ? "yes" : "no"}`,
31367
+ `- uv_path: ${environment.uv.path}`,
31368
+ environment.uv.version ? `- uv_version: ${environment.uv.version}` : "",
31369
+ `- missing: ${environment.missing.join(", ") || "(none)"}`,
31370
+ environment.error ? `- error: ${environment.error}` : "",
31371
+ environment.warning ? `- warning: ${environment.warning}` : "",
31372
+ `- setup_command: ${environment.setupCommand}`,
31373
+ `- path_command: ${environment.pathCommand}`,
31374
+ `- next_action: ${environment.nextAction}`
31375
+ ].filter(Boolean).join("\n");
31376
+ }
31377
+ function createPythonCandidates(platform, runner) {
31378
+ if (platform === "win32") {
31379
+ const candidates = [
31380
+ { provider: "system", command: "py", argsPrefix: ["-3"] }
31381
+ ];
31382
+ const where = runner("where.exe", ["python"], { encoding: "utf8" });
31383
+ const paths = where.status === 0 ? where.stdout.split(/\r?\n/).map((line) => line.trim()).filter(Boolean) : [];
31384
+ let sawStoreAlias = false;
31385
+ for (const item of paths) {
31386
+ if (isWindowsStorePythonAlias(item)) {
31387
+ sawStoreAlias = true;
31388
+ continue;
31389
+ }
31390
+ candidates.push({ provider: "system", command: item });
31391
+ }
31392
+ if (sawStoreAlias) {
31393
+ candidates.push({ provider: "system", command: "__windows_store_alias__" });
31394
+ }
31395
+ return candidates;
31396
+ }
31397
+ return [
31398
+ { provider: "system", command: "python3" },
31399
+ { provider: "system", command: "python" }
31400
+ ];
31401
+ }
31402
+ function inspectPythonCandidate(candidate, runner) {
31403
+ const infoArgs = [...candidate.argsPrefix || [], "-c", PYTHON_INFO_SCRIPT];
31404
+ const info = runner(candidate.command, infoArgs, { encoding: "utf8" });
31405
+ if (info.status !== 0 || !info.stdout.trim()) {
31406
+ return void 0;
31407
+ }
31408
+ const parsed = parsePythonInfo(info.stdout);
31409
+ if (!(parsed == null ? void 0 : parsed.executable) || !parsed.version) {
31410
+ return void 0;
31411
+ }
31412
+ const pip = runner(parsed.executable, ["-m", "pip", "--version"], { encoding: "utf8" });
31413
+ return {
31414
+ ...parsed,
31415
+ provider: candidate.provider,
31416
+ pipVersion: pip.status === 0 ? pip.stdout.trim() : void 0
31417
+ };
31418
+ }
31419
+ function resultToEnvironment(result, base) {
31420
+ const versionStatus = comparePythonVersion(result.version, MINIMUM_PYTHON_VERSION);
31421
+ if (versionStatus !== void 0 && versionStatus < 0) {
31422
+ return {
31423
+ ...base,
31424
+ ready: false,
31425
+ status: "version_unsupported",
31426
+ provider: result.provider,
31427
+ python: result.executable,
31428
+ version: result.version,
31429
+ pipVersion: result.pipVersion,
31430
+ missing: [`python>=${MINIMUM_PYTHON_VERSION}`],
31431
+ 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}。`
31433
+ };
31434
+ }
31435
+ const ready = Boolean(result.pipVersion);
31436
+ const shouldRecommendUpgrade = ready && versionStatus !== void 0 && comparePythonVersion(result.version, RECOMMENDED_PYTHON_VERSION) < 0;
31437
+ return {
31438
+ ...base,
31439
+ ready,
31440
+ status: ready ? "ready" : "pip_missing",
31441
+ provider: result.provider,
31442
+ python: result.executable,
31443
+ version: result.version,
31444
+ pipVersion: result.pipVersion,
31445
+ missing: ready ? [] : ["pip"],
31446
+ 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。"
31448
+ };
31449
+ }
31450
+ function ensureUvInstalled(platform, runner) {
31451
+ const uvPath = getMakerUvPath(platform);
31452
+ if (fs6.existsSync(uvPath)) {
31453
+ return uvPath;
31454
+ }
31455
+ fs6.mkdirSync(getMakerUvInstallRoot(), { recursive: true });
31456
+ const env = {
31457
+ ...process.env,
31458
+ INSTALLER_NO_MODIFY_PATH: "1",
31459
+ UV_INSTALL_DIR: getMakerUvInstallRoot()
31460
+ };
31461
+ const install = platform === "win32" ? runner(
31462
+ "powershell.exe",
31463
+ [
31464
+ "-NoProfile",
31465
+ "-ExecutionPolicy",
31466
+ "ByPass",
31467
+ "-Command",
31468
+ "irm https://astral.sh/uv/install.ps1 | iex"
31469
+ ],
31470
+ { encoding: "utf8", env }
31471
+ ) : runner("sh", ["-c", "curl -LsSf https://astral.sh/uv/install.sh | sh"], {
31472
+ encoding: "utf8",
31473
+ env
31474
+ });
31475
+ if (install.status !== 0) {
31476
+ throw new Error(formatSetupFailure("uv installer failed", install));
31477
+ }
31478
+ if (!fs6.existsSync(uvPath)) {
31479
+ const nestedUvPath = path7.join(
31480
+ getMakerUvInstallRoot(),
31481
+ "bin",
31482
+ platform === "win32" ? "uv.exe" : "uv"
31483
+ );
31484
+ if (fs6.existsSync(nestedUvPath)) {
31485
+ return nestedUvPath;
31486
+ }
31487
+ throw new Error(`uv installer finished, but ${uvPath} was not created.`);
31488
+ }
31489
+ return uvPath;
31490
+ }
31491
+ function createUvPythonEnv() {
31492
+ return {
31493
+ ...process.env,
31494
+ UV_PYTHON_INSTALL_DIR: getMakerUvPythonInstallDir(),
31495
+ UV_CACHE_DIR: path7.join(getMakerHome(), "cache", "uv")
31496
+ };
31497
+ }
31498
+ function readUvVersion(uvPath, runner) {
31499
+ if (!fs6.existsSync(uvPath)) {
31500
+ return void 0;
31501
+ }
31502
+ const result = runner(uvPath, ["--version"], { encoding: "utf8" });
31503
+ return result.status === 0 ? result.stdout.trim() || void 0 : void 0;
31504
+ }
31505
+ function parsePythonInfo(stdout) {
31506
+ try {
31507
+ const data = JSON.parse(stdout.trim().split(/\r?\n/).at(-1) || "{}");
31508
+ if (typeof data.executable === "string" && typeof data.version === "string") {
31509
+ return { executable: data.executable, version: data.version };
31510
+ }
31511
+ } catch {
31512
+ return void 0;
31513
+ }
31514
+ return void 0;
31515
+ }
31516
+ function isWindowsStorePythonAlias(value) {
31517
+ return /\\Microsoft\\WindowsApps\\python(?:3)?\.exe$/i.test(value);
31518
+ }
31519
+ function isUnsupportedSystemPython(platform, executable, provider) {
31520
+ if (provider !== "system" || platform !== "darwin") {
31521
+ return false;
31522
+ }
31523
+ return executable === "/usr/bin/python3" || executable.startsWith("/Applications/Xcode.app/") || executable.startsWith("/Library/Developer/CommandLineTools/");
31524
+ }
31525
+ function comparePythonVersion(version2, target) {
31526
+ const left = parseVersionTuple(version2);
31527
+ const right = parseVersionTuple(target);
31528
+ if (!left || !right) {
31529
+ return 0;
31530
+ }
31531
+ for (let index = 0; index < Math.max(left.length, right.length); index += 1) {
31532
+ const leftPart = left[index] || 0;
31533
+ const rightPart = right[index] || 0;
31534
+ if (leftPart > rightPart) {
31535
+ return 1;
31536
+ }
31537
+ if (leftPart < rightPart) {
31538
+ return -1;
31539
+ }
31540
+ }
31541
+ return 0;
31542
+ }
31543
+ function parseVersionTuple(version2) {
31544
+ const match = /^(\d+)(?:\.(\d+))?(?:\.(\d+))?/.exec(version2.trim());
31545
+ if (!match) {
31546
+ return void 0;
31547
+ }
31548
+ return match.slice(1).map((part) => part === void 0 ? 0 : Number(part));
31549
+ }
31550
+ function loadPythonRuntimeConfig() {
31551
+ const configPath = getMakerPythonConfigPath();
31552
+ if (!fs6.existsSync(configPath)) {
31553
+ return void 0;
31554
+ }
31555
+ try {
31556
+ const data = JSON.parse(fs6.readFileSync(configPath, "utf8"));
31557
+ return typeof data.python === "string" ? data : void 0;
31558
+ } catch {
31559
+ return void 0;
31560
+ }
31561
+ }
31562
+ function savePythonRuntimeConfig(environment) {
31563
+ if (!environment.python) {
31564
+ return;
31565
+ }
31566
+ const config2 = {
31567
+ provider: environment.provider,
31568
+ python: environment.python,
31569
+ version: environment.version,
31570
+ saved_at: (/* @__PURE__ */ new Date()).toISOString()
31571
+ };
31572
+ fs6.mkdirSync(path7.dirname(getMakerPythonConfigPath()), { recursive: true });
31573
+ fs6.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
31574
+ }
31575
+ function formatSetupFailure(message, result) {
31576
+ var _a3, _b, _c;
31577
+ return [
31578
+ message,
31579
+ `- status: ${result.status ?? "(none)"}`,
31580
+ ((_a3 = result.error) == null ? void 0 : _a3.message) ? `- error: ${result.error.message}` : "",
31581
+ ((_b = result.stderr) == null ? void 0 : _b.trim()) ? `- stderr: ${result.stderr.trim()}` : "",
31582
+ ((_c = result.stdout) == null ? void 0 : _c.trim()) ? `- stdout: ${result.stdout.trim()}` : ""
31583
+ ].filter(Boolean).join("\n");
31584
+ }
31585
+
31586
+ // src/maker/cli/skill.ts
31587
+ import fs7 from "node:fs";
31588
+ import path8 from "node:path";
31214
31589
  import { fileURLToPath } from "node:url";
31215
31590
  var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
31216
31591
  var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
@@ -31229,7 +31604,7 @@ var BUNDLED_SKILLS = [
31229
31604
  function formatMakerSkillStatus(_options = {}) {
31230
31605
  const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
31231
31606
  name: skill.name,
31232
- path: path7.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
31607
+ path: path8.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
31233
31608
  }));
31234
31609
  return [
31235
31610
  "TapTap Maker workflow guide documents",
@@ -31262,11 +31637,11 @@ function formatMakerSkillStatus(_options = {}) {
31262
31637
  }
31263
31638
  function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
31264
31639
  const candidates = [
31265
- path7.join(process.cwd(), "skills", skillName),
31640
+ path8.join(process.cwd(), "skills", skillName),
31266
31641
  getBundledSkillSourceDir(skillName)
31267
31642
  ].filter(Boolean);
31268
31643
  for (const candidate of candidates) {
31269
- if (fs6.existsSync(path7.join(candidate, "SKILL.md"))) {
31644
+ if (fs7.existsSync(path8.join(candidate, "SKILL.md"))) {
31270
31645
  return candidate;
31271
31646
  }
31272
31647
  }
@@ -31279,13 +31654,13 @@ function getBundledSkillSourceDir(skillName) {
31279
31654
  return null;
31280
31655
  }
31281
31656
  const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
31282
- const packageRoot = path7.dirname(path7.dirname(bundlePath));
31283
- return path7.join(packageRoot, "skills", skillName);
31657
+ const packageRoot = path8.dirname(path8.dirname(bundlePath));
31658
+ return path8.join(packageRoot, "skills", skillName);
31284
31659
  }
31285
31660
 
31286
31661
  // src/maker/server/runtimeLogs.ts
31287
- import fs7 from "node:fs";
31288
- import path8 from "node:path";
31662
+ import fs8 from "node:fs";
31663
+ import path9 from "node:path";
31289
31664
  var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
31290
31665
  var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
31291
31666
  var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
@@ -31426,19 +31801,19 @@ async function pullRuntimeLogs(options) {
31426
31801
  }
31427
31802
  function resetRuntimeLogs(projectRoot) {
31428
31803
  const runtimeDir = getRuntimeLogDir(projectRoot);
31429
- fs7.mkdirSync(runtimeDir, { recursive: true });
31804
+ fs8.mkdirSync(runtimeDir, { recursive: true });
31430
31805
  for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
31431
- fs7.rmSync(path8.join(runtimeDir, file2), { force: true });
31806
+ fs8.rmSync(path9.join(runtimeDir, file2), { force: true });
31432
31807
  }
31433
31808
  return runtimeDir;
31434
31809
  }
31435
31810
  function readRuntimeLogState(projectRoot) {
31436
31811
  const statePath = getRuntimeLogStatePath(projectRoot);
31437
- if (!fs7.existsSync(statePath)) {
31812
+ if (!fs8.existsSync(statePath)) {
31438
31813
  return null;
31439
31814
  }
31440
31815
  try {
31441
- const state = JSON.parse(fs7.readFileSync(statePath, "utf8"));
31816
+ const state = JSON.parse(fs8.readFileSync(statePath, "utf8"));
31442
31817
  return isRuntimeLogState(state) ? state : null;
31443
31818
  } catch {
31444
31819
  return null;
@@ -31466,9 +31841,9 @@ function normalizeRuntimeLogQueryResult(result) {
31466
31841
  };
31467
31842
  }
31468
31843
  function writeRuntimeLogRawResponse(projectRoot, raw) {
31469
- const rawPath = path8.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
31470
- fs7.mkdirSync(path8.dirname(rawPath), { recursive: true });
31471
- fs7.writeFileSync(
31844
+ const rawPath = path9.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
31845
+ fs8.mkdirSync(path9.dirname(rawPath), { recursive: true });
31846
+ fs8.writeFileSync(
31472
31847
  rawPath,
31473
31848
  `${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
31474
31849
  `,
@@ -31477,7 +31852,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
31477
31852
  return rawPath;
31478
31853
  }
31479
31854
  function appendRuntimeLogs(projectRoot, logs) {
31480
- fs7.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
31855
+ fs8.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
31481
31856
  if (logs.length === 0) {
31482
31857
  return { files: [], written: 0 };
31483
31858
  }
@@ -31485,7 +31860,7 @@ function appendRuntimeLogs(projectRoot, logs) {
31485
31860
  let written = 0;
31486
31861
  for (const log of logs) {
31487
31862
  const line = JSON.stringify(compactRuntimeLogEntry(log));
31488
- fs7.appendFileSync(filePath, `${line}
31863
+ fs8.appendFileSync(filePath, `${line}
31489
31864
  `, "utf8");
31490
31865
  written += 1;
31491
31866
  }
@@ -31493,11 +31868,11 @@ function appendRuntimeLogs(projectRoot, logs) {
31493
31868
  }
31494
31869
  function writeRuntimeLogState(projectRoot, state) {
31495
31870
  const statePath = getRuntimeLogStatePath(projectRoot);
31496
- fs7.mkdirSync(path8.dirname(statePath), { recursive: true });
31871
+ fs8.mkdirSync(path9.dirname(statePath), { recursive: true });
31497
31872
  const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
31498
- fs7.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
31873
+ fs8.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
31499
31874
  `, "utf8");
31500
- fs7.renameSync(tempPath, statePath);
31875
+ fs8.renameSync(tempPath, statePath);
31501
31876
  }
31502
31877
  function writeRuntimeLogFailureState(projectRoot, options) {
31503
31878
  const nowIso = new Date(options.nowMs()).toISOString();
@@ -31529,13 +31904,13 @@ function isNonRetryableRuntimeLogError(error2) {
31529
31904
  );
31530
31905
  }
31531
31906
  function getRuntimeLogDir(projectRoot) {
31532
- return path8.join(projectRoot, ".maker", "logs", "runtime");
31907
+ return path9.join(projectRoot, ".maker", "logs", "runtime");
31533
31908
  }
31534
31909
  function getRuntimeLogStatePath(projectRoot) {
31535
- return path8.join(getRuntimeLogDir(projectRoot), "state.json");
31910
+ return path9.join(getRuntimeLogDir(projectRoot), "state.json");
31536
31911
  }
31537
31912
  function getRuntimeLogPath(projectRoot) {
31538
- return path8.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
31913
+ return path9.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
31539
31914
  }
31540
31915
  function resolveNextRuntimeLogCursor(result) {
31541
31916
  const maxLogTime = result.logs.reduce((max, log) => {
@@ -31660,8 +32035,8 @@ function compactRuntimeLogEntry(entry) {
31660
32035
  }
31661
32036
 
31662
32037
  // src/maker/server/proxyAssets.ts
31663
- import fs8 from "node:fs";
31664
- import path9 from "node:path";
32038
+ import fs9 from "node:fs";
32039
+ import path10 from "node:path";
31665
32040
  var IMAGE_ASSET_DIRS = ["assets/image"];
31666
32041
  var VIDEO_ASSET_DIRS = ["assets/video"];
31667
32042
  var AUDIO_ASSET_DIRS = ["assets/audio"];
@@ -31905,8 +32280,8 @@ async function materializeAsset(options) {
31905
32280
  };
31906
32281
  }
31907
32282
  const bytes = Buffer.from(await response.arrayBuffer());
31908
- fs8.mkdirSync(path9.dirname(absolutePath), { recursive: true });
31909
- fs8.writeFileSync(absolutePath, bytes);
32283
+ fs9.mkdirSync(path10.dirname(absolutePath), { recursive: true });
32284
+ fs9.writeFileSync(absolutePath, bytes);
31910
32285
  return { localPath: relativePath, absolutePath, download: { success: true } };
31911
32286
  } catch (error2) {
31912
32287
  return {
@@ -31920,12 +32295,12 @@ async function materializeAsset(options) {
31920
32295
  function createUniqueAssetPath(options) {
31921
32296
  const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
31922
32297
  for (let index = 1; index <= 9999; index += 1) {
31923
- const relativePath = path9.posix.join(
32298
+ const relativePath = path10.posix.join(
31924
32299
  options.relativeDir,
31925
32300
  `${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
31926
32301
  );
31927
- const absolutePath = path9.join(options.targetDir, ...relativePath.split("/"));
31928
- if (!fs8.existsSync(absolutePath)) {
32302
+ const absolutePath = path10.join(options.targetDir, ...relativePath.split("/"));
32303
+ if (!fs9.existsSync(absolutePath)) {
31929
32304
  return { relativePath, absolutePath };
31930
32305
  }
31931
32306
  }
@@ -32008,7 +32383,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
32008
32383
  if (!isKnownAssetPath(localPath, assetDirs)) {
32009
32384
  return false;
32010
32385
  }
32011
- const basename = path9.posix.basename(localPath);
32386
+ const basename = path10.posix.basename(localPath);
32012
32387
  const stem = basename.replace(/\.[^.]+$/, "");
32013
32388
  return basename === value || stem === value || record2.name === value || record2.taskId === value;
32014
32389
  });
@@ -32021,13 +32396,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
32021
32396
  }
32022
32397
  function findLocalAssetByName(targetDir, value, assetDirs) {
32023
32398
  var _a3;
32024
- const hasExtension = Boolean(path9.extname(value));
32399
+ const hasExtension = Boolean(path10.extname(value));
32025
32400
  const candidates = [];
32026
32401
  for (const assetDir of assetDirs) {
32027
- const absoluteDir = path9.join(targetDir, ...assetDir.split("/"));
32402
+ const absoluteDir = path10.join(targetDir, ...assetDir.split("/"));
32028
32403
  let entries;
32029
32404
  try {
32030
- entries = fs8.readdirSync(absoluteDir);
32405
+ entries = fs9.readdirSync(absoluteDir);
32031
32406
  } catch {
32032
32407
  continue;
32033
32408
  }
@@ -32036,11 +32411,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
32036
32411
  if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
32037
32412
  continue;
32038
32413
  }
32039
- const absolutePath = path9.join(absoluteDir, entry);
32414
+ const absolutePath = path10.join(absoluteDir, entry);
32040
32415
  try {
32041
32416
  candidates.push({
32042
- localPath: path9.posix.join(assetDir, entry),
32043
- mtimeMs: fs8.statSync(absolutePath).mtimeMs
32417
+ localPath: path10.posix.join(assetDir, entry),
32418
+ mtimeMs: fs9.statSync(absolutePath).mtimeMs
32044
32419
  });
32045
32420
  } catch {
32046
32421
  }
@@ -32050,7 +32425,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
32050
32425
  return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
32051
32426
  }
32052
32427
  function isKnownAssetPath(relativePath, assetDirs) {
32053
- if (relativePath.startsWith("../") || path9.isAbsolute(relativePath)) {
32428
+ if (relativePath.startsWith("../") || path10.isAbsolute(relativePath)) {
32054
32429
  return false;
32055
32430
  }
32056
32431
  return assetDirs.some(
@@ -32064,31 +32439,31 @@ function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
32064
32439
  const registry2 = readGeneratedAssetRegistry(targetDir);
32065
32440
  registry2[localPath] = record2;
32066
32441
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
32067
- fs8.mkdirSync(path9.dirname(registryPath), { recursive: true });
32068
- fs8.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
32442
+ fs9.mkdirSync(path10.dirname(registryPath), { recursive: true });
32443
+ fs9.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
32069
32444
  `, "utf8");
32070
32445
  }
32071
32446
  function readGeneratedAssetRegistry(targetDir) {
32072
32447
  const registryPath = getGeneratedAssetRegistryPath(targetDir);
32073
- if (!fs8.existsSync(registryPath)) {
32448
+ if (!fs9.existsSync(registryPath)) {
32074
32449
  return {};
32075
32450
  }
32076
32451
  try {
32077
- const parsed = JSON.parse(fs8.readFileSync(registryPath, "utf8"));
32452
+ const parsed = JSON.parse(fs9.readFileSync(registryPath, "utf8"));
32078
32453
  return isRecord(parsed) ? parsed : {};
32079
32454
  } catch {
32080
32455
  return {};
32081
32456
  }
32082
32457
  }
32083
32458
  function getGeneratedAssetRegistryPath(targetDir) {
32084
- return path9.join(targetDir, ".maker", "assets", "generated-assets.json");
32459
+ return path10.join(targetDir, ".maker", "assets", "generated-assets.json");
32085
32460
  }
32086
32461
  function normalizeAssetRegistryKey(targetDir, value) {
32087
32462
  if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
32088
32463
  return void 0;
32089
32464
  }
32090
- const relative = path9.isAbsolute(value) ? path9.relative(targetDir, value) : value;
32091
- return relative.split(path9.sep).join("/");
32465
+ const relative = path10.isAbsolute(value) ? path10.relative(targetDir, value) : value;
32466
+ return relative.split(path10.sep).join("/");
32092
32467
  }
32093
32468
  function isRecord(value) {
32094
32469
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -32117,7 +32492,7 @@ function extensionFromUrl(url2) {
32117
32492
  }
32118
32493
  try {
32119
32494
  const pathname = new URL(url2).pathname;
32120
- const extension = path9.extname(pathname).replace(/^\./, "").toLowerCase();
32495
+ const extension = path10.extname(pathname).replace(/^\./, "").toLowerCase();
32121
32496
  return extension || void 0;
32122
32497
  } catch {
32123
32498
  return void 0;
@@ -32125,7 +32500,7 @@ function extensionFromUrl(url2) {
32125
32500
  }
32126
32501
 
32127
32502
  // src/maker/server/mcp.ts
32128
- var VERSION = true ? "0.0.12" : "dev";
32503
+ var VERSION = true ? "0.0.14" : "dev";
32129
32504
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
32130
32505
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
32131
32506
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -32152,7 +32527,7 @@ var MakerCloneFailedError = class extends Error {
32152
32527
  var tools = [
32153
32528
  {
32154
32529
  name: "maker_status_lite",
32155
- 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, 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.",
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.",
32156
32531
  inputSchema: {
32157
32532
  type: "object",
32158
32533
  properties: {
@@ -32169,7 +32544,7 @@ var tools = [
32169
32544
  },
32170
32545
  {
32171
32546
  name: "maker_build_current_directory",
32172
- 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. 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. If local changes or committed-but-unpushed commits exist, the tool commits when needed, pushes to Maker remote, then triggers remote Maker build. 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.',
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.',
32173
32548
  inputSchema: {
32174
32549
  type: "object",
32175
32550
  properties: {
@@ -32212,7 +32587,7 @@ var tools = [
32212
32587
  },
32213
32588
  message: {
32214
32589
  type: "string",
32215
- description: "Optional commit message used when local file changes need to be committed before build."
32590
+ description: "Optional commit message used when local changes or the empty wake-up commit need to be committed before build."
32216
32591
  },
32217
32592
  files: {
32218
32593
  type: "array",
@@ -32221,7 +32596,7 @@ var tools = [
32221
32596
  },
32222
32597
  confirm_remote_build_without_submit: {
32223
32598
  type: "boolean",
32224
- description: "Set true only after the user explicitly confirms they do not want to submit local changes and want to build the current Maker remote committed version."
32599
+ description: "Set true only after the user explicitly confirms they do not want to submit local changes and want to build the current Maker remote committed version. This mode opens and returns the Maker app page URL before remote build."
32225
32600
  }
32226
32601
  }
32227
32602
  }
@@ -32482,6 +32857,8 @@ async function formatStatus(options = {}) {
32482
32857
  const targetDir = resolveMakerToolTargetDir(options.targetDir);
32483
32858
  const env = getMakerEnvironment(void 0, targetDir);
32484
32859
  const identify = identifyMakerProject({ cwd: targetDir });
32860
+ const mcpCwd = process.cwd();
32861
+ const mcpCwdIdentify = path11.resolve(mcpCwd) === path11.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
32485
32862
  const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
32486
32863
  const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
32487
32864
  const pat = loadPat();
@@ -32505,6 +32882,7 @@ async function formatStatus(options = {}) {
32505
32882
  }
32506
32883
  }
32507
32884
  const git = checkGitEnvironment();
32885
+ const python = checkMakerPythonEnvironment();
32508
32886
  const projectSection = identify.projectId ? [
32509
32887
  "目标目录已绑定 Maker 项目。",
32510
32888
  "请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
@@ -32527,8 +32905,17 @@ async function formatStatus(options = {}) {
32527
32905
  "",
32528
32906
  formatGitEnvironmentStatus(git),
32529
32907
  "",
32908
+ formatMakerPythonEnvironmentStatus(python),
32909
+ "",
32530
32910
  formatMakerGitDirectoryStatus(gitDirectoryStatus),
32531
32911
  "",
32912
+ formatMakerToolRegistrationCwdStatus({
32913
+ mcpCwd,
32914
+ targetDir,
32915
+ projectRoot: identify.projectRoot,
32916
+ mcpProjectRoot: mcpCwdIdentify.projectRoot
32917
+ }),
32918
+ "",
32532
32919
  remoteSyncText,
32533
32920
  "",
32534
32921
  identify.projectRoot ? await formatMakerProxyToolsStatusSafely({ targetDir: identify.projectRoot }) : "",
@@ -32584,6 +32971,29 @@ async function formatMakerRemoteSyncStatusSafely(projectRoot) {
32584
32971
  return formatMakerRemoteSyncUnavailable(error2);
32585
32972
  }
32586
32973
  }
32974
+ function formatMakerToolRegistrationCwdStatus(options) {
32975
+ if (!options.projectRoot) {
32976
+ return "";
32977
+ }
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;
32982
+ if (mcpProjectRoot === projectRoot) {
32983
+ return "";
32984
+ }
32985
+ return [
32986
+ "MCP tool registration cwd",
32987
+ "",
32988
+ "- status: mismatch",
32989
+ `- mcp_cwd: ${mcpCwd}`,
32990
+ `- inspected_target_dir: ${targetDir}`,
32991
+ `- maker_project_dir: ${projectRoot}`,
32992
+ `- mcp_cwd_project_dir: ${mcpProjectRoot || "(none)"}`,
32993
+ "- impact: Maker proxy tools may not appear in this MCP session because tools/list used the MCP server cwd.",
32994
+ "- next_action: Start Claude Code from the Maker project directory, or set the taptap-maker MCP config cwd to maker_project_dir, then Reconnect taptap-maker in /mcp."
32995
+ ].join("\n");
32996
+ }
32587
32997
  async function formatMakerProxyToolsStatusSafely(options) {
32588
32998
  try {
32589
32999
  const listedRemoteTools = options.listRemoteTools ?? (() => listRemoteProxyTools({
@@ -32730,7 +33140,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
32730
33140
  }
32731
33141
  function resolveMakerToolTargetDir(targetDir) {
32732
33142
  if (targetDir) {
32733
- return path10.resolve(targetDir);
33143
+ return path11.resolve(targetDir);
32734
33144
  }
32735
33145
  return process.cwd();
32736
33146
  }
@@ -32830,14 +33240,14 @@ function formatStatusProjectList(projects) {
32830
33240
  ].filter((line) => line !== void 0).join("\n");
32831
33241
  }
32832
33242
  function formatClonePartialStateLines(targetDir) {
32833
- const resolvedTargetDir = path10.resolve(targetDir);
33243
+ const resolvedTargetDir = path11.resolve(targetDir);
32834
33244
  const identify = identifyMakerProject({ cwd: resolvedTargetDir });
32835
33245
  const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
32836
33246
  const devKitStatus = inspectAiDevKit(resolvedTargetDir);
32837
- const stagedDevKitGitignorePath = path10.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
33247
+ const stagedDevKitGitignorePath = path11.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
32838
33248
  const projectBound = Boolean(identify.projectId);
32839
33249
  const gitInitialized = Boolean(
32840
- gitStatus.isOwnGitRoot || fs9.existsSync(path10.join(resolvedTargetDir, ".git"))
33250
+ gitStatus.isOwnGitRoot || fs10.existsSync(path11.join(resolvedTargetDir, ".git"))
32841
33251
  );
32842
33252
  const safeToRetry = !projectBound;
32843
33253
  return [
@@ -32851,7 +33261,7 @@ function formatClonePartialStateLines(targetDir) {
32851
33261
  identify.configPath ? `- config: ${identify.configPath}` : "",
32852
33262
  `- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
32853
33263
  `- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
32854
- `- staged_dev_kit_gitignore: ${fs9.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
33264
+ `- staged_dev_kit_gitignore: ${fs10.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
32855
33265
  `- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
32856
33266
  safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
32857
33267
  ].filter(Boolean);
@@ -32924,7 +33334,7 @@ function resolveEmbeddedProxyCommand(options) {
32924
33334
  }
32925
33335
  return {
32926
33336
  command: process.execPath,
32927
- args: [path10.resolve(makerEntry), "__maker-proxy"]
33337
+ args: [path11.resolve(makerEntry), "__maker-proxy"]
32928
33338
  };
32929
33339
  }
32930
33340
  function createToolProgressReporter(progressToken, extra, operationName) {
@@ -33009,6 +33419,37 @@ function formatMakerAppWebUrl(projectId, env) {
33009
33419
  const makerEnv = env === "rnd" || env === "production" ? env : void 0;
33010
33420
  return `${getMakerWebUrl(makerEnv)}/app/${encodeURIComponent(projectId)}`;
33011
33421
  }
33422
+ function openRemoteBuildMakerPage(options) {
33423
+ const identify = identifyMakerProject({ cwd: options.targetDir });
33424
+ if (!identify.projectRoot || !identify.projectId) {
33425
+ throw new Error(
33426
+ `${options.targetDir} is not bound to a Maker project. Run taptap-maker init first.`
33427
+ );
33428
+ }
33429
+ const projectConfig = loadProjectConfig(identify.projectRoot);
33430
+ const projectId = (projectConfig == null ? void 0 : projectConfig.project_id) || identify.projectId;
33431
+ const env = getMakerEnvironment(options.env, identify.projectRoot);
33432
+ const url2 = formatMakerAppWebUrl(projectId, env);
33433
+ return (options.openMakerPage || openMakerPageInBrowser)(url2);
33434
+ }
33435
+ function openMakerPageInBrowser(url2) {
33436
+ var _a3;
33437
+ const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
33438
+ const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
33439
+ const result = spawnSync5(command, args, {
33440
+ stdio: "ignore",
33441
+ windowsHide: true,
33442
+ timeout: 5e3
33443
+ });
33444
+ if (result.error || result.status !== 0) {
33445
+ return {
33446
+ ok: false,
33447
+ url: url2,
33448
+ error: ((_a3 = result.error) == null ? void 0 : _a3.message) || `open command exited with status ${result.status ?? "unknown"}`
33449
+ };
33450
+ }
33451
+ return { ok: true, url: url2 };
33452
+ }
33012
33453
  var RemoteBuildFailedError = class extends Error {
33013
33454
  constructor(buildResult) {
33014
33455
  super(buildResult.resultText);
@@ -33019,18 +33460,19 @@ var RemoteBuildFailedError = class extends Error {
33019
33460
  async function buildCurrentDirectory(options) {
33020
33461
  var _a3;
33021
33462
  const localChanges = await readMakerProjectLocalChanges(options.targetDir);
33022
- if (localChanges.hasChanges && !options.confirmRemoteBuildWithoutSubmit) {
33463
+ if (!options.confirmRemoteBuildWithoutSubmit) {
33023
33464
  const config2 = loadProjectConfig(localChanges.projectRoot);
33024
33465
  (_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
33025
33466
  progress: 0,
33026
33467
  total: 100,
33027
33468
  phase: "sync",
33028
- message: "Syncing local Maker changes before remote build"
33469
+ message: localChanges.hasChanges ? "Syncing local Maker changes before remote build" : "Waking Maker build server before remote build"
33029
33470
  });
33030
33471
  const submitResult = await (options.submitLocalChanges || pushMakerProject)({
33031
33472
  cwd: localChanges.projectRoot,
33032
- message: options.message,
33473
+ message: options.message || (!localChanges.hasChanges ? "chore: wake maker build server" : void 0),
33033
33474
  files: options.files,
33475
+ allowEmpty: !localChanges.hasChanges,
33034
33476
  onProgress: options.onProgress
33035
33477
  });
33036
33478
  if (submitResult.failure || !submitResult.pushed && submitResult.status !== "clean") {
@@ -33058,8 +33500,12 @@ async function buildCurrentDirectory(options) {
33058
33500
  submitResult
33059
33501
  };
33060
33502
  }
33503
+ const makerPageOpen = openRemoteBuildMakerPage(options);
33061
33504
  try {
33062
- return await runRemoteBuildCurrentDirectory(options, options.targetDir);
33505
+ return {
33506
+ ...await runRemoteBuildCurrentDirectory(options, options.targetDir),
33507
+ makerPageOpen
33508
+ };
33063
33509
  } catch (error2) {
33064
33510
  if (error2 instanceof RemoteBuildFailedError) {
33065
33511
  return {
@@ -33067,7 +33513,8 @@ async function buildCurrentDirectory(options) {
33067
33513
  projectRoot: error2.buildResult.projectRoot,
33068
33514
  projectId: error2.buildResult.projectId,
33069
33515
  buildResult: error2.buildResult,
33070
- buildFailure: toMakerBuildFailure(error2)
33516
+ buildFailure: toMakerBuildFailure(error2),
33517
+ makerPageOpen
33071
33518
  };
33072
33519
  }
33073
33520
  throw error2;
@@ -33226,18 +33673,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
33226
33673
  }
33227
33674
  }
33228
33675
  async function startRuntimeLogWatch(buildResult) {
33229
- const runtimeDir = path10.join(buildResult.projectRoot, ".maker", "logs", "runtime");
33230
- fs9.mkdirSync(runtimeDir, { recursive: true });
33231
- const stdoutLog = path10.join(runtimeDir, "watcher.out.log");
33232
- const stderrLog = path10.join(runtimeDir, "watcher.err.log");
33233
- const pidFile = path10.join(runtimeDir, "watcher.pid");
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");
33234
33681
  const previous = stopExistingRuntimeLogWatcher(pidFile);
33235
- const outFd = fs9.openSync(stdoutLog, "a");
33236
- const errFd = fs9.openSync(stderrLog, "a");
33682
+ const outFd = fs10.openSync(stdoutLog, "a");
33683
+ const errFd = fs10.openSync(stderrLog, "a");
33237
33684
  const command = formatRuntimeLogWatchCommand(buildResult);
33238
33685
  if (previous.previousStopError) {
33239
- fs9.closeSync(outFd);
33240
- fs9.closeSync(errFd);
33686
+ fs10.closeSync(outFd);
33687
+ fs10.closeSync(errFd);
33241
33688
  return {
33242
33689
  started: false,
33243
33690
  command: command.text,
@@ -33300,18 +33747,18 @@ async function startRuntimeLogWatch(buildResult) {
33300
33747
  ...previous
33301
33748
  };
33302
33749
  } finally {
33303
- fs9.closeSync(outFd);
33304
- fs9.closeSync(errFd);
33750
+ fs10.closeSync(outFd);
33751
+ fs10.closeSync(errFd);
33305
33752
  }
33306
33753
  }
33307
33754
  function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33308
- if (!fs9.existsSync(pidFile)) {
33755
+ if (!fs10.existsSync(pidFile)) {
33309
33756
  return {};
33310
33757
  }
33311
33758
  const pidState = readRuntimeLogWatcherPidState(pidFile);
33312
33759
  const pid = pidState == null ? void 0 : pidState.pid;
33313
33760
  if (!Number.isInteger(pid) || pid <= 0) {
33314
- fs9.rmSync(pidFile, { force: true });
33761
+ fs10.rmSync(pidFile, { force: true });
33315
33762
  return {};
33316
33763
  }
33317
33764
  try {
@@ -33319,7 +33766,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33319
33766
  const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
33320
33767
  const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
33321
33768
  if (!verifiedCommand) {
33322
- fs9.rmSync(pidFile, { force: true });
33769
+ fs10.rmSync(pidFile, { force: true });
33323
33770
  return {
33324
33771
  previousPid: pid,
33325
33772
  previousStopped: false,
@@ -33329,7 +33776,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33329
33776
  process.kill(pid, "SIGTERM");
33330
33777
  const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
33331
33778
  if (stopped) {
33332
- fs9.rmSync(pidFile, { force: true });
33779
+ fs10.rmSync(pidFile, { force: true });
33333
33780
  return { previousPid: pid, previousStopped: true };
33334
33781
  }
33335
33782
  return {
@@ -33338,7 +33785,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33338
33785
  previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
33339
33786
  };
33340
33787
  } catch (error2) {
33341
- fs9.rmSync(pidFile, { force: true });
33788
+ fs10.rmSync(pidFile, { force: true });
33342
33789
  const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
33343
33790
  if (code === "ESRCH") {
33344
33791
  return { previousPid: pid, previousStopped: false };
@@ -33351,7 +33798,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
33351
33798
  }
33352
33799
  }
33353
33800
  function readRuntimeLogWatcherPidState(pidFile) {
33354
- const raw = fs9.readFileSync(pidFile, "utf8").trim();
33801
+ const raw = fs10.readFileSync(pidFile, "utf8").trim();
33355
33802
  if (!raw) {
33356
33803
  return null;
33357
33804
  }
@@ -33367,7 +33814,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
33367
33814
  }
33368
33815
  }
33369
33816
  function writeRuntimeLogWatcherPidFile(pidFile, state) {
33370
- fs9.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
33817
+ fs10.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
33371
33818
  `, "utf8");
33372
33819
  }
33373
33820
  function getProcessCommand(pid) {
@@ -33453,10 +33900,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
33453
33900
  };
33454
33901
  }
33455
33902
  function resolveMakerCliEntry() {
33456
- return process.argv[1] || path10.resolve(process.cwd(), "dist", "maker.js");
33903
+ return process.argv[1] || path11.resolve(process.cwd(), "dist", "maker.js");
33457
33904
  }
33458
33905
  function getRuntimeLogFilePath(projectRoot) {
33459
- return path10.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
33906
+ return path11.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
33460
33907
  }
33461
33908
  async function refreshMakerPreview(buildResult) {
33462
33909
  const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
@@ -33587,7 +34034,7 @@ function createBuildArgs(projectRoot, options) {
33587
34034
  if (options.scriptsPath) {
33588
34035
  buildArgs.scriptsPath = options.scriptsPath;
33589
34036
  }
33590
- if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs9.existsSync(path10.join(projectRoot, "scripts", "main.lua"))) {
34037
+ if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs10.existsSync(path11.join(projectRoot, "scripts", "main.lua"))) {
33591
34038
  buildArgs.entry = "main.lua";
33592
34039
  buildArgs.scriptsPath = "scripts";
33593
34040
  }
@@ -33599,7 +34046,7 @@ function createBuildArgs(projectRoot, options) {
33599
34046
  }
33600
34047
  if (options.multiplayer) {
33601
34048
  buildArgs.multiplayer = options.multiplayer;
33602
- } else if (!fs9.existsSync(path10.join(projectRoot, ".project", "settings.json"))) {
34049
+ } else if (!fs10.existsSync(path11.join(projectRoot, ".project", "settings.json"))) {
33603
34050
  buildArgs.multiplayer = { enabled: false };
33604
34051
  }
33605
34052
  return buildArgs;
@@ -33640,6 +34087,7 @@ function formatBuildResult(result, progressSummary) {
33640
34087
  "",
33641
34088
  `- project_root: ${result.projectRoot}`,
33642
34089
  `- project_id: ${result.projectId}`,
34090
+ ...formatMakerPageOpenLines(result.makerPageOpen),
33643
34091
  `- maker_url: ${result.buildResult.makerUrl || formatMakerAppWebUrl(result.buildResult.projectId, result.buildResult.env)}`,
33644
34092
  `- project_path: ${result.buildResult.projectPath}`,
33645
34093
  `- server_url: ${result.buildResult.serverUrl}`,
@@ -33713,6 +34161,7 @@ function formatBuildResult(result, progressSummary) {
33713
34161
  `- project_root: ${result.projectRoot}`,
33714
34162
  `- project_id: ${result.projectId}`,
33715
34163
  `- maker_url: ${result.makerUrl || formatMakerAppWebUrl(result.projectId, result.env)}`,
34164
+ ...formatMakerPageOpenLines(result.makerPageOpen),
33716
34165
  `- project_path: ${result.projectPath}`,
33717
34166
  `- server_url: ${result.serverUrl}`,
33718
34167
  `- env: ${result.env}`
@@ -33743,6 +34192,17 @@ function formatPreviewRefreshLines(result) {
33743
34192
  result.error ? `- preview_refresh_error: ${result.error}` : ""
33744
34193
  ].filter(Boolean);
33745
34194
  }
34195
+ function formatMakerPageOpenLines(result) {
34196
+ if (!result) {
34197
+ return [];
34198
+ }
34199
+ return [
34200
+ `- maker_page_open: ${result.ok ? "ok" : "failed"}`,
34201
+ `- maker_page_url: ${result.url}`,
34202
+ result.error ? `- maker_page_error: ${result.error}` : "",
34203
+ "- next_action: 已按“不提交,只构建云端版本”打开 Maker 远端页面;如果没有自动弹出,请手动打开 maker_page_url 后再查看构建结果。"
34204
+ ].filter(Boolean);
34205
+ }
33746
34206
  function formatRuntimeLogWatchNextActionLines(result) {
33747
34207
  var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
33748
34208
  const command = formatLocalShellCommand([
@@ -33761,11 +34221,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
33761
34221
  ((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
33762
34222
  `- watch_command: ${command}`,
33763
34223
  ((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
33764
- `- local_file: ${path10.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
34224
+ `- local_file: ${path11.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
33765
34225
  ((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
33766
34226
  ((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
33767
34227
  ((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
33768
- `- state_file: ${path10.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
34228
+ `- state_file: ${path11.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
33769
34229
  ((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
33770
34230
  ((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
33771
34231
  ((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
@@ -33880,16 +34340,16 @@ function indent(value) {
33880
34340
  }
33881
34341
 
33882
34342
  // src/maker/cli/commands.ts
33883
- import { spawnSync as spawnSync5 } from "node:child_process";
34343
+ import { spawnSync as spawnSync7 } from "node:child_process";
33884
34344
  import crypto2 from "node:crypto";
33885
- import fs10 from "node:fs";
34345
+ import fs11 from "node:fs";
33886
34346
  import os4 from "node:os";
33887
- import path11 from "node:path";
34347
+ import path12 from "node:path";
33888
34348
  import readline from "node:readline/promises";
33889
34349
  import { stdin as input, stdout as output } from "node:process";
33890
34350
 
33891
34351
  // src/maker/auth/cliLogin.ts
33892
- import { spawnSync as spawnSync4 } from "node:child_process";
34352
+ import { spawnSync as spawnSync6 } from "node:child_process";
33893
34353
  import crypto from "node:crypto";
33894
34354
  var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
33895
34355
  var DEFAULT_POLL_INTERVAL_MS = 1e3;
@@ -34008,7 +34468,7 @@ async function readJsonResponse(response) {
34008
34468
  function openBrowser(url2) {
34009
34469
  const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
34010
34470
  const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
34011
- const result = spawnSync4(command, args, {
34471
+ const result = spawnSync6(command, args, {
34012
34472
  stdio: "ignore",
34013
34473
  windowsHide: true
34014
34474
  });
@@ -34032,7 +34492,7 @@ function formatError2(error2) {
34032
34492
  // src/maker/cli/commands.ts
34033
34493
  var DEFAULT_MCP_NAME = "taptap-maker";
34034
34494
  var MAKER_NPM_PACKAGE = "@taptap/maker";
34035
- var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs"]);
34495
+ var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python"]);
34036
34496
  var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
34037
34497
  "json",
34038
34498
  "skip_confirm",
@@ -34094,6 +34554,10 @@ async function runMakerCli(argv) {
34094
34554
  await runLogsWatch(parsed, ctx);
34095
34555
  return;
34096
34556
  }
34557
+ if (command === "python") {
34558
+ await runPython(parsed, ctx);
34559
+ return;
34560
+ }
34097
34561
  throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
34098
34562
  }
34099
34563
  function parseArgs(argv) {
@@ -34143,7 +34607,7 @@ function toOptionKey(value) {
34143
34607
  }
34144
34608
  async function runInit(parsed, ctx) {
34145
34609
  rejectPackageOption(parsed);
34146
- const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
34610
+ const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
34147
34611
  const env = makerEnvOption(parsed);
34148
34612
  const skipConfirm = booleanOption(parsed, "skip_confirm");
34149
34613
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -34214,7 +34678,8 @@ async function runInit(parsed, ctx) {
34214
34678
  ides,
34215
34679
  env,
34216
34680
  pkg: MAKER_NPM_PACKAGE,
34217
- mcpName: DEFAULT_MCP_NAME
34681
+ mcpName: DEFAULT_MCP_NAME,
34682
+ cwd: targetDir
34218
34683
  });
34219
34684
  for (const result of installResults) {
34220
34685
  emit(ctx, "mcp_install", result.message, result);
@@ -34234,9 +34699,10 @@ async function runInit(parsed, ctx) {
34234
34699
  }
34235
34700
  async function runDoctor(parsed, ctx) {
34236
34701
  var _a3, _b;
34237
- const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
34702
+ const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
34238
34703
  const env = makerEnvOption(parsed);
34239
34704
  const git = checkGitEnvironment();
34705
+ const python = checkMakerPythonEnvironment();
34240
34706
  const pat = loadPat();
34241
34707
  const tapAuth = loadTapAuth();
34242
34708
  const identify = identifyMakerProject({ cwd: targetDir });
@@ -34252,6 +34718,7 @@ async function runDoctor(parsed, ctx) {
34252
34718
  pat: Boolean(pat),
34253
34719
  tap_auth: Boolean(tapAuth)
34254
34720
  },
34721
+ python,
34255
34722
  project: identify,
34256
34723
  dev_kit: devKit,
34257
34724
  dev_kit_update: devKitUpdate
@@ -34266,6 +34733,8 @@ async function runDoctor(parsed, ctx) {
34266
34733
  "Git",
34267
34734
  formatGitEnvironmentStatus(git),
34268
34735
  "",
34736
+ formatMakerPythonEnvironmentStatus(python),
34737
+ "",
34269
34738
  "Auth",
34270
34739
  `- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
34271
34740
  `- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
@@ -34289,6 +34758,65 @@ async function runDoctor(parsed, ctx) {
34289
34758
  ].filter(Boolean).join("\n")
34290
34759
  );
34291
34760
  }
34761
+ async function runPython(parsed, ctx) {
34762
+ const [, subcommand] = parsed.command;
34763
+ if (!subcommand || subcommand === "doctor") {
34764
+ const environment = checkMakerPythonEnvironment();
34765
+ if (ctx.json) {
34766
+ writeJson(environment);
34767
+ return;
34768
+ }
34769
+ process.stdout.write(`${formatMakerPythonEnvironmentStatus(environment)}
34770
+ `);
34771
+ return;
34772
+ }
34773
+ if (subcommand === "setup") {
34774
+ process.stderr.write(
34775
+ "Maker Python setup may download and run the official uv installer from https://astral.sh.\n"
34776
+ );
34777
+ const result = setupMakerPythonEnvironment();
34778
+ if (ctx.json) {
34779
+ writeJson(result);
34780
+ return;
34781
+ }
34782
+ process.stdout.write(
34783
+ [
34784
+ result.changed ? "Maker Python runtime prepared" : "Maker Python runtime already available",
34785
+ "",
34786
+ formatMakerPythonEnvironmentStatus(result.environment),
34787
+ ""
34788
+ ].join("\n")
34789
+ );
34790
+ return;
34791
+ }
34792
+ if (subcommand === "path") {
34793
+ const environment = checkMakerPythonEnvironment();
34794
+ if (ctx.json) {
34795
+ writeJson({
34796
+ ready: environment.ready,
34797
+ status: environment.status,
34798
+ python: environment.python,
34799
+ provider: environment.provider,
34800
+ version: environment.version,
34801
+ nextAction: environment.nextAction
34802
+ });
34803
+ return;
34804
+ }
34805
+ if (!environment.ready || !environment.python) {
34806
+ throw new Error(
34807
+ [
34808
+ "Maker Python runtime is not ready.",
34809
+ `- status: ${environment.status}`,
34810
+ `- next_action: ${environment.nextAction}`
34811
+ ].join("\n")
34812
+ );
34813
+ }
34814
+ process.stdout.write(`${environment.python}
34815
+ `);
34816
+ return;
34817
+ }
34818
+ throw new Error(`Unknown taptap-maker python command: ${formatUnknownCommand(parsed.command)}`);
34819
+ }
34292
34820
  async function runApps(parsed, ctx) {
34293
34821
  rejectRemovedAppsPaginationOptions(parsed);
34294
34822
  const pat = stringOption(parsed, "pat");
@@ -34339,7 +34867,7 @@ async function runPatSet(parsed, ctx) {
34339
34867
  }
34340
34868
  async function resolvePatSet(parsed, ctx) {
34341
34869
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
34342
- const pat = fs10.readFileSync(0, "utf8").trim();
34870
+ const pat = fs11.readFileSync(0, "utf8").trim();
34343
34871
  if (!pat) {
34344
34872
  throw new Error("No PAT found on stdin.");
34345
34873
  }
@@ -34363,11 +34891,13 @@ async function resolvePatSet(parsed, ctx) {
34363
34891
  async function runMcpInstall(parsed, ctx) {
34364
34892
  rejectPackageOption(parsed);
34365
34893
  const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
34894
+ const explicitTargetDir = stringOption(parsed, "target_dir");
34366
34895
  const results = installMcpConfigs({
34367
34896
  ides: ides.length > 0 ? ides : ["codex", "cursor", "claude"],
34368
34897
  env: makerEnvOption(parsed),
34369
34898
  pkg: MAKER_NPM_PACKAGE,
34370
- mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME
34899
+ mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
34900
+ cwd: explicitTargetDir ? path12.resolve(explicitTargetDir) : void 0
34371
34901
  });
34372
34902
  if (ctx.json) {
34373
34903
  writeJson(results);
@@ -34381,7 +34911,7 @@ async function runMcpVerify(parsed, ctx) {
34381
34911
  rejectPackageOption(parsed);
34382
34912
  const mode = mcpVerifyModeOption(parsed);
34383
34913
  const command = mode === "npx" ? getNpxCliCommand(MAKER_NPM_PACKAGE) : getCurrentCliCommand();
34384
- const result = spawnSync5(command.command, [...command.args, "help"], {
34914
+ const result = spawnSync7(command.command, [...command.args, "help"], {
34385
34915
  encoding: "utf8"
34386
34916
  });
34387
34917
  const failureType = classifyMcpVerifyFailure(result);
@@ -34470,7 +35000,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
34470
35000
  ];
34471
35001
  }
34472
35002
  async function runDevKitUpdate(parsed, ctx) {
34473
- const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
35003
+ const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
34474
35004
  const result = await installAiDevKit({
34475
35005
  targetDir,
34476
35006
  preserveExisting: false,
@@ -34482,7 +35012,7 @@ async function runDevKitUpdate(parsed, ctx) {
34482
35012
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
34483
35013
  }
34484
35014
  async function runLogsWatch(parsed, ctx) {
34485
- const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
35015
+ const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
34486
35016
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
34487
35017
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
34488
35018
  const maxPolls = numberOption(parsed, "max_polls");
@@ -34492,9 +35022,9 @@ async function runLogsWatch(parsed, ctx) {
34492
35022
  serverUrl: stringOption(parsed, "server_url"),
34493
35023
  env: makerEnvOption(parsed)
34494
35024
  });
34495
- const runtimeDir = path11.join(proxy.projectRoot, ".maker", "logs", "runtime");
34496
- const runtimeLog = path11.join(runtimeDir, "runtime.log");
34497
- const pidFile = path11.join(runtimeDir, "watcher.pid");
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");
34498
35028
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
34499
35029
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
34500
35030
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -34539,10 +35069,10 @@ async function runLogsWatch(parsed, ctx) {
34539
35069
  }
34540
35070
  }
34541
35071
  function registerRuntimeLogWatcherProcess(pidFile) {
34542
- fs10.mkdirSync(path11.dirname(pidFile), { recursive: true });
35072
+ fs11.mkdirSync(path12.dirname(pidFile), { recursive: true });
34543
35073
  const existingPid = readPidFile(pidFile);
34544
35074
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
34545
- fs10.writeFileSync(
35075
+ fs11.writeFileSync(
34546
35076
  pidFile,
34547
35077
  `${JSON.stringify(
34548
35078
  {
@@ -34560,10 +35090,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
34560
35090
  return previous;
34561
35091
  }
34562
35092
  function readPidFile(pidFile) {
34563
- if (!fs10.existsSync(pidFile)) {
35093
+ if (!fs11.existsSync(pidFile)) {
34564
35094
  return void 0;
34565
35095
  }
34566
- const raw = fs10.readFileSync(pidFile, "utf8").trim();
35096
+ const raw = fs11.readFileSync(pidFile, "utf8").trim();
34567
35097
  let pid = Number(raw);
34568
35098
  if (!Number.isInteger(pid) || pid <= 0) {
34569
35099
  try {
@@ -34583,7 +35113,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
34583
35113
  }
34584
35114
  cleaned = true;
34585
35115
  if (readPidFile(pidFile) === process.pid) {
34586
- fs10.rmSync(pidFile, { force: true });
35116
+ fs11.rmSync(pidFile, { force: true });
34587
35117
  }
34588
35118
  };
34589
35119
  process.once("exit", cleanup);
@@ -34692,7 +35222,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
34692
35222
  onStart: (event) => emitSkillInstallerStart(ctx, event)
34693
35223
  });
34694
35224
  writeDevKitStagedGitignore(
34695
- path11.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
35225
+ path12.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
34696
35226
  listPresentDevKitManagedEntries(targetDir)
34697
35227
  );
34698
35228
  if (options.finalizeGitignore) {
@@ -34709,7 +35239,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
34709
35239
  );
34710
35240
  } catch (error2) {
34711
35241
  writeDevKitStagedGitignore(
34712
- path11.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
35242
+ path12.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
34713
35243
  listPresentDevKitManagedEntries(targetDir)
34714
35244
  );
34715
35245
  if (options.finalizeGitignore) {
@@ -34797,7 +35327,7 @@ function installMcpConfig(ide, options) {
34797
35327
  }
34798
35328
  function installMcpConfigUnsafe(ide, options) {
34799
35329
  if (ide === "codex") {
34800
- const configPath = path11.join(os4.homedir(), ".codex", "config.toml");
35330
+ const configPath = path12.join(os4.homedir(), ".codex", "config.toml");
34801
35331
  mergeCodexMcpConfig(configPath, options);
34802
35332
  return {
34803
35333
  ide,
@@ -34807,7 +35337,7 @@ function installMcpConfigUnsafe(ide, options) {
34807
35337
  };
34808
35338
  }
34809
35339
  if (ide === "cursor") {
34810
- const configPath = path11.join(os4.homedir(), ".cursor", "mcp.json");
35340
+ const configPath = path12.join(os4.homedir(), ".cursor", "mcp.json");
34811
35341
  mergeJsonMcpConfig(configPath, options);
34812
35342
  return {
34813
35343
  ide,
@@ -34817,11 +35347,13 @@ function installMcpConfigUnsafe(ide, options) {
34817
35347
  };
34818
35348
  }
34819
35349
  if (ide === "claude") {
34820
- const claudeResult = tryClaudeMcpAdd(options);
34821
- if (claudeResult.ok) {
34822
- return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
35350
+ if (!options.cwd) {
35351
+ const claudeResult = tryClaudeMcpAdd(options);
35352
+ if (claudeResult.ok) {
35353
+ return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
35354
+ }
34823
35355
  }
34824
- const configPath = path11.join(os4.homedir(), ".claude.json");
35356
+ const configPath = path12.join(os4.homedir(), ".claude.json");
34825
35357
  mergeJsonMcpConfig(configPath, options);
34826
35358
  return {
34827
35359
  ide,
@@ -34838,28 +35370,29 @@ function mergeJsonMcpConfig(configPath, options) {
34838
35370
  const mcpServers = asObject(existing.mcpServers);
34839
35371
  mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
34840
35372
  existing.mcpServers = mcpServers;
34841
- fs10.mkdirSync(path11.dirname(configPath), { recursive: true });
34842
- fs10.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
35373
+ fs11.mkdirSync(path12.dirname(configPath), { recursive: true });
35374
+ fs11.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
34843
35375
  `, "utf8");
34844
35376
  }
34845
35377
  function mergeCodexMcpConfig(configPath, options) {
34846
35378
  const backupPath = backupIfExists(configPath);
34847
- const existing = fs10.existsSync(configPath) ? fs10.readFileSync(configPath, "utf8") : "";
35379
+ const existing = fs11.existsSync(configPath) ? fs11.readFileSync(configPath, "utf8") : "";
34848
35380
  const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
34849
35381
  const withoutOld = existing.replace(sectionPattern, "").trimEnd();
34850
- const command = getNpxCommand();
35382
+ const launch = getNpxCliCommand(options.pkg);
34851
35383
  const section = [
34852
35384
  `[mcp_servers."${options.mcpName}"]`,
34853
- `command = "${escapeToml(command)}"`,
34854
- `args = ["-y", "-p", "${escapeToml(options.pkg)}", "taptap-maker"]`,
35385
+ `command = "${escapeToml(launch.command)}"`,
35386
+ `args = [${launch.args.map((arg) => `"${escapeToml(arg)}"`).join(", ")}]`,
35387
+ options.cwd ? `cwd = "${escapeToml(options.cwd)}"` : "",
34855
35388
  "",
34856
35389
  `[mcp_servers."${options.mcpName}".env]`,
34857
35390
  `TAPTAP_MCP_ENV = "${options.env}"`,
34858
35391
  ""
34859
35392
  ].join("\n");
34860
- fs10.mkdirSync(path11.dirname(configPath), { recursive: true });
34861
- fs10.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
34862
- const updated = fs10.readFileSync(configPath, "utf8");
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");
34863
35396
  const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
34864
35397
  if (duplicates.length > 0) {
34865
35398
  restoreBackup(configPath, backupPath);
@@ -34911,34 +35444,34 @@ function normalizeCodexMcpTablePath(tablePath, mcpName) {
34911
35444
  return `mcp_servers.${mcpName}${match[1] || ""}`;
34912
35445
  }
34913
35446
  function tryClaudeMcpAdd(options) {
34914
- const command = process.platform === "win32" ? "claude.cmd" : "claude";
34915
- const result = spawnSync5(
34916
- command,
34917
- [
34918
- "mcp",
34919
- "add",
34920
- "--scope",
34921
- "user",
34922
- "--transport",
34923
- "stdio",
34924
- "--env",
34925
- `TAPTAP_MCP_ENV=${options.env}`,
34926
- options.mcpName,
34927
- "--",
34928
- getNpxCommand(),
34929
- "-y",
34930
- "-p",
34931
- options.pkg,
34932
- "taptap-maker"
34933
- ],
35447
+ const npxLaunch = getNpxCliCommand(options.pkg);
35448
+ const claudeArgs = [
35449
+ "mcp",
35450
+ "add",
35451
+ "--scope",
35452
+ "user",
35453
+ "--transport",
35454
+ "stdio",
35455
+ "--env",
35456
+ `TAPTAP_MCP_ENV=${options.env}`,
35457
+ options.mcpName,
35458
+ "--",
35459
+ ...npxLaunch.commandAndArgs
35460
+ ];
35461
+ const claude = getWindowsCmdLaunchCommand("claude.cmd", claudeArgs);
35462
+ const result = spawnSync7(
35463
+ process.platform === "win32" ? claude.command : "claude",
35464
+ process.platform === "win32" ? claude.args : claudeArgs,
34934
35465
  { encoding: "utf8" }
34935
35466
  );
34936
35467
  return { ok: result.status === 0 };
34937
35468
  }
34938
35469
  function createJsonMcpServerConfig(options) {
35470
+ const launch = getNpxCliCommand(options.pkg);
34939
35471
  return {
34940
- command: getNpxCommand(),
34941
- args: ["-y", "-p", options.pkg, "taptap-maker"],
35472
+ command: launch.command,
35473
+ args: launch.args,
35474
+ ...options.cwd ? { cwd: options.cwd } : {},
34942
35475
  env: {
34943
35476
  TAPTAP_MCP_ENV: options.env
34944
35477
  }
@@ -34951,10 +35484,22 @@ function getCurrentCliCommand() {
34951
35484
  return { command: process.platform === "win32" ? "taptap-maker.cmd" : "taptap-maker", args: [] };
34952
35485
  }
34953
35486
  function getNpxCliCommand(pkg) {
34954
- return { command: getNpxCommand(), args: ["-y", "-p", pkg, "taptap-maker"] };
35487
+ return resolveNpxCliCommand(pkg);
35488
+ }
35489
+ function resolveNpxCliCommand(pkg, platform = process.platform) {
35490
+ const npxArgs = ["-y", "-p", pkg, "taptap-maker"];
35491
+ if (platform === "win32") {
35492
+ const launch = getWindowsCmdLaunchCommand("npx.cmd", npxArgs);
35493
+ return {
35494
+ command: launch.command,
35495
+ args: launch.args,
35496
+ commandAndArgs: [launch.command, ...launch.args]
35497
+ };
35498
+ }
35499
+ return { command: "npx", args: npxArgs, commandAndArgs: ["npx", ...npxArgs] };
34955
35500
  }
34956
- function getNpxCommand() {
34957
- return process.platform === "win32" ? "npx.cmd" : "npx";
35501
+ function getWindowsCmdLaunchCommand(command, args) {
35502
+ return { command: "cmd.exe", args: ["/d", "/s", "/c", command, ...args] };
34958
35503
  }
34959
35504
  function rejectPackageOption(parsed) {
34960
35505
  if (Object.prototype.hasOwnProperty.call(parsed.options, "package")) {
@@ -34964,10 +35509,10 @@ function rejectPackageOption(parsed) {
34964
35509
  }
34965
35510
  }
34966
35511
  function readJsonObject(filePath) {
34967
- if (!fs10.existsSync(filePath)) {
35512
+ if (!fs11.existsSync(filePath)) {
34968
35513
  return {};
34969
35514
  }
34970
- return JSON.parse(fs10.readFileSync(filePath, "utf8"));
35515
+ return JSON.parse(fs11.readFileSync(filePath, "utf8"));
34971
35516
  }
34972
35517
  function asObject(value) {
34973
35518
  if (value && typeof value === "object" && !Array.isArray(value)) {
@@ -34976,26 +35521,26 @@ function asObject(value) {
34976
35521
  return {};
34977
35522
  }
34978
35523
  function backupIfExists(filePath) {
34979
- if (!fs10.existsSync(filePath)) {
35524
+ if (!fs11.existsSync(filePath)) {
34980
35525
  return void 0;
34981
35526
  }
34982
35527
  const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
34983
35528
  const backupPath = `${filePath}.bak.${stamp}`;
34984
- fs10.copyFileSync(filePath, backupPath);
35529
+ fs11.copyFileSync(filePath, backupPath);
34985
35530
  return backupPath;
34986
35531
  }
34987
35532
  function restoreBackup(filePath, backupPath) {
34988
35533
  if (backupPath) {
34989
- fs10.copyFileSync(backupPath, filePath);
35534
+ fs11.copyFileSync(backupPath, filePath);
34990
35535
  return;
34991
35536
  }
34992
- fs10.rmSync(filePath, { force: true });
35537
+ fs11.rmSync(filePath, { force: true });
34993
35538
  }
34994
35539
  function saveInitState(targetDir, state) {
34995
- fs10.mkdirSync(getMakerHome(), { recursive: true });
34996
- const key = crypto2.createHash("sha256").update(path11.resolve(targetDir)).digest("hex").slice(0, 16);
34997
- fs10.writeFileSync(
34998
- path11.join(getMakerHome(), `init-state-${key}.json`),
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`),
34999
35544
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
35000
35545
  `,
35001
35546
  "utf8"
@@ -35096,7 +35641,7 @@ function formatUnknownCommand(command) {
35096
35641
  return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
35097
35642
  }
35098
35643
  function isKnownSubcommand(command, subcommand) {
35099
- return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch";
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");
35100
35645
  }
35101
35646
  function stringOption(parsed, key) {
35102
35647
  const value = parsed.options[key];
@@ -35131,7 +35676,7 @@ function makerEnvOption(parsed) {
35131
35676
  return env;
35132
35677
  }
35133
35678
  const targetDir = stringOption(parsed, "target_dir");
35134
- return getMakerEnvironment(void 0, targetDir ? path11.resolve(targetDir) : process.cwd());
35679
+ return getMakerEnvironment(void 0, targetDir ? path12.resolve(targetDir) : process.cwd());
35135
35680
  }
35136
35681
  function mcpVerifyModeOption(parsed) {
35137
35682
  const mode = stringOption(parsed, "mode") || "npx";
@@ -35173,15 +35718,19 @@ function printHelp() {
35173
35718
  " [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
35174
35719
  " [--json]",
35175
35720
  " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
35721
+ " taptap-maker python doctor [--json]",
35722
+ " taptap-maker python setup [--json]",
35723
+ " taptap-maker python path [--json]",
35176
35724
  " taptap-maker apps [--pat PAT] [--all] [--json]",
35177
35725
  " # --pat warns: PAT appears in ps/history",
35178
35726
  " taptap-maker login [--env rnd|production] [--json]",
35179
35727
  " taptap-maker pat set [--pat-stdin] [--json]",
35180
35728
  " taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
35181
35729
  " taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
35730
+ " [--target-dir DIR]",
35182
35731
  " [--json] # alias for mcp install",
35183
35732
  " taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
35184
- " [--json]",
35733
+ " [--target-dir DIR] [--json]",
35185
35734
  " taptap-maker mcp verify [--mode npx|self] [--json]",
35186
35735
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
35187
35736
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
@@ -35190,7 +35739,7 @@ function printHelp() {
35190
35739
  "Maker MCP configs and npx verification use @taptap/maker.",
35191
35740
  "",
35192
35741
  "Windows note:",
35193
- " Generated MCP configs use npx.cmd automatically on Windows.",
35742
+ " Generated MCP configs wrap npx.cmd with cmd.exe on Windows for spawn compatibility.",
35194
35743
  ""
35195
35744
  ].join("\n")
35196
35745
  );
@@ -35203,14 +35752,14 @@ function formatCliError(error2) {
35203
35752
  }
35204
35753
 
35205
35754
  // src/maker/crashLog.ts
35206
- import fs11 from "node:fs";
35207
- import path12 from "node:path";
35755
+ import fs12 from "node:fs";
35756
+ import path13 from "node:path";
35208
35757
  var DEFAULT_MAX_BYTES = 1024 * 1024;
35209
35758
  var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
35210
35759
  function appendMakerCrashLog(source, error2, options = {}) {
35211
35760
  const makerHome = getMakerHome();
35212
- fs11.mkdirSync(makerHome, { recursive: true });
35213
- const logPath = path12.join(makerHome, "mcp-crash.log");
35761
+ fs12.mkdirSync(makerHome, { recursive: true });
35762
+ const logPath = path13.join(makerHome, "mcp-crash.log");
35214
35763
  const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
35215
35764
  const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
35216
35765
  const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
@@ -35220,31 +35769,31 @@ function appendMakerCrashLog(source, error2, options = {}) {
35220
35769
  );
35221
35770
  const entryBytes = Buffer.byteLength(entry, "utf8");
35222
35771
  rotateIfNeeded(logPath, maxBytes, entryBytes);
35223
- fs11.appendFileSync(logPath, entry, "utf8");
35772
+ fs12.appendFileSync(logPath, entry, "utf8");
35224
35773
  }
35225
35774
  function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
35226
- if (!fs11.existsSync(logPath)) {
35775
+ if (!fs12.existsSync(logPath)) {
35227
35776
  return;
35228
35777
  }
35229
- const currentBytes = fs11.statSync(logPath).size;
35778
+ const currentBytes = fs12.statSync(logPath).size;
35230
35779
  if (currentBytes + incomingBytes <= maxBytes) {
35231
35780
  return;
35232
35781
  }
35233
35782
  const rotatedPath = `${logPath}.1`;
35234
35783
  writeFileTail(logPath, rotatedPath, maxBytes);
35235
- fs11.writeFileSync(logPath, "", "utf8");
35784
+ fs12.writeFileSync(logPath, "", "utf8");
35236
35785
  }
35237
35786
  function writeFileTail(sourcePath, targetPath, maxBytes) {
35238
- const size = fs11.statSync(sourcePath).size;
35787
+ const size = fs12.statSync(sourcePath).size;
35239
35788
  const bytesToRead = Math.min(size, maxBytes);
35240
35789
  const start = Math.max(0, size - bytesToRead);
35241
- const fd = fs11.openSync(sourcePath, "r");
35790
+ const fd = fs12.openSync(sourcePath, "r");
35242
35791
  try {
35243
35792
  const buffer = Buffer.alloc(bytesToRead);
35244
- fs11.readSync(fd, buffer, 0, bytesToRead, start);
35245
- fs11.writeFileSync(targetPath, buffer);
35793
+ fs12.readSync(fd, buffer, 0, bytesToRead, start);
35794
+ fs12.writeFileSync(targetPath, buffer);
35246
35795
  } finally {
35247
- fs11.closeSync(fd);
35796
+ fs12.closeSync(fd);
35248
35797
  }
35249
35798
  }
35250
35799
  function truncateUtf8(value, maxBytes) {
@@ -36813,7 +37362,7 @@ var StreamableHTTPClientTransport = class {
36813
37362
  };
36814
37363
 
36815
37364
  // src/mcp-proxy/proxy.ts
36816
- import * as path14 from "node:path";
37365
+ import * as path15 from "node:path";
36817
37366
  import * as crypto5 from "node:crypto";
36818
37367
 
36819
37368
  // src/mcp-proxy/cookieJar.ts
@@ -36995,8 +37544,8 @@ function createCookieFetch(cookieJar) {
36995
37544
  }
36996
37545
 
36997
37546
  // src/core/utils/logWriter.ts
36998
- import * as fs12 from "node:fs";
36999
- import * as path13 from "node:path";
37547
+ import * as fs13 from "node:fs";
37548
+ import * as path14 from "node:path";
37000
37549
  import * as crypto4 from "node:crypto";
37001
37550
 
37002
37551
  // src/core/types/log.ts
@@ -37037,7 +37586,7 @@ var LogWriter = class {
37037
37586
  return;
37038
37587
  }
37039
37588
  try {
37040
- await fs12.promises.mkdir(this.config.logDir, { recursive: true });
37589
+ await fs13.promises.mkdir(this.config.logDir, { recursive: true });
37041
37590
  await this.cleanupOldLogs();
37042
37591
  this.initialized = true;
37043
37592
  } catch (error2) {
@@ -37060,7 +37609,7 @@ var LogWriter = class {
37060
37609
  */
37061
37610
  getLogFilePath(date5) {
37062
37611
  const d = date5 || this.getCurrentDate();
37063
- return path13.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
37612
+ return path14.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
37064
37613
  }
37065
37614
  /**
37066
37615
  * 获取或创建写入流
@@ -37075,7 +37624,7 @@ var LogWriter = class {
37075
37624
  }
37076
37625
  this.currentDate = date5;
37077
37626
  try {
37078
- this.writeStream = fs12.createWriteStream(this.getLogFilePath(date5), {
37627
+ this.writeStream = fs13.createWriteStream(this.getLogFilePath(date5), {
37079
37628
  flags: "a",
37080
37629
  encoding: "utf8"
37081
37630
  });
@@ -37127,11 +37676,11 @@ var LogWriter = class {
37127
37676
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
37128
37677
  try {
37129
37678
  const filePath = this.getLogFilePath();
37130
- const dir = path13.dirname(filePath);
37131
- if (!fs12.existsSync(dir)) {
37132
- fs12.mkdirSync(dir, { recursive: true });
37679
+ const dir = path14.dirname(filePath);
37680
+ if (!fs13.existsSync(dir)) {
37681
+ fs13.mkdirSync(dir, { recursive: true });
37133
37682
  }
37134
- fs12.appendFileSync(filePath, message, "utf8");
37683
+ fs13.appendFileSync(filePath, message, "utf8");
37135
37684
  } catch {
37136
37685
  }
37137
37686
  }
@@ -37142,7 +37691,7 @@ var LogWriter = class {
37142
37691
  async cleanupOldLogs() {
37143
37692
  if (this.config.maxDays <= 0) return;
37144
37693
  try {
37145
- const files = await fs12.promises.readdir(this.config.logDir);
37694
+ const files = await fs13.promises.readdir(this.config.logDir);
37146
37695
  const cutoffDate = /* @__PURE__ */ new Date();
37147
37696
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
37148
37697
  const prefix = this.config.prefix;
@@ -37157,7 +37706,7 @@ var LogWriter = class {
37157
37706
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
37158
37707
  const fileDate = new Date(year, month - 1, day);
37159
37708
  if (fileDate < cutoffDate) {
37160
- await fs12.promises.unlink(path13.join(this.config.logDir, file2));
37709
+ await fs13.promises.unlink(path14.join(this.config.logDir, file2));
37161
37710
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
37162
37711
  `);
37163
37712
  }
@@ -37228,10 +37777,10 @@ var TapTapMCPProxy = class {
37228
37777
  const { user_id, project_id } = this.config.tenant;
37229
37778
  let logDir;
37230
37779
  if (user_id && project_id) {
37231
- logDir = path14.join(logRoot, "proxy", user_id, project_id);
37780
+ logDir = path15.join(logRoot, "proxy", user_id, project_id);
37232
37781
  } else {
37233
37782
  const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
37234
- logDir = path14.join(logRoot, "proxy", kidHash);
37783
+ logDir = path15.join(logRoot, "proxy", kidHash);
37235
37784
  }
37236
37785
  return new LogWriter({
37237
37786
  logDir,
@@ -37864,6 +38413,9 @@ function printHelp2() {
37864
38413
  " [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
37865
38414
  " [--json]",
37866
38415
  " taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
38416
+ " taptap-maker python doctor [--json]",
38417
+ " taptap-maker python setup [--json]",
38418
+ " taptap-maker python path [--json]",
37867
38419
  " taptap-maker apps [--pat PAT] [--all] [--json]",
37868
38420
  " # --pat warns: PAT appears in ps/history",
37869
38421
  " taptap-maker login [--env rnd|production] [--json]",
@@ -37881,7 +38433,7 @@ function printHelp2() {
37881
38433
  "Maker MCP configs and npx verification use @taptap/maker.",
37882
38434
  "",
37883
38435
  "Windows note:",
37884
- " Generated MCP configs use npx.cmd automatically on Windows.",
38436
+ " Generated MCP configs wrap npx.cmd with cmd.exe on Windows for spawn compatibility.",
37885
38437
  ""
37886
38438
  ].join("\n")
37887
38439
  );