@taptap/maker 0.0.13 → 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/README.md +1 -1
- package/dist/maker.js +743 -241
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +23 -0
package/dist/maker.js
CHANGED
|
@@ -3233,8 +3233,8 @@ var require_utils = __commonJS({
|
|
|
3233
3233
|
}
|
|
3234
3234
|
return ind;
|
|
3235
3235
|
}
|
|
3236
|
-
function removeDotSegments(
|
|
3237
|
-
let input2 =
|
|
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 [
|
|
3437
|
-
wsComponent.path =
|
|
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,
|
|
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,
|
|
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
|
|
12513
|
-
function checkPathExt(
|
|
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 &&
|
|
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,
|
|
12530
|
+
function checkStat(stat, path16, options) {
|
|
12531
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12532
|
return false;
|
|
12533
12533
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path16, options);
|
|
12535
12535
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
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(
|
|
12542
|
-
return checkStat(
|
|
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
|
|
12553
|
-
function isexe(
|
|
12554
|
-
|
|
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(
|
|
12559
|
-
return checkStat(
|
|
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
|
|
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(
|
|
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(
|
|
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(
|
|
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(
|
|
12621
|
+
function sync(path16, options) {
|
|
12622
12622
|
try {
|
|
12623
|
-
return core.sync(
|
|
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
|
|
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 =
|
|
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 =
|
|
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
|
|
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 ?
|
|
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 =
|
|
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 [
|
|
12834
|
-
const binary =
|
|
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
|
|
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 =
|
|
12855
|
-
|
|
12856
|
-
|
|
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
|
|
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 =
|
|
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
|
|
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 =
|
|
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, spawnSync as
|
|
13006
|
-
import
|
|
13007
|
-
import
|
|
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:
|
|
13369
|
-
const fullPath = [...
|
|
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,
|
|
13484
|
+
constructor(parent, value, path16, key) {
|
|
13485
13485
|
this._cachedPath = [];
|
|
13486
13486
|
this.parent = parent;
|
|
13487
13487
|
this.data = value;
|
|
13488
|
-
this._path =
|
|
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,
|
|
17138
|
-
if (!
|
|
17137
|
+
function getElementAtPath(obj, path16) {
|
|
17138
|
+
if (!path16)
|
|
17139
17139
|
return obj;
|
|
17140
|
-
return
|
|
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(
|
|
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(
|
|
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/
|
|
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:
|
|
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
|
-
|
|
31640
|
+
path8.join(process.cwd(), "skills", skillName),
|
|
31266
31641
|
getBundledSkillSourceDir(skillName)
|
|
31267
31642
|
].filter(Boolean);
|
|
31268
31643
|
for (const candidate of candidates) {
|
|
31269
|
-
if (
|
|
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 =
|
|
31283
|
-
return
|
|
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
|
|
31288
|
-
import
|
|
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
|
-
|
|
31804
|
+
fs8.mkdirSync(runtimeDir, { recursive: true });
|
|
31430
31805
|
for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
|
|
31431
|
-
|
|
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 (!
|
|
31812
|
+
if (!fs8.existsSync(statePath)) {
|
|
31438
31813
|
return null;
|
|
31439
31814
|
}
|
|
31440
31815
|
try {
|
|
31441
|
-
const state = JSON.parse(
|
|
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 =
|
|
31470
|
-
|
|
31471
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
31871
|
+
fs8.mkdirSync(path9.dirname(statePath), { recursive: true });
|
|
31497
31872
|
const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
|
|
31498
|
-
|
|
31873
|
+
fs8.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
31499
31874
|
`, "utf8");
|
|
31500
|
-
|
|
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
|
|
31907
|
+
return path9.join(projectRoot, ".maker", "logs", "runtime");
|
|
31533
31908
|
}
|
|
31534
31909
|
function getRuntimeLogStatePath(projectRoot) {
|
|
31535
|
-
return
|
|
31910
|
+
return path9.join(getRuntimeLogDir(projectRoot), "state.json");
|
|
31536
31911
|
}
|
|
31537
31912
|
function getRuntimeLogPath(projectRoot) {
|
|
31538
|
-
return
|
|
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
|
|
31664
|
-
import
|
|
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
|
-
|
|
31909
|
-
|
|
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 =
|
|
32298
|
+
const relativePath = path10.posix.join(
|
|
31924
32299
|
options.relativeDir,
|
|
31925
32300
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
31926
32301
|
);
|
|
31927
|
-
const absolutePath =
|
|
31928
|
-
if (!
|
|
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 =
|
|
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(
|
|
32399
|
+
const hasExtension = Boolean(path10.extname(value));
|
|
32025
32400
|
const candidates = [];
|
|
32026
32401
|
for (const assetDir of assetDirs) {
|
|
32027
|
-
const absoluteDir =
|
|
32402
|
+
const absoluteDir = path10.join(targetDir, ...assetDir.split("/"));
|
|
32028
32403
|
let entries;
|
|
32029
32404
|
try {
|
|
32030
|
-
entries =
|
|
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 =
|
|
32414
|
+
const absolutePath = path10.join(absoluteDir, entry);
|
|
32040
32415
|
try {
|
|
32041
32416
|
candidates.push({
|
|
32042
|
-
localPath:
|
|
32043
|
-
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("../") ||
|
|
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
|
-
|
|
32068
|
-
|
|
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 (!
|
|
32448
|
+
if (!fs9.existsSync(registryPath)) {
|
|
32074
32449
|
return {};
|
|
32075
32450
|
}
|
|
32076
32451
|
try {
|
|
32077
|
-
const parsed = JSON.parse(
|
|
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
|
|
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 =
|
|
32091
|
-
return relative.split(
|
|
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 =
|
|
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.
|
|
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. 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.',
|
|
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: {
|
|
@@ -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
|
|
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 =
|
|
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 =
|
|
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 ||
|
|
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: ${
|
|
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: [
|
|
33337
|
+
args: [path11.resolve(makerEntry), "__maker-proxy"]
|
|
32928
33338
|
};
|
|
32929
33339
|
}
|
|
32930
33340
|
function createToolProgressReporter(progressToken, extra, operationName) {
|
|
@@ -33026,7 +33436,7 @@ function openMakerPageInBrowser(url2) {
|
|
|
33026
33436
|
var _a3;
|
|
33027
33437
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
33028
33438
|
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
33029
|
-
const result =
|
|
33439
|
+
const result = spawnSync5(command, args, {
|
|
33030
33440
|
stdio: "ignore",
|
|
33031
33441
|
windowsHide: true,
|
|
33032
33442
|
timeout: 5e3
|
|
@@ -33263,18 +33673,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
33263
33673
|
}
|
|
33264
33674
|
}
|
|
33265
33675
|
async function startRuntimeLogWatch(buildResult) {
|
|
33266
|
-
const runtimeDir =
|
|
33267
|
-
|
|
33268
|
-
const stdoutLog =
|
|
33269
|
-
const stderrLog =
|
|
33270
|
-
const pidFile =
|
|
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");
|
|
33271
33681
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
33272
|
-
const outFd =
|
|
33273
|
-
const errFd =
|
|
33682
|
+
const outFd = fs10.openSync(stdoutLog, "a");
|
|
33683
|
+
const errFd = fs10.openSync(stderrLog, "a");
|
|
33274
33684
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
33275
33685
|
if (previous.previousStopError) {
|
|
33276
|
-
|
|
33277
|
-
|
|
33686
|
+
fs10.closeSync(outFd);
|
|
33687
|
+
fs10.closeSync(errFd);
|
|
33278
33688
|
return {
|
|
33279
33689
|
started: false,
|
|
33280
33690
|
command: command.text,
|
|
@@ -33337,18 +33747,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
33337
33747
|
...previous
|
|
33338
33748
|
};
|
|
33339
33749
|
} finally {
|
|
33340
|
-
|
|
33341
|
-
|
|
33750
|
+
fs10.closeSync(outFd);
|
|
33751
|
+
fs10.closeSync(errFd);
|
|
33342
33752
|
}
|
|
33343
33753
|
}
|
|
33344
33754
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
33345
|
-
if (!
|
|
33755
|
+
if (!fs10.existsSync(pidFile)) {
|
|
33346
33756
|
return {};
|
|
33347
33757
|
}
|
|
33348
33758
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
33349
33759
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
33350
33760
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
33351
|
-
|
|
33761
|
+
fs10.rmSync(pidFile, { force: true });
|
|
33352
33762
|
return {};
|
|
33353
33763
|
}
|
|
33354
33764
|
try {
|
|
@@ -33356,7 +33766,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33356
33766
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
33357
33767
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
33358
33768
|
if (!verifiedCommand) {
|
|
33359
|
-
|
|
33769
|
+
fs10.rmSync(pidFile, { force: true });
|
|
33360
33770
|
return {
|
|
33361
33771
|
previousPid: pid,
|
|
33362
33772
|
previousStopped: false,
|
|
@@ -33366,7 +33776,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33366
33776
|
process.kill(pid, "SIGTERM");
|
|
33367
33777
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
33368
33778
|
if (stopped) {
|
|
33369
|
-
|
|
33779
|
+
fs10.rmSync(pidFile, { force: true });
|
|
33370
33780
|
return { previousPid: pid, previousStopped: true };
|
|
33371
33781
|
}
|
|
33372
33782
|
return {
|
|
@@ -33375,7 +33785,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33375
33785
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
33376
33786
|
};
|
|
33377
33787
|
} catch (error2) {
|
|
33378
|
-
|
|
33788
|
+
fs10.rmSync(pidFile, { force: true });
|
|
33379
33789
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
33380
33790
|
if (code === "ESRCH") {
|
|
33381
33791
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -33388,7 +33798,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33388
33798
|
}
|
|
33389
33799
|
}
|
|
33390
33800
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
33391
|
-
const raw =
|
|
33801
|
+
const raw = fs10.readFileSync(pidFile, "utf8").trim();
|
|
33392
33802
|
if (!raw) {
|
|
33393
33803
|
return null;
|
|
33394
33804
|
}
|
|
@@ -33404,7 +33814,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
33404
33814
|
}
|
|
33405
33815
|
}
|
|
33406
33816
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
33407
|
-
|
|
33817
|
+
fs10.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
33408
33818
|
`, "utf8");
|
|
33409
33819
|
}
|
|
33410
33820
|
function getProcessCommand(pid) {
|
|
@@ -33490,10 +33900,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
33490
33900
|
};
|
|
33491
33901
|
}
|
|
33492
33902
|
function resolveMakerCliEntry() {
|
|
33493
|
-
return process.argv[1] ||
|
|
33903
|
+
return process.argv[1] || path11.resolve(process.cwd(), "dist", "maker.js");
|
|
33494
33904
|
}
|
|
33495
33905
|
function getRuntimeLogFilePath(projectRoot) {
|
|
33496
|
-
return
|
|
33906
|
+
return path11.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
33497
33907
|
}
|
|
33498
33908
|
async function refreshMakerPreview(buildResult) {
|
|
33499
33909
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -33624,7 +34034,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
33624
34034
|
if (options.scriptsPath) {
|
|
33625
34035
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
33626
34036
|
}
|
|
33627
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
34037
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs10.existsSync(path11.join(projectRoot, "scripts", "main.lua"))) {
|
|
33628
34038
|
buildArgs.entry = "main.lua";
|
|
33629
34039
|
buildArgs.scriptsPath = "scripts";
|
|
33630
34040
|
}
|
|
@@ -33636,7 +34046,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
33636
34046
|
}
|
|
33637
34047
|
if (options.multiplayer) {
|
|
33638
34048
|
buildArgs.multiplayer = options.multiplayer;
|
|
33639
|
-
} else if (!
|
|
34049
|
+
} else if (!fs10.existsSync(path11.join(projectRoot, ".project", "settings.json"))) {
|
|
33640
34050
|
buildArgs.multiplayer = { enabled: false };
|
|
33641
34051
|
}
|
|
33642
34052
|
return buildArgs;
|
|
@@ -33811,11 +34221,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
33811
34221
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
33812
34222
|
`- watch_command: ${command}`,
|
|
33813
34223
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
33814
|
-
`- local_file: ${
|
|
34224
|
+
`- local_file: ${path11.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
33815
34225
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
33816
34226
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
33817
34227
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
33818
|
-
`- state_file: ${
|
|
34228
|
+
`- state_file: ${path11.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
33819
34229
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
33820
34230
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
33821
34231
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -33930,16 +34340,16 @@ function indent(value) {
|
|
|
33930
34340
|
}
|
|
33931
34341
|
|
|
33932
34342
|
// src/maker/cli/commands.ts
|
|
33933
|
-
import { spawnSync as
|
|
34343
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
33934
34344
|
import crypto2 from "node:crypto";
|
|
33935
|
-
import
|
|
34345
|
+
import fs11 from "node:fs";
|
|
33936
34346
|
import os4 from "node:os";
|
|
33937
|
-
import
|
|
34347
|
+
import path12 from "node:path";
|
|
33938
34348
|
import readline from "node:readline/promises";
|
|
33939
34349
|
import { stdin as input, stdout as output } from "node:process";
|
|
33940
34350
|
|
|
33941
34351
|
// src/maker/auth/cliLogin.ts
|
|
33942
|
-
import { spawnSync as
|
|
34352
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
33943
34353
|
import crypto from "node:crypto";
|
|
33944
34354
|
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
33945
34355
|
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
@@ -34058,7 +34468,7 @@ async function readJsonResponse(response) {
|
|
|
34058
34468
|
function openBrowser(url2) {
|
|
34059
34469
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
34060
34470
|
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
34061
|
-
const result =
|
|
34471
|
+
const result = spawnSync6(command, args, {
|
|
34062
34472
|
stdio: "ignore",
|
|
34063
34473
|
windowsHide: true
|
|
34064
34474
|
});
|
|
@@ -34082,7 +34492,7 @@ function formatError2(error2) {
|
|
|
34082
34492
|
// src/maker/cli/commands.ts
|
|
34083
34493
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
34084
34494
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
34085
|
-
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"]);
|
|
34086
34496
|
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
34087
34497
|
"json",
|
|
34088
34498
|
"skip_confirm",
|
|
@@ -34144,6 +34554,10 @@ async function runMakerCli(argv) {
|
|
|
34144
34554
|
await runLogsWatch(parsed, ctx);
|
|
34145
34555
|
return;
|
|
34146
34556
|
}
|
|
34557
|
+
if (command === "python") {
|
|
34558
|
+
await runPython(parsed, ctx);
|
|
34559
|
+
return;
|
|
34560
|
+
}
|
|
34147
34561
|
throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
|
|
34148
34562
|
}
|
|
34149
34563
|
function parseArgs(argv) {
|
|
@@ -34193,7 +34607,7 @@ function toOptionKey(value) {
|
|
|
34193
34607
|
}
|
|
34194
34608
|
async function runInit(parsed, ctx) {
|
|
34195
34609
|
rejectPackageOption(parsed);
|
|
34196
|
-
const targetDir =
|
|
34610
|
+
const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34197
34611
|
const env = makerEnvOption(parsed);
|
|
34198
34612
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
34199
34613
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -34264,7 +34678,8 @@ async function runInit(parsed, ctx) {
|
|
|
34264
34678
|
ides,
|
|
34265
34679
|
env,
|
|
34266
34680
|
pkg: MAKER_NPM_PACKAGE,
|
|
34267
|
-
mcpName: DEFAULT_MCP_NAME
|
|
34681
|
+
mcpName: DEFAULT_MCP_NAME,
|
|
34682
|
+
cwd: targetDir
|
|
34268
34683
|
});
|
|
34269
34684
|
for (const result of installResults) {
|
|
34270
34685
|
emit(ctx, "mcp_install", result.message, result);
|
|
@@ -34284,9 +34699,10 @@ async function runInit(parsed, ctx) {
|
|
|
34284
34699
|
}
|
|
34285
34700
|
async function runDoctor(parsed, ctx) {
|
|
34286
34701
|
var _a3, _b;
|
|
34287
|
-
const targetDir =
|
|
34702
|
+
const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34288
34703
|
const env = makerEnvOption(parsed);
|
|
34289
34704
|
const git = checkGitEnvironment();
|
|
34705
|
+
const python = checkMakerPythonEnvironment();
|
|
34290
34706
|
const pat = loadPat();
|
|
34291
34707
|
const tapAuth = loadTapAuth();
|
|
34292
34708
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
@@ -34302,6 +34718,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
34302
34718
|
pat: Boolean(pat),
|
|
34303
34719
|
tap_auth: Boolean(tapAuth)
|
|
34304
34720
|
},
|
|
34721
|
+
python,
|
|
34305
34722
|
project: identify,
|
|
34306
34723
|
dev_kit: devKit,
|
|
34307
34724
|
dev_kit_update: devKitUpdate
|
|
@@ -34316,6 +34733,8 @@ async function runDoctor(parsed, ctx) {
|
|
|
34316
34733
|
"Git",
|
|
34317
34734
|
formatGitEnvironmentStatus(git),
|
|
34318
34735
|
"",
|
|
34736
|
+
formatMakerPythonEnvironmentStatus(python),
|
|
34737
|
+
"",
|
|
34319
34738
|
"Auth",
|
|
34320
34739
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
34321
34740
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
@@ -34339,6 +34758,65 @@ async function runDoctor(parsed, ctx) {
|
|
|
34339
34758
|
].filter(Boolean).join("\n")
|
|
34340
34759
|
);
|
|
34341
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
|
+
}
|
|
34342
34820
|
async function runApps(parsed, ctx) {
|
|
34343
34821
|
rejectRemovedAppsPaginationOptions(parsed);
|
|
34344
34822
|
const pat = stringOption(parsed, "pat");
|
|
@@ -34389,7 +34867,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
34389
34867
|
}
|
|
34390
34868
|
async function resolvePatSet(parsed, ctx) {
|
|
34391
34869
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
34392
|
-
const pat =
|
|
34870
|
+
const pat = fs11.readFileSync(0, "utf8").trim();
|
|
34393
34871
|
if (!pat) {
|
|
34394
34872
|
throw new Error("No PAT found on stdin.");
|
|
34395
34873
|
}
|
|
@@ -34413,11 +34891,13 @@ async function resolvePatSet(parsed, ctx) {
|
|
|
34413
34891
|
async function runMcpInstall(parsed, ctx) {
|
|
34414
34892
|
rejectPackageOption(parsed);
|
|
34415
34893
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
34894
|
+
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
34416
34895
|
const results = installMcpConfigs({
|
|
34417
34896
|
ides: ides.length > 0 ? ides : ["codex", "cursor", "claude"],
|
|
34418
34897
|
env: makerEnvOption(parsed),
|
|
34419
34898
|
pkg: MAKER_NPM_PACKAGE,
|
|
34420
|
-
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME
|
|
34899
|
+
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
34900
|
+
cwd: explicitTargetDir ? path12.resolve(explicitTargetDir) : void 0
|
|
34421
34901
|
});
|
|
34422
34902
|
if (ctx.json) {
|
|
34423
34903
|
writeJson(results);
|
|
@@ -34431,7 +34911,7 @@ async function runMcpVerify(parsed, ctx) {
|
|
|
34431
34911
|
rejectPackageOption(parsed);
|
|
34432
34912
|
const mode = mcpVerifyModeOption(parsed);
|
|
34433
34913
|
const command = mode === "npx" ? getNpxCliCommand(MAKER_NPM_PACKAGE) : getCurrentCliCommand();
|
|
34434
|
-
const result =
|
|
34914
|
+
const result = spawnSync7(command.command, [...command.args, "help"], {
|
|
34435
34915
|
encoding: "utf8"
|
|
34436
34916
|
});
|
|
34437
34917
|
const failureType = classifyMcpVerifyFailure(result);
|
|
@@ -34520,7 +35000,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
34520
35000
|
];
|
|
34521
35001
|
}
|
|
34522
35002
|
async function runDevKitUpdate(parsed, ctx) {
|
|
34523
|
-
const targetDir =
|
|
35003
|
+
const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34524
35004
|
const result = await installAiDevKit({
|
|
34525
35005
|
targetDir,
|
|
34526
35006
|
preserveExisting: false,
|
|
@@ -34532,7 +35012,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
34532
35012
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
34533
35013
|
}
|
|
34534
35014
|
async function runLogsWatch(parsed, ctx) {
|
|
34535
|
-
const targetDir =
|
|
35015
|
+
const targetDir = path12.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34536
35016
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
34537
35017
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
|
|
34538
35018
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -34542,9 +35022,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
34542
35022
|
serverUrl: stringOption(parsed, "server_url"),
|
|
34543
35023
|
env: makerEnvOption(parsed)
|
|
34544
35024
|
});
|
|
34545
|
-
const runtimeDir =
|
|
34546
|
-
const runtimeLog =
|
|
34547
|
-
const pidFile =
|
|
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");
|
|
34548
35028
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
34549
35029
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
34550
35030
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -34589,10 +35069,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
34589
35069
|
}
|
|
34590
35070
|
}
|
|
34591
35071
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
34592
|
-
|
|
35072
|
+
fs11.mkdirSync(path12.dirname(pidFile), { recursive: true });
|
|
34593
35073
|
const existingPid = readPidFile(pidFile);
|
|
34594
35074
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
34595
|
-
|
|
35075
|
+
fs11.writeFileSync(
|
|
34596
35076
|
pidFile,
|
|
34597
35077
|
`${JSON.stringify(
|
|
34598
35078
|
{
|
|
@@ -34610,10 +35090,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
34610
35090
|
return previous;
|
|
34611
35091
|
}
|
|
34612
35092
|
function readPidFile(pidFile) {
|
|
34613
|
-
if (!
|
|
35093
|
+
if (!fs11.existsSync(pidFile)) {
|
|
34614
35094
|
return void 0;
|
|
34615
35095
|
}
|
|
34616
|
-
const raw =
|
|
35096
|
+
const raw = fs11.readFileSync(pidFile, "utf8").trim();
|
|
34617
35097
|
let pid = Number(raw);
|
|
34618
35098
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
34619
35099
|
try {
|
|
@@ -34633,7 +35113,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
34633
35113
|
}
|
|
34634
35114
|
cleaned = true;
|
|
34635
35115
|
if (readPidFile(pidFile) === process.pid) {
|
|
34636
|
-
|
|
35116
|
+
fs11.rmSync(pidFile, { force: true });
|
|
34637
35117
|
}
|
|
34638
35118
|
};
|
|
34639
35119
|
process.once("exit", cleanup);
|
|
@@ -34742,7 +35222,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
34742
35222
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
34743
35223
|
});
|
|
34744
35224
|
writeDevKitStagedGitignore(
|
|
34745
|
-
|
|
35225
|
+
path12.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
34746
35226
|
listPresentDevKitManagedEntries(targetDir)
|
|
34747
35227
|
);
|
|
34748
35228
|
if (options.finalizeGitignore) {
|
|
@@ -34759,7 +35239,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
34759
35239
|
);
|
|
34760
35240
|
} catch (error2) {
|
|
34761
35241
|
writeDevKitStagedGitignore(
|
|
34762
|
-
|
|
35242
|
+
path12.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
34763
35243
|
listPresentDevKitManagedEntries(targetDir)
|
|
34764
35244
|
);
|
|
34765
35245
|
if (options.finalizeGitignore) {
|
|
@@ -34847,7 +35327,7 @@ function installMcpConfig(ide, options) {
|
|
|
34847
35327
|
}
|
|
34848
35328
|
function installMcpConfigUnsafe(ide, options) {
|
|
34849
35329
|
if (ide === "codex") {
|
|
34850
|
-
const configPath =
|
|
35330
|
+
const configPath = path12.join(os4.homedir(), ".codex", "config.toml");
|
|
34851
35331
|
mergeCodexMcpConfig(configPath, options);
|
|
34852
35332
|
return {
|
|
34853
35333
|
ide,
|
|
@@ -34857,7 +35337,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
34857
35337
|
};
|
|
34858
35338
|
}
|
|
34859
35339
|
if (ide === "cursor") {
|
|
34860
|
-
const configPath =
|
|
35340
|
+
const configPath = path12.join(os4.homedir(), ".cursor", "mcp.json");
|
|
34861
35341
|
mergeJsonMcpConfig(configPath, options);
|
|
34862
35342
|
return {
|
|
34863
35343
|
ide,
|
|
@@ -34867,11 +35347,13 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
34867
35347
|
};
|
|
34868
35348
|
}
|
|
34869
35349
|
if (ide === "claude") {
|
|
34870
|
-
|
|
34871
|
-
|
|
34872
|
-
|
|
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
|
+
}
|
|
34873
35355
|
}
|
|
34874
|
-
const configPath =
|
|
35356
|
+
const configPath = path12.join(os4.homedir(), ".claude.json");
|
|
34875
35357
|
mergeJsonMcpConfig(configPath, options);
|
|
34876
35358
|
return {
|
|
34877
35359
|
ide,
|
|
@@ -34888,28 +35370,29 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
34888
35370
|
const mcpServers = asObject(existing.mcpServers);
|
|
34889
35371
|
mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
|
|
34890
35372
|
existing.mcpServers = mcpServers;
|
|
34891
|
-
|
|
34892
|
-
|
|
35373
|
+
fs11.mkdirSync(path12.dirname(configPath), { recursive: true });
|
|
35374
|
+
fs11.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
|
|
34893
35375
|
`, "utf8");
|
|
34894
35376
|
}
|
|
34895
35377
|
function mergeCodexMcpConfig(configPath, options) {
|
|
34896
35378
|
const backupPath = backupIfExists(configPath);
|
|
34897
|
-
const existing =
|
|
35379
|
+
const existing = fs11.existsSync(configPath) ? fs11.readFileSync(configPath, "utf8") : "";
|
|
34898
35380
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
34899
35381
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
34900
|
-
const
|
|
35382
|
+
const launch = getNpxCliCommand(options.pkg);
|
|
34901
35383
|
const section = [
|
|
34902
35384
|
`[mcp_servers."${options.mcpName}"]`,
|
|
34903
|
-
`command = "${escapeToml(command)}"`,
|
|
34904
|
-
`args = [
|
|
35385
|
+
`command = "${escapeToml(launch.command)}"`,
|
|
35386
|
+
`args = [${launch.args.map((arg) => `"${escapeToml(arg)}"`).join(", ")}]`,
|
|
35387
|
+
options.cwd ? `cwd = "${escapeToml(options.cwd)}"` : "",
|
|
34905
35388
|
"",
|
|
34906
35389
|
`[mcp_servers."${options.mcpName}".env]`,
|
|
34907
35390
|
`TAPTAP_MCP_ENV = "${options.env}"`,
|
|
34908
35391
|
""
|
|
34909
35392
|
].join("\n");
|
|
34910
|
-
|
|
34911
|
-
|
|
34912
|
-
const updated =
|
|
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");
|
|
34913
35396
|
const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
|
|
34914
35397
|
if (duplicates.length > 0) {
|
|
34915
35398
|
restoreBackup(configPath, backupPath);
|
|
@@ -34961,34 +35444,34 @@ function normalizeCodexMcpTablePath(tablePath, mcpName) {
|
|
|
34961
35444
|
return `mcp_servers.${mcpName}${match[1] || ""}`;
|
|
34962
35445
|
}
|
|
34963
35446
|
function tryClaudeMcpAdd(options) {
|
|
34964
|
-
const
|
|
34965
|
-
const
|
|
34966
|
-
|
|
34967
|
-
|
|
34968
|
-
|
|
34969
|
-
|
|
34970
|
-
|
|
34971
|
-
|
|
34972
|
-
|
|
34973
|
-
|
|
34974
|
-
|
|
34975
|
-
|
|
34976
|
-
|
|
34977
|
-
|
|
34978
|
-
|
|
34979
|
-
|
|
34980
|
-
|
|
34981
|
-
|
|
34982
|
-
"taptap-maker"
|
|
34983
|
-
],
|
|
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,
|
|
34984
35465
|
{ encoding: "utf8" }
|
|
34985
35466
|
);
|
|
34986
35467
|
return { ok: result.status === 0 };
|
|
34987
35468
|
}
|
|
34988
35469
|
function createJsonMcpServerConfig(options) {
|
|
35470
|
+
const launch = getNpxCliCommand(options.pkg);
|
|
34989
35471
|
return {
|
|
34990
|
-
command:
|
|
34991
|
-
args:
|
|
35472
|
+
command: launch.command,
|
|
35473
|
+
args: launch.args,
|
|
35474
|
+
...options.cwd ? { cwd: options.cwd } : {},
|
|
34992
35475
|
env: {
|
|
34993
35476
|
TAPTAP_MCP_ENV: options.env
|
|
34994
35477
|
}
|
|
@@ -35001,10 +35484,22 @@ function getCurrentCliCommand() {
|
|
|
35001
35484
|
return { command: process.platform === "win32" ? "taptap-maker.cmd" : "taptap-maker", args: [] };
|
|
35002
35485
|
}
|
|
35003
35486
|
function getNpxCliCommand(pkg) {
|
|
35004
|
-
return
|
|
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] };
|
|
35005
35500
|
}
|
|
35006
|
-
function
|
|
35007
|
-
return
|
|
35501
|
+
function getWindowsCmdLaunchCommand(command, args) {
|
|
35502
|
+
return { command: "cmd.exe", args: ["/d", "/s", "/c", command, ...args] };
|
|
35008
35503
|
}
|
|
35009
35504
|
function rejectPackageOption(parsed) {
|
|
35010
35505
|
if (Object.prototype.hasOwnProperty.call(parsed.options, "package")) {
|
|
@@ -35014,10 +35509,10 @@ function rejectPackageOption(parsed) {
|
|
|
35014
35509
|
}
|
|
35015
35510
|
}
|
|
35016
35511
|
function readJsonObject(filePath) {
|
|
35017
|
-
if (!
|
|
35512
|
+
if (!fs11.existsSync(filePath)) {
|
|
35018
35513
|
return {};
|
|
35019
35514
|
}
|
|
35020
|
-
return JSON.parse(
|
|
35515
|
+
return JSON.parse(fs11.readFileSync(filePath, "utf8"));
|
|
35021
35516
|
}
|
|
35022
35517
|
function asObject(value) {
|
|
35023
35518
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -35026,26 +35521,26 @@ function asObject(value) {
|
|
|
35026
35521
|
return {};
|
|
35027
35522
|
}
|
|
35028
35523
|
function backupIfExists(filePath) {
|
|
35029
|
-
if (!
|
|
35524
|
+
if (!fs11.existsSync(filePath)) {
|
|
35030
35525
|
return void 0;
|
|
35031
35526
|
}
|
|
35032
35527
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
|
|
35033
35528
|
const backupPath = `${filePath}.bak.${stamp}`;
|
|
35034
|
-
|
|
35529
|
+
fs11.copyFileSync(filePath, backupPath);
|
|
35035
35530
|
return backupPath;
|
|
35036
35531
|
}
|
|
35037
35532
|
function restoreBackup(filePath, backupPath) {
|
|
35038
35533
|
if (backupPath) {
|
|
35039
|
-
|
|
35534
|
+
fs11.copyFileSync(backupPath, filePath);
|
|
35040
35535
|
return;
|
|
35041
35536
|
}
|
|
35042
|
-
|
|
35537
|
+
fs11.rmSync(filePath, { force: true });
|
|
35043
35538
|
}
|
|
35044
35539
|
function saveInitState(targetDir, state) {
|
|
35045
|
-
|
|
35046
|
-
const key = crypto2.createHash("sha256").update(
|
|
35047
|
-
|
|
35048
|
-
|
|
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`),
|
|
35049
35544
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
35050
35545
|
`,
|
|
35051
35546
|
"utf8"
|
|
@@ -35146,7 +35641,7 @@ function formatUnknownCommand(command) {
|
|
|
35146
35641
|
return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
|
|
35147
35642
|
}
|
|
35148
35643
|
function isKnownSubcommand(command, subcommand) {
|
|
35149
|
-
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");
|
|
35150
35645
|
}
|
|
35151
35646
|
function stringOption(parsed, key) {
|
|
35152
35647
|
const value = parsed.options[key];
|
|
@@ -35181,7 +35676,7 @@ function makerEnvOption(parsed) {
|
|
|
35181
35676
|
return env;
|
|
35182
35677
|
}
|
|
35183
35678
|
const targetDir = stringOption(parsed, "target_dir");
|
|
35184
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
35679
|
+
return getMakerEnvironment(void 0, targetDir ? path12.resolve(targetDir) : process.cwd());
|
|
35185
35680
|
}
|
|
35186
35681
|
function mcpVerifyModeOption(parsed) {
|
|
35187
35682
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -35223,15 +35718,19 @@ function printHelp() {
|
|
|
35223
35718
|
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
35224
35719
|
" [--json]",
|
|
35225
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]",
|
|
35226
35724
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
35227
35725
|
" # --pat warns: PAT appears in ps/history",
|
|
35228
35726
|
" taptap-maker login [--env rnd|production] [--json]",
|
|
35229
35727
|
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
35230
35728
|
" taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
|
|
35231
35729
|
" taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
35730
|
+
" [--target-dir DIR]",
|
|
35232
35731
|
" [--json] # alias for mcp install",
|
|
35233
35732
|
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
35234
|
-
" [--json]",
|
|
35733
|
+
" [--target-dir DIR] [--json]",
|
|
35235
35734
|
" taptap-maker mcp verify [--mode npx|self] [--json]",
|
|
35236
35735
|
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
35237
35736
|
" taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
|
|
@@ -35240,7 +35739,7 @@ function printHelp() {
|
|
|
35240
35739
|
"Maker MCP configs and npx verification use @taptap/maker.",
|
|
35241
35740
|
"",
|
|
35242
35741
|
"Windows note:",
|
|
35243
|
-
" Generated MCP configs
|
|
35742
|
+
" Generated MCP configs wrap npx.cmd with cmd.exe on Windows for spawn compatibility.",
|
|
35244
35743
|
""
|
|
35245
35744
|
].join("\n")
|
|
35246
35745
|
);
|
|
@@ -35253,14 +35752,14 @@ function formatCliError(error2) {
|
|
|
35253
35752
|
}
|
|
35254
35753
|
|
|
35255
35754
|
// src/maker/crashLog.ts
|
|
35256
|
-
import
|
|
35257
|
-
import
|
|
35755
|
+
import fs12 from "node:fs";
|
|
35756
|
+
import path13 from "node:path";
|
|
35258
35757
|
var DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
35259
35758
|
var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
|
|
35260
35759
|
function appendMakerCrashLog(source, error2, options = {}) {
|
|
35261
35760
|
const makerHome = getMakerHome();
|
|
35262
|
-
|
|
35263
|
-
const logPath =
|
|
35761
|
+
fs12.mkdirSync(makerHome, { recursive: true });
|
|
35762
|
+
const logPath = path13.join(makerHome, "mcp-crash.log");
|
|
35264
35763
|
const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
|
|
35265
35764
|
const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
|
|
35266
35765
|
const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
|
|
@@ -35270,31 +35769,31 @@ function appendMakerCrashLog(source, error2, options = {}) {
|
|
|
35270
35769
|
);
|
|
35271
35770
|
const entryBytes = Buffer.byteLength(entry, "utf8");
|
|
35272
35771
|
rotateIfNeeded(logPath, maxBytes, entryBytes);
|
|
35273
|
-
|
|
35772
|
+
fs12.appendFileSync(logPath, entry, "utf8");
|
|
35274
35773
|
}
|
|
35275
35774
|
function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
|
|
35276
|
-
if (!
|
|
35775
|
+
if (!fs12.existsSync(logPath)) {
|
|
35277
35776
|
return;
|
|
35278
35777
|
}
|
|
35279
|
-
const currentBytes =
|
|
35778
|
+
const currentBytes = fs12.statSync(logPath).size;
|
|
35280
35779
|
if (currentBytes + incomingBytes <= maxBytes) {
|
|
35281
35780
|
return;
|
|
35282
35781
|
}
|
|
35283
35782
|
const rotatedPath = `${logPath}.1`;
|
|
35284
35783
|
writeFileTail(logPath, rotatedPath, maxBytes);
|
|
35285
|
-
|
|
35784
|
+
fs12.writeFileSync(logPath, "", "utf8");
|
|
35286
35785
|
}
|
|
35287
35786
|
function writeFileTail(sourcePath, targetPath, maxBytes) {
|
|
35288
|
-
const size =
|
|
35787
|
+
const size = fs12.statSync(sourcePath).size;
|
|
35289
35788
|
const bytesToRead = Math.min(size, maxBytes);
|
|
35290
35789
|
const start = Math.max(0, size - bytesToRead);
|
|
35291
|
-
const fd =
|
|
35790
|
+
const fd = fs12.openSync(sourcePath, "r");
|
|
35292
35791
|
try {
|
|
35293
35792
|
const buffer = Buffer.alloc(bytesToRead);
|
|
35294
|
-
|
|
35295
|
-
|
|
35793
|
+
fs12.readSync(fd, buffer, 0, bytesToRead, start);
|
|
35794
|
+
fs12.writeFileSync(targetPath, buffer);
|
|
35296
35795
|
} finally {
|
|
35297
|
-
|
|
35796
|
+
fs12.closeSync(fd);
|
|
35298
35797
|
}
|
|
35299
35798
|
}
|
|
35300
35799
|
function truncateUtf8(value, maxBytes) {
|
|
@@ -36863,7 +37362,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
36863
37362
|
};
|
|
36864
37363
|
|
|
36865
37364
|
// src/mcp-proxy/proxy.ts
|
|
36866
|
-
import * as
|
|
37365
|
+
import * as path15 from "node:path";
|
|
36867
37366
|
import * as crypto5 from "node:crypto";
|
|
36868
37367
|
|
|
36869
37368
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -37045,8 +37544,8 @@ function createCookieFetch(cookieJar) {
|
|
|
37045
37544
|
}
|
|
37046
37545
|
|
|
37047
37546
|
// src/core/utils/logWriter.ts
|
|
37048
|
-
import * as
|
|
37049
|
-
import * as
|
|
37547
|
+
import * as fs13 from "node:fs";
|
|
37548
|
+
import * as path14 from "node:path";
|
|
37050
37549
|
import * as crypto4 from "node:crypto";
|
|
37051
37550
|
|
|
37052
37551
|
// src/core/types/log.ts
|
|
@@ -37087,7 +37586,7 @@ var LogWriter = class {
|
|
|
37087
37586
|
return;
|
|
37088
37587
|
}
|
|
37089
37588
|
try {
|
|
37090
|
-
await
|
|
37589
|
+
await fs13.promises.mkdir(this.config.logDir, { recursive: true });
|
|
37091
37590
|
await this.cleanupOldLogs();
|
|
37092
37591
|
this.initialized = true;
|
|
37093
37592
|
} catch (error2) {
|
|
@@ -37110,7 +37609,7 @@ var LogWriter = class {
|
|
|
37110
37609
|
*/
|
|
37111
37610
|
getLogFilePath(date5) {
|
|
37112
37611
|
const d = date5 || this.getCurrentDate();
|
|
37113
|
-
return
|
|
37612
|
+
return path14.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
37114
37613
|
}
|
|
37115
37614
|
/**
|
|
37116
37615
|
* 获取或创建写入流
|
|
@@ -37125,7 +37624,7 @@ var LogWriter = class {
|
|
|
37125
37624
|
}
|
|
37126
37625
|
this.currentDate = date5;
|
|
37127
37626
|
try {
|
|
37128
|
-
this.writeStream =
|
|
37627
|
+
this.writeStream = fs13.createWriteStream(this.getLogFilePath(date5), {
|
|
37129
37628
|
flags: "a",
|
|
37130
37629
|
encoding: "utf8"
|
|
37131
37630
|
});
|
|
@@ -37177,11 +37676,11 @@ var LogWriter = class {
|
|
|
37177
37676
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
37178
37677
|
try {
|
|
37179
37678
|
const filePath = this.getLogFilePath();
|
|
37180
|
-
const dir =
|
|
37181
|
-
if (!
|
|
37182
|
-
|
|
37679
|
+
const dir = path14.dirname(filePath);
|
|
37680
|
+
if (!fs13.existsSync(dir)) {
|
|
37681
|
+
fs13.mkdirSync(dir, { recursive: true });
|
|
37183
37682
|
}
|
|
37184
|
-
|
|
37683
|
+
fs13.appendFileSync(filePath, message, "utf8");
|
|
37185
37684
|
} catch {
|
|
37186
37685
|
}
|
|
37187
37686
|
}
|
|
@@ -37192,7 +37691,7 @@ var LogWriter = class {
|
|
|
37192
37691
|
async cleanupOldLogs() {
|
|
37193
37692
|
if (this.config.maxDays <= 0) return;
|
|
37194
37693
|
try {
|
|
37195
|
-
const files = await
|
|
37694
|
+
const files = await fs13.promises.readdir(this.config.logDir);
|
|
37196
37695
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
37197
37696
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
37198
37697
|
const prefix = this.config.prefix;
|
|
@@ -37207,7 +37706,7 @@ var LogWriter = class {
|
|
|
37207
37706
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
37208
37707
|
const fileDate = new Date(year, month - 1, day);
|
|
37209
37708
|
if (fileDate < cutoffDate) {
|
|
37210
|
-
await
|
|
37709
|
+
await fs13.promises.unlink(path14.join(this.config.logDir, file2));
|
|
37211
37710
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
37212
37711
|
`);
|
|
37213
37712
|
}
|
|
@@ -37278,10 +37777,10 @@ var TapTapMCPProxy = class {
|
|
|
37278
37777
|
const { user_id, project_id } = this.config.tenant;
|
|
37279
37778
|
let logDir;
|
|
37280
37779
|
if (user_id && project_id) {
|
|
37281
|
-
logDir =
|
|
37780
|
+
logDir = path15.join(logRoot, "proxy", user_id, project_id);
|
|
37282
37781
|
} else {
|
|
37283
37782
|
const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
37284
|
-
logDir =
|
|
37783
|
+
logDir = path15.join(logRoot, "proxy", kidHash);
|
|
37285
37784
|
}
|
|
37286
37785
|
return new LogWriter({
|
|
37287
37786
|
logDir,
|
|
@@ -37914,6 +38413,9 @@ function printHelp2() {
|
|
|
37914
38413
|
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
37915
38414
|
" [--json]",
|
|
37916
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]",
|
|
37917
38419
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
37918
38420
|
" # --pat warns: PAT appears in ps/history",
|
|
37919
38421
|
" taptap-maker login [--env rnd|production] [--json]",
|
|
@@ -37931,7 +38433,7 @@ function printHelp2() {
|
|
|
37931
38433
|
"Maker MCP configs and npx verification use @taptap/maker.",
|
|
37932
38434
|
"",
|
|
37933
38435
|
"Windows note:",
|
|
37934
|
-
" Generated MCP configs
|
|
38436
|
+
" Generated MCP configs wrap npx.cmd with cmd.exe on Windows for spawn compatibility.",
|
|
37935
38437
|
""
|
|
37936
38438
|
].join("\n")
|
|
37937
38439
|
);
|