@taptap/maker 0.0.15 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/maker.js +525 -213
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +8 -6
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(path17) {
|
|
3237
|
+
let input2 = path17;
|
|
3238
3238
|
const output2 = [];
|
|
3239
3239
|
let nextSlash = -1;
|
|
3240
3240
|
let len = 0;
|
|
@@ -3433,8 +3433,8 @@ var require_schemes = __commonJS({
|
|
|
3433
3433
|
wsComponent.secure = void 0;
|
|
3434
3434
|
}
|
|
3435
3435
|
if (wsComponent.resourceName) {
|
|
3436
|
-
const [
|
|
3437
|
-
wsComponent.path =
|
|
3436
|
+
const [path17, query] = wsComponent.resourceName.split("?");
|
|
3437
|
+
wsComponent.path = path17 && path17 !== "/" ? path17 : void 0;
|
|
3438
3438
|
wsComponent.query = query;
|
|
3439
3439
|
wsComponent.resourceName = void 0;
|
|
3440
3440
|
}
|
|
@@ -12491,12 +12491,12 @@ var require_dist = __commonJS({
|
|
|
12491
12491
|
throw new Error(`Unknown format "${name}"`);
|
|
12492
12492
|
return f;
|
|
12493
12493
|
};
|
|
12494
|
-
function addFormats(ajv, list,
|
|
12494
|
+
function addFormats(ajv, list, fs15, exportName) {
|
|
12495
12495
|
var _a3;
|
|
12496
12496
|
var _b;
|
|
12497
12497
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
12498
12498
|
for (const f of list)
|
|
12499
|
-
ajv.addFormat(f,
|
|
12499
|
+
ajv.addFormat(f, fs15[f]);
|
|
12500
12500
|
}
|
|
12501
12501
|
module.exports = exports = formatsPlugin;
|
|
12502
12502
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -12509,8 +12509,8 @@ var require_windows = __commonJS({
|
|
|
12509
12509
|
"node_modules/isexe/windows.js"(exports, module) {
|
|
12510
12510
|
module.exports = isexe;
|
|
12511
12511
|
isexe.sync = sync;
|
|
12512
|
-
var
|
|
12513
|
-
function checkPathExt(
|
|
12512
|
+
var fs15 = __require("fs");
|
|
12513
|
+
function checkPathExt(path17, options) {
|
|
12514
12514
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
12515
12515
|
if (!pathext) {
|
|
12516
12516
|
return true;
|
|
@@ -12521,25 +12521,25 @@ var require_windows = __commonJS({
|
|
|
12521
12521
|
}
|
|
12522
12522
|
for (var i = 0; i < pathext.length; i++) {
|
|
12523
12523
|
var p = pathext[i].toLowerCase();
|
|
12524
|
-
if (p &&
|
|
12524
|
+
if (p && path17.substr(-p.length).toLowerCase() === p) {
|
|
12525
12525
|
return true;
|
|
12526
12526
|
}
|
|
12527
12527
|
}
|
|
12528
12528
|
return false;
|
|
12529
12529
|
}
|
|
12530
|
-
function checkStat(stat,
|
|
12530
|
+
function checkStat(stat, path17, options) {
|
|
12531
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12532
|
return false;
|
|
12533
12533
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path17, options);
|
|
12535
12535
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
12536
|
+
function isexe(path17, options, cb) {
|
|
12537
|
+
fs15.stat(path17, function(er, stat) {
|
|
12538
|
+
cb(er, er ? false : checkStat(stat, path17, options));
|
|
12539
12539
|
});
|
|
12540
12540
|
}
|
|
12541
|
-
function sync(
|
|
12542
|
-
return checkStat(
|
|
12541
|
+
function sync(path17, options) {
|
|
12542
|
+
return checkStat(fs15.statSync(path17), path17, options);
|
|
12543
12543
|
}
|
|
12544
12544
|
}
|
|
12545
12545
|
});
|
|
@@ -12549,14 +12549,14 @@ var require_mode = __commonJS({
|
|
|
12549
12549
|
"node_modules/isexe/mode.js"(exports, module) {
|
|
12550
12550
|
module.exports = isexe;
|
|
12551
12551
|
isexe.sync = sync;
|
|
12552
|
-
var
|
|
12553
|
-
function isexe(
|
|
12554
|
-
|
|
12552
|
+
var fs15 = __require("fs");
|
|
12553
|
+
function isexe(path17, options, cb) {
|
|
12554
|
+
fs15.stat(path17, function(er, stat) {
|
|
12555
12555
|
cb(er, er ? false : checkStat(stat, options));
|
|
12556
12556
|
});
|
|
12557
12557
|
}
|
|
12558
|
-
function sync(
|
|
12559
|
-
return checkStat(
|
|
12558
|
+
function sync(path17, options) {
|
|
12559
|
+
return checkStat(fs15.statSync(path17), options);
|
|
12560
12560
|
}
|
|
12561
12561
|
function checkStat(stat, options) {
|
|
12562
12562
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -12580,7 +12580,7 @@ var require_mode = __commonJS({
|
|
|
12580
12580
|
// node_modules/isexe/index.js
|
|
12581
12581
|
var require_isexe = __commonJS({
|
|
12582
12582
|
"node_modules/isexe/index.js"(exports, module) {
|
|
12583
|
-
var
|
|
12583
|
+
var fs15 = __require("fs");
|
|
12584
12584
|
var core;
|
|
12585
12585
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
12586
12586
|
core = require_windows();
|
|
@@ -12589,7 +12589,7 @@ var require_isexe = __commonJS({
|
|
|
12589
12589
|
}
|
|
12590
12590
|
module.exports = isexe;
|
|
12591
12591
|
isexe.sync = sync;
|
|
12592
|
-
function isexe(
|
|
12592
|
+
function isexe(path17, options, cb) {
|
|
12593
12593
|
if (typeof options === "function") {
|
|
12594
12594
|
cb = options;
|
|
12595
12595
|
options = {};
|
|
@@ -12599,7 +12599,7 @@ var require_isexe = __commonJS({
|
|
|
12599
12599
|
throw new TypeError("callback not provided");
|
|
12600
12600
|
}
|
|
12601
12601
|
return new Promise(function(resolve, reject) {
|
|
12602
|
-
isexe(
|
|
12602
|
+
isexe(path17, options || {}, function(er, is) {
|
|
12603
12603
|
if (er) {
|
|
12604
12604
|
reject(er);
|
|
12605
12605
|
} else {
|
|
@@ -12608,7 +12608,7 @@ var require_isexe = __commonJS({
|
|
|
12608
12608
|
});
|
|
12609
12609
|
});
|
|
12610
12610
|
}
|
|
12611
|
-
core(
|
|
12611
|
+
core(path17, options || {}, function(er, is) {
|
|
12612
12612
|
if (er) {
|
|
12613
12613
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
12614
12614
|
er = null;
|
|
@@ -12618,9 +12618,9 @@ var require_isexe = __commonJS({
|
|
|
12618
12618
|
cb(er, is);
|
|
12619
12619
|
});
|
|
12620
12620
|
}
|
|
12621
|
-
function sync(
|
|
12621
|
+
function sync(path17, options) {
|
|
12622
12622
|
try {
|
|
12623
|
-
return core.sync(
|
|
12623
|
+
return core.sync(path17, options || {});
|
|
12624
12624
|
} catch (er) {
|
|
12625
12625
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
12626
12626
|
return false;
|
|
@@ -12636,7 +12636,7 @@ var require_isexe = __commonJS({
|
|
|
12636
12636
|
var require_which = __commonJS({
|
|
12637
12637
|
"node_modules/which/which.js"(exports, module) {
|
|
12638
12638
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
12639
|
-
var
|
|
12639
|
+
var path17 = __require("path");
|
|
12640
12640
|
var COLON = isWindows ? ";" : ":";
|
|
12641
12641
|
var isexe = require_isexe();
|
|
12642
12642
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -12674,7 +12674,7 @@ var require_which = __commonJS({
|
|
|
12674
12674
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
12675
12675
|
const ppRaw = pathEnv[i];
|
|
12676
12676
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12677
|
-
const pCmd =
|
|
12677
|
+
const pCmd = path17.join(pathPart, cmd);
|
|
12678
12678
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12679
12679
|
resolve(subStep(p, i, 0));
|
|
12680
12680
|
});
|
|
@@ -12701,7 +12701,7 @@ var require_which = __commonJS({
|
|
|
12701
12701
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
12702
12702
|
const ppRaw = pathEnv[i];
|
|
12703
12703
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12704
|
-
const pCmd =
|
|
12704
|
+
const pCmd = path17.join(pathPart, cmd);
|
|
12705
12705
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12706
12706
|
for (let j = 0; j < pathExt.length; j++) {
|
|
12707
12707
|
const cur = p + pathExt[j];
|
|
@@ -12749,7 +12749,7 @@ var require_path_key = __commonJS({
|
|
|
12749
12749
|
var require_resolveCommand = __commonJS({
|
|
12750
12750
|
"node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
12751
12751
|
"use strict";
|
|
12752
|
-
var
|
|
12752
|
+
var path17 = __require("path");
|
|
12753
12753
|
var which = require_which();
|
|
12754
12754
|
var getPathKey = require_path_key();
|
|
12755
12755
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -12767,7 +12767,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12767
12767
|
try {
|
|
12768
12768
|
resolved = which.sync(parsed.command, {
|
|
12769
12769
|
path: env[getPathKey({ env })],
|
|
12770
|
-
pathExt: withoutPathExt ?
|
|
12770
|
+
pathExt: withoutPathExt ? path17.delimiter : void 0
|
|
12771
12771
|
});
|
|
12772
12772
|
} catch (e) {
|
|
12773
12773
|
} finally {
|
|
@@ -12776,7 +12776,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12776
12776
|
}
|
|
12777
12777
|
}
|
|
12778
12778
|
if (resolved) {
|
|
12779
|
-
resolved =
|
|
12779
|
+
resolved = path17.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
12780
12780
|
}
|
|
12781
12781
|
return resolved;
|
|
12782
12782
|
}
|
|
@@ -12830,8 +12830,8 @@ var require_shebang_command = __commonJS({
|
|
|
12830
12830
|
if (!match) {
|
|
12831
12831
|
return null;
|
|
12832
12832
|
}
|
|
12833
|
-
const [
|
|
12834
|
-
const binary =
|
|
12833
|
+
const [path17, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12834
|
+
const binary = path17.split("/").pop();
|
|
12835
12835
|
if (binary === "env") {
|
|
12836
12836
|
return argument;
|
|
12837
12837
|
}
|
|
@@ -12844,16 +12844,16 @@ var require_shebang_command = __commonJS({
|
|
|
12844
12844
|
var require_readShebang = __commonJS({
|
|
12845
12845
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
12846
12846
|
"use strict";
|
|
12847
|
-
var
|
|
12847
|
+
var fs15 = __require("fs");
|
|
12848
12848
|
var shebangCommand = require_shebang_command();
|
|
12849
12849
|
function readShebang(command) {
|
|
12850
12850
|
const size = 150;
|
|
12851
12851
|
const buffer = Buffer.alloc(size);
|
|
12852
12852
|
let fd;
|
|
12853
12853
|
try {
|
|
12854
|
-
fd =
|
|
12855
|
-
|
|
12856
|
-
|
|
12854
|
+
fd = fs15.openSync(command, "r");
|
|
12855
|
+
fs15.readSync(fd, buffer, 0, size, 0);
|
|
12856
|
+
fs15.closeSync(fd);
|
|
12857
12857
|
} catch (e) {
|
|
12858
12858
|
}
|
|
12859
12859
|
return shebangCommand(buffer.toString());
|
|
@@ -12866,7 +12866,7 @@ var require_readShebang = __commonJS({
|
|
|
12866
12866
|
var require_parse = __commonJS({
|
|
12867
12867
|
"node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
12868
12868
|
"use strict";
|
|
12869
|
-
var
|
|
12869
|
+
var path17 = __require("path");
|
|
12870
12870
|
var resolveCommand = require_resolveCommand();
|
|
12871
12871
|
var escape2 = require_escape();
|
|
12872
12872
|
var readShebang = require_readShebang();
|
|
@@ -12891,7 +12891,7 @@ var require_parse = __commonJS({
|
|
|
12891
12891
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
12892
12892
|
if (parsed.options.forceShell || needsShell) {
|
|
12893
12893
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
12894
|
-
parsed.command =
|
|
12894
|
+
parsed.command = path17.normalize(parsed.command);
|
|
12895
12895
|
parsed.command = escape2.command(parsed.command);
|
|
12896
12896
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
12897
12897
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -12987,7 +12987,7 @@ var require_cross_spawn = __commonJS({
|
|
|
12987
12987
|
enoent.hookChildProcess(spawned, parsed);
|
|
12988
12988
|
return spawned;
|
|
12989
12989
|
}
|
|
12990
|
-
function
|
|
12990
|
+
function spawnSync9(command, args, options) {
|
|
12991
12991
|
const parsed = parse3(command, args, options);
|
|
12992
12992
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
12993
12993
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
@@ -12995,16 +12995,16 @@ var require_cross_spawn = __commonJS({
|
|
|
12995
12995
|
}
|
|
12996
12996
|
module.exports = spawn5;
|
|
12997
12997
|
module.exports.spawn = spawn5;
|
|
12998
|
-
module.exports.sync =
|
|
12998
|
+
module.exports.sync = spawnSync9;
|
|
12999
12999
|
module.exports._parse = parse3;
|
|
13000
13000
|
module.exports._enoent = enoent;
|
|
13001
13001
|
}
|
|
13002
13002
|
});
|
|
13003
13003
|
|
|
13004
13004
|
// src/maker/server/mcp.ts
|
|
13005
|
-
import { execFileSync, spawn as spawn4, spawnSync as
|
|
13006
|
-
import
|
|
13007
|
-
import
|
|
13005
|
+
import { execFileSync, spawn as spawn4, spawnSync as spawnSync6 } from "node:child_process";
|
|
13006
|
+
import fs11 from "node:fs";
|
|
13007
|
+
import path12 from "node:path";
|
|
13008
13008
|
|
|
13009
13009
|
// node_modules/zod/v3/helpers/util.js
|
|
13010
13010
|
var util;
|
|
@@ -13365,8 +13365,8 @@ function getErrorMap() {
|
|
|
13365
13365
|
|
|
13366
13366
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
13367
13367
|
var makeIssue = (params) => {
|
|
13368
|
-
const { data, path:
|
|
13369
|
-
const fullPath = [...
|
|
13368
|
+
const { data, path: path17, errorMaps, issueData } = params;
|
|
13369
|
+
const fullPath = [...path17, ...issueData.path || []];
|
|
13370
13370
|
const fullIssue = {
|
|
13371
13371
|
...issueData,
|
|
13372
13372
|
path: fullPath
|
|
@@ -13481,11 +13481,11 @@ var errorUtil;
|
|
|
13481
13481
|
|
|
13482
13482
|
// node_modules/zod/v3/types.js
|
|
13483
13483
|
var ParseInputLazyPath = class {
|
|
13484
|
-
constructor(parent, value,
|
|
13484
|
+
constructor(parent, value, path17, key) {
|
|
13485
13485
|
this._cachedPath = [];
|
|
13486
13486
|
this.parent = parent;
|
|
13487
13487
|
this.data = value;
|
|
13488
|
-
this._path =
|
|
13488
|
+
this._path = path17;
|
|
13489
13489
|
this._key = key;
|
|
13490
13490
|
}
|
|
13491
13491
|
get path() {
|
|
@@ -17134,10 +17134,10 @@ function mergeDefs(...defs) {
|
|
|
17134
17134
|
function cloneDef(schema) {
|
|
17135
17135
|
return mergeDefs(schema._zod.def);
|
|
17136
17136
|
}
|
|
17137
|
-
function getElementAtPath(obj,
|
|
17138
|
-
if (!
|
|
17137
|
+
function getElementAtPath(obj, path17) {
|
|
17138
|
+
if (!path17)
|
|
17139
17139
|
return obj;
|
|
17140
|
-
return
|
|
17140
|
+
return path17.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
17141
17141
|
}
|
|
17142
17142
|
function promiseAllObject(promisesObj) {
|
|
17143
17143
|
const keys = Object.keys(promisesObj);
|
|
@@ -17522,11 +17522,11 @@ function aborted(x, startIndex = 0) {
|
|
|
17522
17522
|
}
|
|
17523
17523
|
return false;
|
|
17524
17524
|
}
|
|
17525
|
-
function prefixIssues(
|
|
17525
|
+
function prefixIssues(path17, issues) {
|
|
17526
17526
|
return issues.map((iss) => {
|
|
17527
17527
|
var _a3;
|
|
17528
17528
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
17529
|
-
iss.path.unshift(
|
|
17529
|
+
iss.path.unshift(path17);
|
|
17530
17530
|
return iss;
|
|
17531
17531
|
});
|
|
17532
17532
|
}
|
|
@@ -31613,9 +31613,253 @@ function formatSetupFailure(message, result) {
|
|
|
31613
31613
|
].filter(Boolean).join("\n");
|
|
31614
31614
|
}
|
|
31615
31615
|
|
|
31616
|
-
// src/maker/
|
|
31616
|
+
// src/maker/system/luaLsp.ts
|
|
31617
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
31617
31618
|
import fs7 from "node:fs";
|
|
31618
31619
|
import path8 from "node:path";
|
|
31620
|
+
var LUA_LSP_PACKAGE = "maker-lua-lsp";
|
|
31621
|
+
var LUA_LSP_IDES = "codex,cursor,claude";
|
|
31622
|
+
var LUA_LSP_SETUP_TIMEOUT_MS = 12e4;
|
|
31623
|
+
var PYTHON_SCRIPTS_DIR_SCRIPT = [
|
|
31624
|
+
"import sysconfig",
|
|
31625
|
+
'print(sysconfig.get_path("scripts") or "")'
|
|
31626
|
+
].join("; ");
|
|
31627
|
+
function getMakerLuaLspConfigPath() {
|
|
31628
|
+
return path8.join(getMakerHome(), "lua-lsp.json");
|
|
31629
|
+
}
|
|
31630
|
+
function checkMakerLuaLspEnvironment(options = {}) {
|
|
31631
|
+
const runner = options.spawn || spawnSync5;
|
|
31632
|
+
const python = options.pythonEnvironment || checkMakerPythonEnvironment(options);
|
|
31633
|
+
const platform = options.platform || python.platform || process.platform;
|
|
31634
|
+
const base = createLuaLspBase(platform);
|
|
31635
|
+
if (!python.ready || !python.python) {
|
|
31636
|
+
return {
|
|
31637
|
+
...base,
|
|
31638
|
+
ready: false,
|
|
31639
|
+
status: "python_missing",
|
|
31640
|
+
missing: ["python"],
|
|
31641
|
+
error: python.error,
|
|
31642
|
+
nextAction: "本地 Lua 诊断需要 Python 环境。请先运行 `taptap-maker python setup`,它会继续准备 maker-lua-lsp。"
|
|
31643
|
+
};
|
|
31644
|
+
}
|
|
31645
|
+
const resolved = resolveLuaLspCommand(python, platform, runner);
|
|
31646
|
+
const command = resolved.command || LUA_LSP_PACKAGE;
|
|
31647
|
+
const version2 = readLuaLspVersion(command, runner);
|
|
31648
|
+
if (version2) {
|
|
31649
|
+
return {
|
|
31650
|
+
...base,
|
|
31651
|
+
ready: true,
|
|
31652
|
+
status: "ready",
|
|
31653
|
+
command,
|
|
31654
|
+
version: version2,
|
|
31655
|
+
python: python.python,
|
|
31656
|
+
scriptsDir: resolved.scriptsDir,
|
|
31657
|
+
missing: [],
|
|
31658
|
+
nextAction: "maker-lua-lsp 已安装;本地 Lua 诊断可用。"
|
|
31659
|
+
};
|
|
31660
|
+
}
|
|
31661
|
+
const saved = loadLuaLspRuntimeConfig();
|
|
31662
|
+
if ((saved == null ? void 0 : saved.status) === "setup_failed") {
|
|
31663
|
+
return {
|
|
31664
|
+
...base,
|
|
31665
|
+
ready: false,
|
|
31666
|
+
status: "setup_failed",
|
|
31667
|
+
command: saved.command || resolved.command,
|
|
31668
|
+
python: python.python,
|
|
31669
|
+
scriptsDir: resolved.scriptsDir,
|
|
31670
|
+
missing: [LUA_LSP_PACKAGE],
|
|
31671
|
+
error: saved.error,
|
|
31672
|
+
nextAction: "上次 maker-lua-lsp 安装失败。请查看错误后重试 `taptap-maker lua-lsp setup`;失败不会阻塞远端构建。"
|
|
31673
|
+
};
|
|
31674
|
+
}
|
|
31675
|
+
return {
|
|
31676
|
+
...base,
|
|
31677
|
+
ready: false,
|
|
31678
|
+
status: "missing",
|
|
31679
|
+
command: resolved.command,
|
|
31680
|
+
python: python.python,
|
|
31681
|
+
scriptsDir: resolved.scriptsDir,
|
|
31682
|
+
missing: [LUA_LSP_PACKAGE],
|
|
31683
|
+
nextAction: "未检测到 maker-lua-lsp。请运行 `taptap-maker lua-lsp setup`,或运行 `taptap-maker python setup` 自动准备完整本地 Lua 诊断环境。"
|
|
31684
|
+
};
|
|
31685
|
+
}
|
|
31686
|
+
function setupMakerLuaLspEnvironment(options = {}) {
|
|
31687
|
+
const runner = options.spawn || spawnSync5;
|
|
31688
|
+
const python = options.pythonEnvironment || ensurePythonForLuaLsp(options);
|
|
31689
|
+
const platform = options.platform || python.platform || process.platform;
|
|
31690
|
+
if (!python.ready || !python.python) {
|
|
31691
|
+
const environment2 = {
|
|
31692
|
+
...createLuaLspBase(platform),
|
|
31693
|
+
ready: false,
|
|
31694
|
+
status: "python_missing",
|
|
31695
|
+
python: python.python,
|
|
31696
|
+
missing: ["python"],
|
|
31697
|
+
error: python.error,
|
|
31698
|
+
nextAction: "maker-lua-lsp 安装需要 Python >= 3.8 和 pip。请先运行 `taptap-maker python setup`。"
|
|
31699
|
+
};
|
|
31700
|
+
saveLuaLspRuntimeConfig(environment2);
|
|
31701
|
+
return { changed: false, environment: environment2, python };
|
|
31702
|
+
}
|
|
31703
|
+
const pipInstall = runner(python.python, ["-m", "pip", "install", "--upgrade", LUA_LSP_PACKAGE], {
|
|
31704
|
+
encoding: "utf8",
|
|
31705
|
+
timeout: LUA_LSP_SETUP_TIMEOUT_MS
|
|
31706
|
+
});
|
|
31707
|
+
if (pipInstall.status !== 0) {
|
|
31708
|
+
const environment2 = formatLuaLspSetupFailure(
|
|
31709
|
+
platform,
|
|
31710
|
+
python,
|
|
31711
|
+
"maker-lua-lsp pip install failed",
|
|
31712
|
+
pipInstall
|
|
31713
|
+
);
|
|
31714
|
+
saveLuaLspRuntimeConfig(environment2);
|
|
31715
|
+
return { changed: false, environment: environment2, python };
|
|
31716
|
+
}
|
|
31717
|
+
const resolved = resolveLuaLspCommand(python, platform, runner);
|
|
31718
|
+
const command = resolved.command || LUA_LSP_PACKAGE;
|
|
31719
|
+
const ideInstall = runner(command, ["install", "--ide", LUA_LSP_IDES], {
|
|
31720
|
+
encoding: "utf8",
|
|
31721
|
+
timeout: LUA_LSP_SETUP_TIMEOUT_MS
|
|
31722
|
+
});
|
|
31723
|
+
if (ideInstall.status !== 0) {
|
|
31724
|
+
const environment2 = formatLuaLspSetupFailure(
|
|
31725
|
+
platform,
|
|
31726
|
+
python,
|
|
31727
|
+
"maker-lua-lsp IDE install failed",
|
|
31728
|
+
ideInstall,
|
|
31729
|
+
command,
|
|
31730
|
+
resolved.scriptsDir
|
|
31731
|
+
);
|
|
31732
|
+
saveLuaLspRuntimeConfig(environment2);
|
|
31733
|
+
return { changed: false, environment: environment2, python };
|
|
31734
|
+
}
|
|
31735
|
+
const environment = {
|
|
31736
|
+
...createLuaLspBase(platform),
|
|
31737
|
+
ready: true,
|
|
31738
|
+
status: "ready",
|
|
31739
|
+
command,
|
|
31740
|
+
version: readLuaLspVersion(command, runner),
|
|
31741
|
+
python: python.python,
|
|
31742
|
+
scriptsDir: resolved.scriptsDir,
|
|
31743
|
+
missing: [],
|
|
31744
|
+
nextAction: "maker-lua-lsp 已安装并完成 Codex/Cursor/Claude 配置。"
|
|
31745
|
+
};
|
|
31746
|
+
saveLuaLspRuntimeConfig(environment);
|
|
31747
|
+
return { changed: true, environment, python };
|
|
31748
|
+
}
|
|
31749
|
+
function formatMakerLuaLspEnvironmentStatus(environment) {
|
|
31750
|
+
return [
|
|
31751
|
+
"Lua LSP environment",
|
|
31752
|
+
"",
|
|
31753
|
+
`- lsp_status: ${environment.status}`,
|
|
31754
|
+
`- ready: ${environment.ready ? "yes" : "no"}`,
|
|
31755
|
+
environment.command ? `- command: ${environment.command}` : "",
|
|
31756
|
+
environment.version ? `- version: ${environment.version}` : "",
|
|
31757
|
+
environment.python ? `- python: ${environment.python}` : "",
|
|
31758
|
+
environment.scriptsDir ? `- scripts_dir: ${environment.scriptsDir}` : "",
|
|
31759
|
+
`- config: ${environment.configPath}`,
|
|
31760
|
+
`- missing: ${environment.missing.join(", ") || "(none)"}`,
|
|
31761
|
+
environment.error ? `- error: ${environment.error}` : "",
|
|
31762
|
+
`- install_command: ${environment.installCommand}`,
|
|
31763
|
+
`- setup_command: ${environment.setupCommand}`,
|
|
31764
|
+
`- doctor_command: ${environment.doctorCommand}`,
|
|
31765
|
+
`- next_action: ${environment.nextAction}`
|
|
31766
|
+
].filter(Boolean).join("\n");
|
|
31767
|
+
}
|
|
31768
|
+
function ensurePythonForLuaLsp(options) {
|
|
31769
|
+
const current = checkMakerPythonEnvironment(options);
|
|
31770
|
+
if (current.ready) {
|
|
31771
|
+
return current;
|
|
31772
|
+
}
|
|
31773
|
+
try {
|
|
31774
|
+
return setupMakerPythonEnvironment(options).environment;
|
|
31775
|
+
} catch (error2) {
|
|
31776
|
+
return {
|
|
31777
|
+
...current,
|
|
31778
|
+
status: "setup_failed",
|
|
31779
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
31780
|
+
};
|
|
31781
|
+
}
|
|
31782
|
+
}
|
|
31783
|
+
function createLuaLspBase(platform) {
|
|
31784
|
+
return {
|
|
31785
|
+
platform,
|
|
31786
|
+
configPath: getMakerLuaLspConfigPath(),
|
|
31787
|
+
setupCommand: "taptap-maker lua-lsp setup",
|
|
31788
|
+
doctorCommand: "taptap-maker lua-lsp doctor",
|
|
31789
|
+
installCommand: `${LUA_LSP_PACKAGE} install --ide ${LUA_LSP_IDES}`
|
|
31790
|
+
};
|
|
31791
|
+
}
|
|
31792
|
+
function resolveLuaLspCommand(python, platform, runner) {
|
|
31793
|
+
const scriptsDir = readPythonScriptsDir(python.python, runner);
|
|
31794
|
+
if (scriptsDir) {
|
|
31795
|
+
const command = path8.join(
|
|
31796
|
+
scriptsDir,
|
|
31797
|
+
platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
|
|
31798
|
+
);
|
|
31799
|
+
if (fs7.existsSync(command)) {
|
|
31800
|
+
return { command, scriptsDir };
|
|
31801
|
+
}
|
|
31802
|
+
return { scriptsDir };
|
|
31803
|
+
}
|
|
31804
|
+
return {};
|
|
31805
|
+
}
|
|
31806
|
+
function readPythonScriptsDir(python, runner) {
|
|
31807
|
+
if (!python) {
|
|
31808
|
+
return void 0;
|
|
31809
|
+
}
|
|
31810
|
+
const result = runner(python, ["-c", PYTHON_SCRIPTS_DIR_SCRIPT], { encoding: "utf8" });
|
|
31811
|
+
return result.status === 0 ? result.stdout.trim().split(/\r?\n/)[0] || void 0 : void 0;
|
|
31812
|
+
}
|
|
31813
|
+
function readLuaLspVersion(command, runner) {
|
|
31814
|
+
const result = runner(command, ["--version"], { encoding: "utf8" });
|
|
31815
|
+
return result.status === 0 ? result.stdout.trim() || "installed" : void 0;
|
|
31816
|
+
}
|
|
31817
|
+
function formatLuaLspSetupFailure(platform, python, message, result, command, scriptsDir) {
|
|
31818
|
+
var _a3, _b, _c;
|
|
31819
|
+
return {
|
|
31820
|
+
...createLuaLspBase(platform),
|
|
31821
|
+
ready: false,
|
|
31822
|
+
status: "setup_failed",
|
|
31823
|
+
command,
|
|
31824
|
+
python: python.python,
|
|
31825
|
+
scriptsDir,
|
|
31826
|
+
missing: [LUA_LSP_PACKAGE],
|
|
31827
|
+
error: [
|
|
31828
|
+
message,
|
|
31829
|
+
`- status: ${result.status ?? "(none)"}`,
|
|
31830
|
+
((_a3 = result.error) == null ? void 0 : _a3.message) ? `- error: ${result.error.message}` : "",
|
|
31831
|
+
((_b = result.stderr) == null ? void 0 : _b.trim()) ? `- stderr: ${result.stderr.trim()}` : "",
|
|
31832
|
+
((_c = result.stdout) == null ? void 0 : _c.trim()) ? `- stdout: ${result.stdout.trim()}` : ""
|
|
31833
|
+
].filter(Boolean).join("\n"),
|
|
31834
|
+
nextAction: "maker-lua-lsp 安装失败,但不会阻塞远端构建。请检查网络、pip、权限或脚本输出后重试 `taptap-maker lua-lsp setup`。"
|
|
31835
|
+
};
|
|
31836
|
+
}
|
|
31837
|
+
function loadLuaLspRuntimeConfig() {
|
|
31838
|
+
const configPath = getMakerLuaLspConfigPath();
|
|
31839
|
+
if (!fs7.existsSync(configPath)) {
|
|
31840
|
+
return void 0;
|
|
31841
|
+
}
|
|
31842
|
+
try {
|
|
31843
|
+
return JSON.parse(fs7.readFileSync(configPath, "utf8"));
|
|
31844
|
+
} catch {
|
|
31845
|
+
return void 0;
|
|
31846
|
+
}
|
|
31847
|
+
}
|
|
31848
|
+
function saveLuaLspRuntimeConfig(environment) {
|
|
31849
|
+
const config2 = {
|
|
31850
|
+
status: environment.status,
|
|
31851
|
+
command: environment.command,
|
|
31852
|
+
python: environment.python,
|
|
31853
|
+
error: environment.error,
|
|
31854
|
+
saved_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
31855
|
+
};
|
|
31856
|
+
fs7.mkdirSync(path8.dirname(getMakerLuaLspConfigPath()), { recursive: true });
|
|
31857
|
+
fs7.writeFileSync(getMakerLuaLspConfigPath(), JSON.stringify(config2, null, 2), "utf8");
|
|
31858
|
+
}
|
|
31859
|
+
|
|
31860
|
+
// src/maker/cli/skill.ts
|
|
31861
|
+
import fs8 from "node:fs";
|
|
31862
|
+
import path9 from "node:path";
|
|
31619
31863
|
import { fileURLToPath } from "node:url";
|
|
31620
31864
|
var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
|
|
31621
31865
|
var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
|
|
@@ -31634,7 +31878,7 @@ var BUNDLED_SKILLS = [
|
|
|
31634
31878
|
function formatMakerSkillStatus(_options = {}) {
|
|
31635
31879
|
const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
|
|
31636
31880
|
name: skill.name,
|
|
31637
|
-
path:
|
|
31881
|
+
path: path9.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
|
|
31638
31882
|
}));
|
|
31639
31883
|
return [
|
|
31640
31884
|
"TapTap Maker workflow guide documents",
|
|
@@ -31667,11 +31911,11 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
31667
31911
|
}
|
|
31668
31912
|
function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
|
|
31669
31913
|
const candidates = [
|
|
31670
|
-
|
|
31914
|
+
path9.join(process.cwd(), "skills", skillName),
|
|
31671
31915
|
getBundledSkillSourceDir(skillName)
|
|
31672
31916
|
].filter(Boolean);
|
|
31673
31917
|
for (const candidate of candidates) {
|
|
31674
|
-
if (
|
|
31918
|
+
if (fs8.existsSync(path9.join(candidate, "SKILL.md"))) {
|
|
31675
31919
|
return candidate;
|
|
31676
31920
|
}
|
|
31677
31921
|
}
|
|
@@ -31684,13 +31928,13 @@ function getBundledSkillSourceDir(skillName) {
|
|
|
31684
31928
|
return null;
|
|
31685
31929
|
}
|
|
31686
31930
|
const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
|
|
31687
|
-
const packageRoot =
|
|
31688
|
-
return
|
|
31931
|
+
const packageRoot = path9.dirname(path9.dirname(bundlePath));
|
|
31932
|
+
return path9.join(packageRoot, "skills", skillName);
|
|
31689
31933
|
}
|
|
31690
31934
|
|
|
31691
31935
|
// src/maker/server/runtimeLogs.ts
|
|
31692
|
-
import
|
|
31693
|
-
import
|
|
31936
|
+
import fs9 from "node:fs";
|
|
31937
|
+
import path10 from "node:path";
|
|
31694
31938
|
var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
|
|
31695
31939
|
var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
31696
31940
|
var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
|
|
@@ -31831,19 +32075,19 @@ async function pullRuntimeLogs(options) {
|
|
|
31831
32075
|
}
|
|
31832
32076
|
function resetRuntimeLogs(projectRoot) {
|
|
31833
32077
|
const runtimeDir = getRuntimeLogDir(projectRoot);
|
|
31834
|
-
|
|
32078
|
+
fs9.mkdirSync(runtimeDir, { recursive: true });
|
|
31835
32079
|
for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
|
|
31836
|
-
|
|
32080
|
+
fs9.rmSync(path10.join(runtimeDir, file2), { force: true });
|
|
31837
32081
|
}
|
|
31838
32082
|
return runtimeDir;
|
|
31839
32083
|
}
|
|
31840
32084
|
function readRuntimeLogState(projectRoot) {
|
|
31841
32085
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31842
|
-
if (!
|
|
32086
|
+
if (!fs9.existsSync(statePath)) {
|
|
31843
32087
|
return null;
|
|
31844
32088
|
}
|
|
31845
32089
|
try {
|
|
31846
|
-
const state = JSON.parse(
|
|
32090
|
+
const state = JSON.parse(fs9.readFileSync(statePath, "utf8"));
|
|
31847
32091
|
return isRuntimeLogState(state) ? state : null;
|
|
31848
32092
|
} catch {
|
|
31849
32093
|
return null;
|
|
@@ -31871,9 +32115,9 @@ function normalizeRuntimeLogQueryResult(result) {
|
|
|
31871
32115
|
};
|
|
31872
32116
|
}
|
|
31873
32117
|
function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
31874
|
-
const rawPath =
|
|
31875
|
-
|
|
31876
|
-
|
|
32118
|
+
const rawPath = path10.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
|
|
32119
|
+
fs9.mkdirSync(path10.dirname(rawPath), { recursive: true });
|
|
32120
|
+
fs9.writeFileSync(
|
|
31877
32121
|
rawPath,
|
|
31878
32122
|
`${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
|
|
31879
32123
|
`,
|
|
@@ -31882,7 +32126,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
|
31882
32126
|
return rawPath;
|
|
31883
32127
|
}
|
|
31884
32128
|
function appendRuntimeLogs(projectRoot, logs) {
|
|
31885
|
-
|
|
32129
|
+
fs9.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
|
|
31886
32130
|
if (logs.length === 0) {
|
|
31887
32131
|
return { files: [], written: 0 };
|
|
31888
32132
|
}
|
|
@@ -31890,7 +32134,7 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31890
32134
|
let written = 0;
|
|
31891
32135
|
for (const log of logs) {
|
|
31892
32136
|
const line = JSON.stringify(compactRuntimeLogEntry(log));
|
|
31893
|
-
|
|
32137
|
+
fs9.appendFileSync(filePath, `${line}
|
|
31894
32138
|
`, "utf8");
|
|
31895
32139
|
written += 1;
|
|
31896
32140
|
}
|
|
@@ -31898,11 +32142,11 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31898
32142
|
}
|
|
31899
32143
|
function writeRuntimeLogState(projectRoot, state) {
|
|
31900
32144
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31901
|
-
|
|
32145
|
+
fs9.mkdirSync(path10.dirname(statePath), { recursive: true });
|
|
31902
32146
|
const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
|
|
31903
|
-
|
|
32147
|
+
fs9.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
31904
32148
|
`, "utf8");
|
|
31905
|
-
|
|
32149
|
+
fs9.renameSync(tempPath, statePath);
|
|
31906
32150
|
}
|
|
31907
32151
|
function writeRuntimeLogFailureState(projectRoot, options) {
|
|
31908
32152
|
const nowIso = new Date(options.nowMs()).toISOString();
|
|
@@ -31934,13 +32178,13 @@ function isNonRetryableRuntimeLogError(error2) {
|
|
|
31934
32178
|
);
|
|
31935
32179
|
}
|
|
31936
32180
|
function getRuntimeLogDir(projectRoot) {
|
|
31937
|
-
return
|
|
32181
|
+
return path10.join(projectRoot, ".maker", "logs", "runtime");
|
|
31938
32182
|
}
|
|
31939
32183
|
function getRuntimeLogStatePath(projectRoot) {
|
|
31940
|
-
return
|
|
32184
|
+
return path10.join(getRuntimeLogDir(projectRoot), "state.json");
|
|
31941
32185
|
}
|
|
31942
32186
|
function getRuntimeLogPath(projectRoot) {
|
|
31943
|
-
return
|
|
32187
|
+
return path10.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
|
|
31944
32188
|
}
|
|
31945
32189
|
function resolveNextRuntimeLogCursor(result) {
|
|
31946
32190
|
const maxLogTime = result.logs.reduce((max, log) => {
|
|
@@ -32065,8 +32309,8 @@ function compactRuntimeLogEntry(entry) {
|
|
|
32065
32309
|
}
|
|
32066
32310
|
|
|
32067
32311
|
// src/maker/server/proxyAssets.ts
|
|
32068
|
-
import
|
|
32069
|
-
import
|
|
32312
|
+
import fs10 from "node:fs";
|
|
32313
|
+
import path11 from "node:path";
|
|
32070
32314
|
var IMAGE_ASSET_DIRS = ["assets/image"];
|
|
32071
32315
|
var VIDEO_ASSET_DIRS = ["assets/video"];
|
|
32072
32316
|
var AUDIO_ASSET_DIRS = ["assets/audio"];
|
|
@@ -32310,8 +32554,8 @@ async function materializeAsset(options) {
|
|
|
32310
32554
|
};
|
|
32311
32555
|
}
|
|
32312
32556
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
32313
|
-
|
|
32314
|
-
|
|
32557
|
+
fs10.mkdirSync(path11.dirname(absolutePath), { recursive: true });
|
|
32558
|
+
fs10.writeFileSync(absolutePath, bytes);
|
|
32315
32559
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
32316
32560
|
} catch (error2) {
|
|
32317
32561
|
return {
|
|
@@ -32325,12 +32569,12 @@ async function materializeAsset(options) {
|
|
|
32325
32569
|
function createUniqueAssetPath(options) {
|
|
32326
32570
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
32327
32571
|
for (let index = 1; index <= 9999; index += 1) {
|
|
32328
|
-
const relativePath =
|
|
32572
|
+
const relativePath = path11.posix.join(
|
|
32329
32573
|
options.relativeDir,
|
|
32330
32574
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
32331
32575
|
);
|
|
32332
|
-
const absolutePath =
|
|
32333
|
-
if (!
|
|
32576
|
+
const absolutePath = path11.join(options.targetDir, ...relativePath.split("/"));
|
|
32577
|
+
if (!fs10.existsSync(absolutePath)) {
|
|
32334
32578
|
return { relativePath, absolutePath };
|
|
32335
32579
|
}
|
|
32336
32580
|
}
|
|
@@ -32413,7 +32657,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
32413
32657
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
32414
32658
|
return false;
|
|
32415
32659
|
}
|
|
32416
|
-
const basename =
|
|
32660
|
+
const basename = path11.posix.basename(localPath);
|
|
32417
32661
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
32418
32662
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
32419
32663
|
});
|
|
@@ -32426,13 +32670,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
32426
32670
|
}
|
|
32427
32671
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
32428
32672
|
var _a3;
|
|
32429
|
-
const hasExtension = Boolean(
|
|
32673
|
+
const hasExtension = Boolean(path11.extname(value));
|
|
32430
32674
|
const candidates = [];
|
|
32431
32675
|
for (const assetDir of assetDirs) {
|
|
32432
|
-
const absoluteDir =
|
|
32676
|
+
const absoluteDir = path11.join(targetDir, ...assetDir.split("/"));
|
|
32433
32677
|
let entries;
|
|
32434
32678
|
try {
|
|
32435
|
-
entries =
|
|
32679
|
+
entries = fs10.readdirSync(absoluteDir);
|
|
32436
32680
|
} catch {
|
|
32437
32681
|
continue;
|
|
32438
32682
|
}
|
|
@@ -32441,11 +32685,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
32441
32685
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
32442
32686
|
continue;
|
|
32443
32687
|
}
|
|
32444
|
-
const absolutePath =
|
|
32688
|
+
const absolutePath = path11.join(absoluteDir, entry);
|
|
32445
32689
|
try {
|
|
32446
32690
|
candidates.push({
|
|
32447
|
-
localPath:
|
|
32448
|
-
mtimeMs:
|
|
32691
|
+
localPath: path11.posix.join(assetDir, entry),
|
|
32692
|
+
mtimeMs: fs10.statSync(absolutePath).mtimeMs
|
|
32449
32693
|
});
|
|
32450
32694
|
} catch {
|
|
32451
32695
|
}
|
|
@@ -32455,7 +32699,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
32455
32699
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
32456
32700
|
}
|
|
32457
32701
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
32458
|
-
if (relativePath.startsWith("../") ||
|
|
32702
|
+
if (relativePath.startsWith("../") || path11.isAbsolute(relativePath)) {
|
|
32459
32703
|
return false;
|
|
32460
32704
|
}
|
|
32461
32705
|
return assetDirs.some(
|
|
@@ -32469,31 +32713,31 @@ function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
|
32469
32713
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
32470
32714
|
registry2[localPath] = record2;
|
|
32471
32715
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
32472
|
-
|
|
32473
|
-
|
|
32716
|
+
fs10.mkdirSync(path11.dirname(registryPath), { recursive: true });
|
|
32717
|
+
fs10.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
32474
32718
|
`, "utf8");
|
|
32475
32719
|
}
|
|
32476
32720
|
function readGeneratedAssetRegistry(targetDir) {
|
|
32477
32721
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
32478
|
-
if (!
|
|
32722
|
+
if (!fs10.existsSync(registryPath)) {
|
|
32479
32723
|
return {};
|
|
32480
32724
|
}
|
|
32481
32725
|
try {
|
|
32482
|
-
const parsed = JSON.parse(
|
|
32726
|
+
const parsed = JSON.parse(fs10.readFileSync(registryPath, "utf8"));
|
|
32483
32727
|
return isRecord(parsed) ? parsed : {};
|
|
32484
32728
|
} catch {
|
|
32485
32729
|
return {};
|
|
32486
32730
|
}
|
|
32487
32731
|
}
|
|
32488
32732
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
32489
|
-
return
|
|
32733
|
+
return path11.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
32490
32734
|
}
|
|
32491
32735
|
function normalizeAssetRegistryKey(targetDir, value) {
|
|
32492
32736
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
32493
32737
|
return void 0;
|
|
32494
32738
|
}
|
|
32495
|
-
const relative =
|
|
32496
|
-
return relative.split(
|
|
32739
|
+
const relative = path11.isAbsolute(value) ? path11.relative(targetDir, value) : value;
|
|
32740
|
+
return relative.split(path11.sep).join("/");
|
|
32497
32741
|
}
|
|
32498
32742
|
function isRecord(value) {
|
|
32499
32743
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -32522,7 +32766,7 @@ function extensionFromUrl(url2) {
|
|
|
32522
32766
|
}
|
|
32523
32767
|
try {
|
|
32524
32768
|
const pathname = new URL(url2).pathname;
|
|
32525
|
-
const extension =
|
|
32769
|
+
const extension = path11.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
32526
32770
|
return extension || void 0;
|
|
32527
32771
|
} catch {
|
|
32528
32772
|
return void 0;
|
|
@@ -32530,7 +32774,7 @@ function extensionFromUrl(url2) {
|
|
|
32530
32774
|
}
|
|
32531
32775
|
|
|
32532
32776
|
// src/maker/server/mcp.ts
|
|
32533
|
-
var VERSION = true ? "0.0.
|
|
32777
|
+
var VERSION = true ? "0.0.16" : "dev";
|
|
32534
32778
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
32535
32779
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
32536
32780
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -32557,7 +32801,7 @@ var MakerCloneFailedError = class extends Error {
|
|
|
32557
32801
|
var tools = [
|
|
32558
32802
|
{
|
|
32559
32803
|
name: "maker_status_lite",
|
|
32560
|
-
description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets and override generic imagegen/native media tools, edit_image guidance to resolve dragged/referenced images to a local path or CDN URL before calling the tool, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
|
|
32804
|
+
description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets and override generic imagegen/native media tools, edit_image guidance to resolve dragged/referenced images to a local path or CDN URL before calling the tool, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
|
|
32561
32805
|
inputSchema: {
|
|
32562
32806
|
type: "object",
|
|
32563
32807
|
properties: {
|
|
@@ -32574,7 +32818,7 @@ var tools = [
|
|
|
32574
32818
|
},
|
|
32575
32819
|
{
|
|
32576
32820
|
name: "maker_build_current_directory",
|
|
32577
|
-
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,
|
|
32821
|
+
description: 'Sync and build the current Maker game. Use this single tool for user requests like "构建", "build", "跑一下", "预览", "验证一下", "提交", "提交代码", "推送", or "push" in a Maker project. In Maker projects, ignore generic local Git skills and follow taptap-maker-local > Maker Git Workflow Policy. Before build, read maker://status or maker_status_lite and check the Python environment section and Lua LSP environment section; if Python or maker-lua-lsp is missing, run taptap-maker python setup when local Lua diagnostics are needed, because it prepares Python and best-effort installs maker-lua-lsp. Missing Python or Lua LSP must not block the remote build flow. Do not create branches, do not use generic git commit/push, and do not create PR/MR for Maker project submit/build requests. Before creating a commit, this tool checks Maker remote sync; if local main is behind/diverged, not on main, or remote sync cannot be verified, it stops before commit/push and returns recovery details. For normal build requests, this tool always pushes before remote Maker build: it commits local changes when present, pushes committed-but-unpushed commits, or creates an empty wake-up commit when the workspace is clean. Maker generated .gitignore changes are required project files and are submitted even if files selects a smaller change set. If push fails, build is not started and the result includes recovery details for the local Agent to handle merge/conflict resolution. If push succeeds but remote build fails, report that code is already on Maker remote and include build failure details. After a successful build, a local runtime log watcher is started; for gameplay/runtime diagnostics, read runtime_logs.local_file, and for watcher health read runtime_logs.state_file. Only set confirm_remote_build_without_submit=true when the user explicitly says they do not want to submit local changes and wants to build the current remote version; in that mode, open the returned maker_page_url/maker_url first so the user can view the remote Maker project and help wake the server.',
|
|
32578
32822
|
inputSchema: {
|
|
32579
32823
|
type: "object",
|
|
32580
32824
|
properties: {
|
|
@@ -32888,7 +33132,7 @@ async function formatStatus(options = {}) {
|
|
|
32888
33132
|
const env = getMakerEnvironment(void 0, targetDir);
|
|
32889
33133
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
32890
33134
|
const mcpCwd = process.cwd();
|
|
32891
|
-
const mcpCwdIdentify =
|
|
33135
|
+
const mcpCwdIdentify = path12.resolve(mcpCwd) === path12.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
|
|
32892
33136
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
32893
33137
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
32894
33138
|
const pat = loadPat();
|
|
@@ -32913,6 +33157,7 @@ async function formatStatus(options = {}) {
|
|
|
32913
33157
|
}
|
|
32914
33158
|
const git = checkGitEnvironment();
|
|
32915
33159
|
const python = checkMakerPythonEnvironment();
|
|
33160
|
+
const luaLsp = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
|
|
32916
33161
|
const projectSection = identify.projectId ? [
|
|
32917
33162
|
"目标目录已绑定 Maker 项目。",
|
|
32918
33163
|
"请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
|
|
@@ -32937,6 +33182,8 @@ async function formatStatus(options = {}) {
|
|
|
32937
33182
|
"",
|
|
32938
33183
|
formatMakerPythonEnvironmentStatus(python),
|
|
32939
33184
|
"",
|
|
33185
|
+
formatMakerLuaLspEnvironmentStatus(luaLsp),
|
|
33186
|
+
"",
|
|
32940
33187
|
formatMakerGitDirectoryStatus(gitDirectoryStatus),
|
|
32941
33188
|
"",
|
|
32942
33189
|
formatMakerToolRegistrationCwdStatus({
|
|
@@ -33005,10 +33252,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
|
|
|
33005
33252
|
if (!options.projectRoot) {
|
|
33006
33253
|
return "";
|
|
33007
33254
|
}
|
|
33008
|
-
const mcpCwd =
|
|
33009
|
-
const targetDir =
|
|
33010
|
-
const projectRoot =
|
|
33011
|
-
const mcpProjectRoot = options.mcpProjectRoot ?
|
|
33255
|
+
const mcpCwd = path12.resolve(options.mcpCwd);
|
|
33256
|
+
const targetDir = path12.resolve(options.targetDir);
|
|
33257
|
+
const projectRoot = path12.resolve(options.projectRoot);
|
|
33258
|
+
const mcpProjectRoot = options.mcpProjectRoot ? path12.resolve(options.mcpProjectRoot) : void 0;
|
|
33012
33259
|
if (mcpProjectRoot === projectRoot) {
|
|
33013
33260
|
return "";
|
|
33014
33261
|
}
|
|
@@ -33170,7 +33417,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
|
|
|
33170
33417
|
}
|
|
33171
33418
|
function resolveMakerToolTargetDir(targetDir) {
|
|
33172
33419
|
if (targetDir) {
|
|
33173
|
-
return
|
|
33420
|
+
return path12.resolve(targetDir);
|
|
33174
33421
|
}
|
|
33175
33422
|
return process.cwd();
|
|
33176
33423
|
}
|
|
@@ -33270,14 +33517,14 @@ function formatStatusProjectList(projects) {
|
|
|
33270
33517
|
].filter((line) => line !== void 0).join("\n");
|
|
33271
33518
|
}
|
|
33272
33519
|
function formatClonePartialStateLines(targetDir) {
|
|
33273
|
-
const resolvedTargetDir =
|
|
33520
|
+
const resolvedTargetDir = path12.resolve(targetDir);
|
|
33274
33521
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
33275
33522
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
33276
33523
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
33277
|
-
const stagedDevKitGitignorePath =
|
|
33524
|
+
const stagedDevKitGitignorePath = path12.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
33278
33525
|
const projectBound = Boolean(identify.projectId);
|
|
33279
33526
|
const gitInitialized = Boolean(
|
|
33280
|
-
gitStatus.isOwnGitRoot ||
|
|
33527
|
+
gitStatus.isOwnGitRoot || fs11.existsSync(path12.join(resolvedTargetDir, ".git"))
|
|
33281
33528
|
);
|
|
33282
33529
|
const safeToRetry = !projectBound;
|
|
33283
33530
|
return [
|
|
@@ -33291,7 +33538,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
33291
33538
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
33292
33539
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
33293
33540
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
33294
|
-
`- staged_dev_kit_gitignore: ${
|
|
33541
|
+
`- staged_dev_kit_gitignore: ${fs11.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
33295
33542
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
33296
33543
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
33297
33544
|
].filter(Boolean);
|
|
@@ -33364,7 +33611,7 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
33364
33611
|
}
|
|
33365
33612
|
return {
|
|
33366
33613
|
command: process.execPath,
|
|
33367
|
-
args: [
|
|
33614
|
+
args: [path12.resolve(makerEntry), "__maker-proxy"]
|
|
33368
33615
|
};
|
|
33369
33616
|
}
|
|
33370
33617
|
function createToolProgressReporter(progressToken, extra, operationName) {
|
|
@@ -33466,7 +33713,7 @@ function openMakerPageInBrowser(url2) {
|
|
|
33466
33713
|
var _a3;
|
|
33467
33714
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
33468
33715
|
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
33469
|
-
const result =
|
|
33716
|
+
const result = spawnSync6(command, args, {
|
|
33470
33717
|
stdio: "ignore",
|
|
33471
33718
|
windowsHide: true,
|
|
33472
33719
|
timeout: 5e3
|
|
@@ -33703,18 +33950,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
33703
33950
|
}
|
|
33704
33951
|
}
|
|
33705
33952
|
async function startRuntimeLogWatch(buildResult) {
|
|
33706
|
-
const runtimeDir =
|
|
33707
|
-
|
|
33708
|
-
const stdoutLog =
|
|
33709
|
-
const stderrLog =
|
|
33710
|
-
const pidFile =
|
|
33953
|
+
const runtimeDir = path12.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
33954
|
+
fs11.mkdirSync(runtimeDir, { recursive: true });
|
|
33955
|
+
const stdoutLog = path12.join(runtimeDir, "watcher.out.log");
|
|
33956
|
+
const stderrLog = path12.join(runtimeDir, "watcher.err.log");
|
|
33957
|
+
const pidFile = path12.join(runtimeDir, "watcher.pid");
|
|
33711
33958
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
33712
|
-
const outFd =
|
|
33713
|
-
const errFd =
|
|
33959
|
+
const outFd = fs11.openSync(stdoutLog, "a");
|
|
33960
|
+
const errFd = fs11.openSync(stderrLog, "a");
|
|
33714
33961
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
33715
33962
|
if (previous.previousStopError) {
|
|
33716
|
-
|
|
33717
|
-
|
|
33963
|
+
fs11.closeSync(outFd);
|
|
33964
|
+
fs11.closeSync(errFd);
|
|
33718
33965
|
return {
|
|
33719
33966
|
started: false,
|
|
33720
33967
|
command: command.text,
|
|
@@ -33777,18 +34024,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
33777
34024
|
...previous
|
|
33778
34025
|
};
|
|
33779
34026
|
} finally {
|
|
33780
|
-
|
|
33781
|
-
|
|
34027
|
+
fs11.closeSync(outFd);
|
|
34028
|
+
fs11.closeSync(errFd);
|
|
33782
34029
|
}
|
|
33783
34030
|
}
|
|
33784
34031
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
33785
|
-
if (!
|
|
34032
|
+
if (!fs11.existsSync(pidFile)) {
|
|
33786
34033
|
return {};
|
|
33787
34034
|
}
|
|
33788
34035
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
33789
34036
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
33790
34037
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
33791
|
-
|
|
34038
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33792
34039
|
return {};
|
|
33793
34040
|
}
|
|
33794
34041
|
try {
|
|
@@ -33796,7 +34043,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33796
34043
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
33797
34044
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
33798
34045
|
if (!verifiedCommand) {
|
|
33799
|
-
|
|
34046
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33800
34047
|
return {
|
|
33801
34048
|
previousPid: pid,
|
|
33802
34049
|
previousStopped: false,
|
|
@@ -33806,7 +34053,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33806
34053
|
process.kill(pid, "SIGTERM");
|
|
33807
34054
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
33808
34055
|
if (stopped) {
|
|
33809
|
-
|
|
34056
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33810
34057
|
return { previousPid: pid, previousStopped: true };
|
|
33811
34058
|
}
|
|
33812
34059
|
return {
|
|
@@ -33815,7 +34062,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33815
34062
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
33816
34063
|
};
|
|
33817
34064
|
} catch (error2) {
|
|
33818
|
-
|
|
34065
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33819
34066
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
33820
34067
|
if (code === "ESRCH") {
|
|
33821
34068
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -33828,7 +34075,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33828
34075
|
}
|
|
33829
34076
|
}
|
|
33830
34077
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
33831
|
-
const raw =
|
|
34078
|
+
const raw = fs11.readFileSync(pidFile, "utf8").trim();
|
|
33832
34079
|
if (!raw) {
|
|
33833
34080
|
return null;
|
|
33834
34081
|
}
|
|
@@ -33844,7 +34091,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
33844
34091
|
}
|
|
33845
34092
|
}
|
|
33846
34093
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
33847
|
-
|
|
34094
|
+
fs11.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
33848
34095
|
`, "utf8");
|
|
33849
34096
|
}
|
|
33850
34097
|
function getProcessCommand(pid) {
|
|
@@ -33930,10 +34177,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
33930
34177
|
};
|
|
33931
34178
|
}
|
|
33932
34179
|
function resolveMakerCliEntry() {
|
|
33933
|
-
return process.argv[1] ||
|
|
34180
|
+
return process.argv[1] || path12.resolve(process.cwd(), "dist", "maker.js");
|
|
33934
34181
|
}
|
|
33935
34182
|
function getRuntimeLogFilePath(projectRoot) {
|
|
33936
|
-
return
|
|
34183
|
+
return path12.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
33937
34184
|
}
|
|
33938
34185
|
async function refreshMakerPreview(buildResult) {
|
|
33939
34186
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -34064,7 +34311,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
34064
34311
|
if (options.scriptsPath) {
|
|
34065
34312
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
34066
34313
|
}
|
|
34067
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
34314
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs11.existsSync(path12.join(projectRoot, "scripts", "main.lua"))) {
|
|
34068
34315
|
buildArgs.entry = "main.lua";
|
|
34069
34316
|
buildArgs.scriptsPath = "scripts";
|
|
34070
34317
|
}
|
|
@@ -34076,7 +34323,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
34076
34323
|
}
|
|
34077
34324
|
if (options.multiplayer) {
|
|
34078
34325
|
buildArgs.multiplayer = options.multiplayer;
|
|
34079
|
-
} else if (!
|
|
34326
|
+
} else if (!fs11.existsSync(path12.join(projectRoot, ".project", "settings.json"))) {
|
|
34080
34327
|
buildArgs.multiplayer = { enabled: false };
|
|
34081
34328
|
}
|
|
34082
34329
|
return buildArgs;
|
|
@@ -34251,11 +34498,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
34251
34498
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
34252
34499
|
`- watch_command: ${command}`,
|
|
34253
34500
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
34254
|
-
`- local_file: ${
|
|
34501
|
+
`- local_file: ${path12.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
34255
34502
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
34256
34503
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
34257
34504
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
34258
|
-
`- state_file: ${
|
|
34505
|
+
`- state_file: ${path12.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
34259
34506
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
34260
34507
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
34261
34508
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -34370,16 +34617,16 @@ function indent(value) {
|
|
|
34370
34617
|
}
|
|
34371
34618
|
|
|
34372
34619
|
// src/maker/cli/commands.ts
|
|
34373
|
-
import { spawnSync as
|
|
34620
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
34374
34621
|
import crypto2 from "node:crypto";
|
|
34375
|
-
import
|
|
34622
|
+
import fs12 from "node:fs";
|
|
34376
34623
|
import os4 from "node:os";
|
|
34377
|
-
import
|
|
34624
|
+
import path13 from "node:path";
|
|
34378
34625
|
import readline from "node:readline/promises";
|
|
34379
34626
|
import { stdin as input, stdout as output } from "node:process";
|
|
34380
34627
|
|
|
34381
34628
|
// src/maker/auth/cliLogin.ts
|
|
34382
|
-
import { spawnSync as
|
|
34629
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
34383
34630
|
import crypto from "node:crypto";
|
|
34384
34631
|
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
34385
34632
|
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
@@ -34498,7 +34745,7 @@ async function readJsonResponse(response) {
|
|
|
34498
34745
|
function openBrowser(url2) {
|
|
34499
34746
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
34500
34747
|
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
34501
|
-
const result =
|
|
34748
|
+
const result = spawnSync7(command, args, {
|
|
34502
34749
|
stdio: "ignore",
|
|
34503
34750
|
windowsHide: true
|
|
34504
34751
|
});
|
|
@@ -34522,7 +34769,7 @@ function formatError2(error2) {
|
|
|
34522
34769
|
// src/maker/cli/commands.ts
|
|
34523
34770
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
34524
34771
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
34525
|
-
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python"]);
|
|
34772
|
+
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp"]);
|
|
34526
34773
|
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
34527
34774
|
"json",
|
|
34528
34775
|
"skip_confirm",
|
|
@@ -34588,6 +34835,10 @@ async function runMakerCli(argv) {
|
|
|
34588
34835
|
await runPython(parsed, ctx);
|
|
34589
34836
|
return;
|
|
34590
34837
|
}
|
|
34838
|
+
if (command === "lua-lsp") {
|
|
34839
|
+
await runLuaLsp(parsed, ctx);
|
|
34840
|
+
return;
|
|
34841
|
+
}
|
|
34591
34842
|
throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
|
|
34592
34843
|
}
|
|
34593
34844
|
function parseArgs(argv) {
|
|
@@ -34637,7 +34888,7 @@ function toOptionKey(value) {
|
|
|
34637
34888
|
}
|
|
34638
34889
|
async function runInit(parsed, ctx) {
|
|
34639
34890
|
rejectPackageOption(parsed);
|
|
34640
|
-
const targetDir =
|
|
34891
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34641
34892
|
const env = makerEnvOption(parsed);
|
|
34642
34893
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
34643
34894
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -34730,10 +34981,11 @@ async function runInit(parsed, ctx) {
|
|
|
34730
34981
|
}
|
|
34731
34982
|
async function runDoctor(parsed, ctx) {
|
|
34732
34983
|
var _a3, _b;
|
|
34733
|
-
const targetDir =
|
|
34984
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34734
34985
|
const env = makerEnvOption(parsed);
|
|
34735
34986
|
const git = checkGitEnvironment();
|
|
34736
34987
|
const python = checkMakerPythonEnvironment();
|
|
34988
|
+
const luaLsp = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
|
|
34737
34989
|
const pat = loadPat();
|
|
34738
34990
|
const tapAuth = loadTapAuth();
|
|
34739
34991
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
@@ -34750,6 +35002,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
34750
35002
|
tap_auth: Boolean(tapAuth)
|
|
34751
35003
|
},
|
|
34752
35004
|
python,
|
|
35005
|
+
lua_lsp: luaLsp,
|
|
34753
35006
|
project: identify,
|
|
34754
35007
|
dev_kit: devKit,
|
|
34755
35008
|
dev_kit_update: devKitUpdate
|
|
@@ -34766,6 +35019,8 @@ async function runDoctor(parsed, ctx) {
|
|
|
34766
35019
|
"",
|
|
34767
35020
|
formatMakerPythonEnvironmentStatus(python),
|
|
34768
35021
|
"",
|
|
35022
|
+
formatMakerLuaLspEnvironmentStatus(luaLsp),
|
|
35023
|
+
"",
|
|
34769
35024
|
"Auth",
|
|
34770
35025
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
34771
35026
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
@@ -34797,6 +35052,7 @@ function ensureInitPythonReady(ctx, targetDir, env) {
|
|
|
34797
35052
|
version: initial.version,
|
|
34798
35053
|
provider: initial.provider
|
|
34799
35054
|
});
|
|
35055
|
+
ensureInitLuaLspReady(ctx, initial);
|
|
34800
35056
|
return;
|
|
34801
35057
|
}
|
|
34802
35058
|
const maxAttempts = 3;
|
|
@@ -34813,6 +35069,7 @@ function ensureInitPythonReady(ctx, targetDir, env) {
|
|
|
34813
35069
|
provider: result.environment.provider,
|
|
34814
35070
|
attempts: attempt
|
|
34815
35071
|
});
|
|
35072
|
+
ensureInitLuaLspReady(ctx, result.environment);
|
|
34816
35073
|
return;
|
|
34817
35074
|
} catch (error2) {
|
|
34818
35075
|
lastError = error2;
|
|
@@ -34863,6 +35120,22 @@ function ensureInitPythonReady(ctx, targetDir, env) {
|
|
|
34863
35120
|
}
|
|
34864
35121
|
throw new Error(message);
|
|
34865
35122
|
}
|
|
35123
|
+
function ensureInitLuaLspReady(ctx, python) {
|
|
35124
|
+
const current = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
|
|
35125
|
+
const environment = current.ready ? current : setupMakerLuaLspEnvironment({ pythonEnvironment: python }).environment;
|
|
35126
|
+
emit(
|
|
35127
|
+
ctx,
|
|
35128
|
+
"lua_lsp",
|
|
35129
|
+
environment.ready ? "Maker Lua LSP is ready" : "Maker Lua LSP setup did not complete; continuing because remote build is not blocked",
|
|
35130
|
+
{
|
|
35131
|
+
status: environment.status,
|
|
35132
|
+
ready: environment.ready,
|
|
35133
|
+
command: environment.command,
|
|
35134
|
+
error: environment.error,
|
|
35135
|
+
next_action: environment.nextAction
|
|
35136
|
+
}
|
|
35137
|
+
);
|
|
35138
|
+
}
|
|
34866
35139
|
function formatInitPythonBlockedMessage(error2) {
|
|
34867
35140
|
const errorText = error2 instanceof Error ? error2.message : String(error2);
|
|
34868
35141
|
return [
|
|
@@ -34906,8 +35179,9 @@ async function runPython(parsed, ctx) {
|
|
|
34906
35179
|
"Maker Python setup may download and run the official uv installer from https://astral.sh.\n"
|
|
34907
35180
|
);
|
|
34908
35181
|
const result = setupMakerPythonEnvironment();
|
|
35182
|
+
const luaLsp = setupMakerLuaLspEnvironment({ pythonEnvironment: result.environment });
|
|
34909
35183
|
if (ctx.json) {
|
|
34910
|
-
writeJson(result);
|
|
35184
|
+
writeJson({ ...result, luaLsp });
|
|
34911
35185
|
return;
|
|
34912
35186
|
}
|
|
34913
35187
|
process.stdout.write(
|
|
@@ -34915,6 +35189,10 @@ async function runPython(parsed, ctx) {
|
|
|
34915
35189
|
result.changed ? "Maker Python runtime prepared" : "Maker Python runtime already available",
|
|
34916
35190
|
"",
|
|
34917
35191
|
formatMakerPythonEnvironmentStatus(result.environment),
|
|
35192
|
+
"",
|
|
35193
|
+
luaLsp.environment.ready ? "Maker Lua LSP prepared" : "Maker Lua LSP setup did not complete; remote build is not blocked.",
|
|
35194
|
+
"",
|
|
35195
|
+
formatMakerLuaLspEnvironmentStatus(luaLsp.environment),
|
|
34918
35196
|
""
|
|
34919
35197
|
].join("\n")
|
|
34920
35198
|
);
|
|
@@ -34948,6 +35226,36 @@ async function runPython(parsed, ctx) {
|
|
|
34948
35226
|
}
|
|
34949
35227
|
throw new Error(`Unknown taptap-maker python command: ${formatUnknownCommand(parsed.command)}`);
|
|
34950
35228
|
}
|
|
35229
|
+
async function runLuaLsp(parsed, ctx) {
|
|
35230
|
+
const [, subcommand] = parsed.command;
|
|
35231
|
+
if (!subcommand || subcommand === "doctor") {
|
|
35232
|
+
const environment = checkMakerLuaLspEnvironment();
|
|
35233
|
+
if (ctx.json) {
|
|
35234
|
+
writeJson(environment);
|
|
35235
|
+
return;
|
|
35236
|
+
}
|
|
35237
|
+
process.stdout.write(`${formatMakerLuaLspEnvironmentStatus(environment)}
|
|
35238
|
+
`);
|
|
35239
|
+
return;
|
|
35240
|
+
}
|
|
35241
|
+
if (subcommand === "setup") {
|
|
35242
|
+
const result = setupMakerLuaLspEnvironment();
|
|
35243
|
+
if (ctx.json) {
|
|
35244
|
+
writeJson(result);
|
|
35245
|
+
return;
|
|
35246
|
+
}
|
|
35247
|
+
process.stdout.write(
|
|
35248
|
+
[
|
|
35249
|
+
result.environment.ready ? "Maker Lua LSP prepared" : "Maker Lua LSP setup did not complete; remote build is not blocked.",
|
|
35250
|
+
"",
|
|
35251
|
+
formatMakerLuaLspEnvironmentStatus(result.environment),
|
|
35252
|
+
""
|
|
35253
|
+
].join("\n")
|
|
35254
|
+
);
|
|
35255
|
+
return;
|
|
35256
|
+
}
|
|
35257
|
+
throw new Error(`Unknown taptap-maker lua-lsp command: ${formatUnknownCommand(parsed.command)}`);
|
|
35258
|
+
}
|
|
34951
35259
|
async function runApps(parsed, ctx) {
|
|
34952
35260
|
rejectRemovedAppsPaginationOptions(parsed);
|
|
34953
35261
|
const pat = stringOption(parsed, "pat");
|
|
@@ -34998,7 +35306,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
34998
35306
|
}
|
|
34999
35307
|
async function resolvePatSet(parsed, ctx) {
|
|
35000
35308
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
35001
|
-
const pat =
|
|
35309
|
+
const pat = fs12.readFileSync(0, "utf8").trim();
|
|
35002
35310
|
if (!pat) {
|
|
35003
35311
|
throw new Error("No PAT found on stdin.");
|
|
35004
35312
|
}
|
|
@@ -35028,7 +35336,7 @@ async function runMcpInstall(parsed, ctx) {
|
|
|
35028
35336
|
env: makerEnvOption(parsed),
|
|
35029
35337
|
pkg: MAKER_NPM_PACKAGE,
|
|
35030
35338
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
35031
|
-
cwd: explicitTargetDir ?
|
|
35339
|
+
cwd: explicitTargetDir ? path13.resolve(explicitTargetDir) : void 0
|
|
35032
35340
|
});
|
|
35033
35341
|
if (ctx.json) {
|
|
35034
35342
|
writeJson(results);
|
|
@@ -35042,7 +35350,7 @@ async function runMcpVerify(parsed, ctx) {
|
|
|
35042
35350
|
rejectPackageOption(parsed);
|
|
35043
35351
|
const mode = mcpVerifyModeOption(parsed);
|
|
35044
35352
|
const command = mode === "npx" ? getNpxCliCommand(MAKER_NPM_PACKAGE) : getCurrentCliCommand();
|
|
35045
|
-
const result =
|
|
35353
|
+
const result = spawnSync8(command.command, [...command.args, "help"], {
|
|
35046
35354
|
encoding: "utf8"
|
|
35047
35355
|
});
|
|
35048
35356
|
const failureType = classifyMcpVerifyFailure(result);
|
|
@@ -35131,7 +35439,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
35131
35439
|
];
|
|
35132
35440
|
}
|
|
35133
35441
|
async function runDevKitUpdate(parsed, ctx) {
|
|
35134
|
-
const targetDir =
|
|
35442
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
35135
35443
|
const result = await installAiDevKit({
|
|
35136
35444
|
targetDir,
|
|
35137
35445
|
preserveExisting: false,
|
|
@@ -35143,7 +35451,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
35143
35451
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
35144
35452
|
}
|
|
35145
35453
|
async function runLogsWatch(parsed, ctx) {
|
|
35146
|
-
const targetDir =
|
|
35454
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
35147
35455
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
35148
35456
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
|
|
35149
35457
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -35153,9 +35461,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
35153
35461
|
serverUrl: stringOption(parsed, "server_url"),
|
|
35154
35462
|
env: makerEnvOption(parsed)
|
|
35155
35463
|
});
|
|
35156
|
-
const runtimeDir =
|
|
35157
|
-
const runtimeLog =
|
|
35158
|
-
const pidFile =
|
|
35464
|
+
const runtimeDir = path13.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
35465
|
+
const runtimeLog = path13.join(runtimeDir, "runtime.log");
|
|
35466
|
+
const pidFile = path13.join(runtimeDir, "watcher.pid");
|
|
35159
35467
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
35160
35468
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
35161
35469
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -35200,10 +35508,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
35200
35508
|
}
|
|
35201
35509
|
}
|
|
35202
35510
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
35203
|
-
|
|
35511
|
+
fs12.mkdirSync(path13.dirname(pidFile), { recursive: true });
|
|
35204
35512
|
const existingPid = readPidFile(pidFile);
|
|
35205
35513
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
35206
|
-
|
|
35514
|
+
fs12.writeFileSync(
|
|
35207
35515
|
pidFile,
|
|
35208
35516
|
`${JSON.stringify(
|
|
35209
35517
|
{
|
|
@@ -35221,10 +35529,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
35221
35529
|
return previous;
|
|
35222
35530
|
}
|
|
35223
35531
|
function readPidFile(pidFile) {
|
|
35224
|
-
if (!
|
|
35532
|
+
if (!fs12.existsSync(pidFile)) {
|
|
35225
35533
|
return void 0;
|
|
35226
35534
|
}
|
|
35227
|
-
const raw =
|
|
35535
|
+
const raw = fs12.readFileSync(pidFile, "utf8").trim();
|
|
35228
35536
|
let pid = Number(raw);
|
|
35229
35537
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
35230
35538
|
try {
|
|
@@ -35244,7 +35552,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
35244
35552
|
}
|
|
35245
35553
|
cleaned = true;
|
|
35246
35554
|
if (readPidFile(pidFile) === process.pid) {
|
|
35247
|
-
|
|
35555
|
+
fs12.rmSync(pidFile, { force: true });
|
|
35248
35556
|
}
|
|
35249
35557
|
};
|
|
35250
35558
|
process.once("exit", cleanup);
|
|
@@ -35353,7 +35661,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
35353
35661
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
35354
35662
|
});
|
|
35355
35663
|
writeDevKitStagedGitignore(
|
|
35356
|
-
|
|
35664
|
+
path13.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
35357
35665
|
listPresentDevKitManagedEntries(targetDir)
|
|
35358
35666
|
);
|
|
35359
35667
|
if (options.finalizeGitignore) {
|
|
@@ -35370,7 +35678,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
35370
35678
|
);
|
|
35371
35679
|
} catch (error2) {
|
|
35372
35680
|
writeDevKitStagedGitignore(
|
|
35373
|
-
|
|
35681
|
+
path13.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
35374
35682
|
listPresentDevKitManagedEntries(targetDir)
|
|
35375
35683
|
);
|
|
35376
35684
|
if (options.finalizeGitignore) {
|
|
@@ -35458,7 +35766,7 @@ function installMcpConfig(ide, options) {
|
|
|
35458
35766
|
}
|
|
35459
35767
|
function installMcpConfigUnsafe(ide, options) {
|
|
35460
35768
|
if (ide === "codex") {
|
|
35461
|
-
const configPath =
|
|
35769
|
+
const configPath = path13.join(os4.homedir(), ".codex", "config.toml");
|
|
35462
35770
|
mergeCodexMcpConfig(configPath, options);
|
|
35463
35771
|
return {
|
|
35464
35772
|
ide,
|
|
@@ -35468,7 +35776,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
35468
35776
|
};
|
|
35469
35777
|
}
|
|
35470
35778
|
if (ide === "cursor") {
|
|
35471
|
-
const configPath =
|
|
35779
|
+
const configPath = path13.join(os4.homedir(), ".cursor", "mcp.json");
|
|
35472
35780
|
mergeJsonMcpConfig(configPath, options);
|
|
35473
35781
|
return {
|
|
35474
35782
|
ide,
|
|
@@ -35484,7 +35792,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
35484
35792
|
return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
|
|
35485
35793
|
}
|
|
35486
35794
|
}
|
|
35487
|
-
const configPath =
|
|
35795
|
+
const configPath = path13.join(os4.homedir(), ".claude.json");
|
|
35488
35796
|
mergeJsonMcpConfig(configPath, options);
|
|
35489
35797
|
return {
|
|
35490
35798
|
ide,
|
|
@@ -35501,13 +35809,13 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
35501
35809
|
const mcpServers = asObject(existing.mcpServers);
|
|
35502
35810
|
mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
|
|
35503
35811
|
existing.mcpServers = mcpServers;
|
|
35504
|
-
|
|
35505
|
-
|
|
35812
|
+
fs12.mkdirSync(path13.dirname(configPath), { recursive: true });
|
|
35813
|
+
fs12.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
|
|
35506
35814
|
`, "utf8");
|
|
35507
35815
|
}
|
|
35508
35816
|
function mergeCodexMcpConfig(configPath, options) {
|
|
35509
35817
|
const backupPath = backupIfExists(configPath);
|
|
35510
|
-
const existing =
|
|
35818
|
+
const existing = fs12.existsSync(configPath) ? fs12.readFileSync(configPath, "utf8") : "";
|
|
35511
35819
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
35512
35820
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
35513
35821
|
const launch = getNpxCliCommand(options.pkg);
|
|
@@ -35521,9 +35829,9 @@ function mergeCodexMcpConfig(configPath, options) {
|
|
|
35521
35829
|
`TAPTAP_MCP_ENV = "${options.env}"`,
|
|
35522
35830
|
""
|
|
35523
35831
|
].join("\n");
|
|
35524
|
-
|
|
35525
|
-
|
|
35526
|
-
const updated =
|
|
35832
|
+
fs12.mkdirSync(path13.dirname(configPath), { recursive: true });
|
|
35833
|
+
fs12.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
|
|
35834
|
+
const updated = fs12.readFileSync(configPath, "utf8");
|
|
35527
35835
|
const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
|
|
35528
35836
|
if (duplicates.length > 0) {
|
|
35529
35837
|
restoreBackup(configPath, backupPath);
|
|
@@ -35590,7 +35898,7 @@ function tryClaudeMcpAdd(options) {
|
|
|
35590
35898
|
...npxLaunch.commandAndArgs
|
|
35591
35899
|
];
|
|
35592
35900
|
const claude = getWindowsCmdLaunchCommand("claude.cmd", claudeArgs);
|
|
35593
|
-
const result =
|
|
35901
|
+
const result = spawnSync8(
|
|
35594
35902
|
process.platform === "win32" ? claude.command : "claude",
|
|
35595
35903
|
process.platform === "win32" ? claude.args : claudeArgs,
|
|
35596
35904
|
{ encoding: "utf8" }
|
|
@@ -35640,10 +35948,10 @@ function rejectPackageOption(parsed) {
|
|
|
35640
35948
|
}
|
|
35641
35949
|
}
|
|
35642
35950
|
function readJsonObject(filePath) {
|
|
35643
|
-
if (!
|
|
35951
|
+
if (!fs12.existsSync(filePath)) {
|
|
35644
35952
|
return {};
|
|
35645
35953
|
}
|
|
35646
|
-
return JSON.parse(
|
|
35954
|
+
return JSON.parse(fs12.readFileSync(filePath, "utf8"));
|
|
35647
35955
|
}
|
|
35648
35956
|
function asObject(value) {
|
|
35649
35957
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -35652,26 +35960,26 @@ function asObject(value) {
|
|
|
35652
35960
|
return {};
|
|
35653
35961
|
}
|
|
35654
35962
|
function backupIfExists(filePath) {
|
|
35655
|
-
if (!
|
|
35963
|
+
if (!fs12.existsSync(filePath)) {
|
|
35656
35964
|
return void 0;
|
|
35657
35965
|
}
|
|
35658
35966
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
|
|
35659
35967
|
const backupPath = `${filePath}.bak.${stamp}`;
|
|
35660
|
-
|
|
35968
|
+
fs12.copyFileSync(filePath, backupPath);
|
|
35661
35969
|
return backupPath;
|
|
35662
35970
|
}
|
|
35663
35971
|
function restoreBackup(filePath, backupPath) {
|
|
35664
35972
|
if (backupPath) {
|
|
35665
|
-
|
|
35973
|
+
fs12.copyFileSync(backupPath, filePath);
|
|
35666
35974
|
return;
|
|
35667
35975
|
}
|
|
35668
|
-
|
|
35976
|
+
fs12.rmSync(filePath, { force: true });
|
|
35669
35977
|
}
|
|
35670
35978
|
function saveInitState(targetDir, state) {
|
|
35671
|
-
|
|
35672
|
-
const key = crypto2.createHash("sha256").update(
|
|
35673
|
-
|
|
35674
|
-
|
|
35979
|
+
fs12.mkdirSync(getMakerHome(), { recursive: true });
|
|
35980
|
+
const key = crypto2.createHash("sha256").update(path13.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
35981
|
+
fs12.writeFileSync(
|
|
35982
|
+
path13.join(getMakerHome(), `init-state-${key}.json`),
|
|
35675
35983
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
35676
35984
|
`,
|
|
35677
35985
|
"utf8"
|
|
@@ -35772,7 +36080,7 @@ function formatUnknownCommand(command) {
|
|
|
35772
36080
|
return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
|
|
35773
36081
|
}
|
|
35774
36082
|
function isKnownSubcommand(command, subcommand) {
|
|
35775
|
-
return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch" || command === "python" && (subcommand === "doctor" || subcommand === "setup" || subcommand === "path");
|
|
36083
|
+
return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch" || command === "python" && (subcommand === "doctor" || subcommand === "setup" || subcommand === "path") || command === "lua-lsp" && (subcommand === "doctor" || subcommand === "setup");
|
|
35776
36084
|
}
|
|
35777
36085
|
function stringOption(parsed, key) {
|
|
35778
36086
|
const value = parsed.options[key];
|
|
@@ -35807,7 +36115,7 @@ function makerEnvOption(parsed) {
|
|
|
35807
36115
|
return env;
|
|
35808
36116
|
}
|
|
35809
36117
|
const targetDir = stringOption(parsed, "target_dir");
|
|
35810
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
36118
|
+
return getMakerEnvironment(void 0, targetDir ? path13.resolve(targetDir) : process.cwd());
|
|
35811
36119
|
}
|
|
35812
36120
|
function mcpVerifyModeOption(parsed) {
|
|
35813
36121
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -35852,6 +36160,8 @@ function printHelp() {
|
|
|
35852
36160
|
" taptap-maker python doctor [--json]",
|
|
35853
36161
|
" taptap-maker python setup [--json]",
|
|
35854
36162
|
" taptap-maker python path [--json]",
|
|
36163
|
+
" taptap-maker lua-lsp doctor [--json]",
|
|
36164
|
+
" taptap-maker lua-lsp setup [--json]",
|
|
35855
36165
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
35856
36166
|
" # --pat warns: PAT appears in ps/history",
|
|
35857
36167
|
" taptap-maker login [--env rnd|production] [--json]",
|
|
@@ -35883,14 +36193,14 @@ function formatCliError(error2) {
|
|
|
35883
36193
|
}
|
|
35884
36194
|
|
|
35885
36195
|
// src/maker/crashLog.ts
|
|
35886
|
-
import
|
|
35887
|
-
import
|
|
36196
|
+
import fs13 from "node:fs";
|
|
36197
|
+
import path14 from "node:path";
|
|
35888
36198
|
var DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
35889
36199
|
var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
|
|
35890
36200
|
function appendMakerCrashLog(source, error2, options = {}) {
|
|
35891
36201
|
const makerHome = getMakerHome();
|
|
35892
|
-
|
|
35893
|
-
const logPath =
|
|
36202
|
+
fs13.mkdirSync(makerHome, { recursive: true });
|
|
36203
|
+
const logPath = path14.join(makerHome, "mcp-crash.log");
|
|
35894
36204
|
const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
|
|
35895
36205
|
const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
|
|
35896
36206
|
const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
|
|
@@ -35900,31 +36210,31 @@ function appendMakerCrashLog(source, error2, options = {}) {
|
|
|
35900
36210
|
);
|
|
35901
36211
|
const entryBytes = Buffer.byteLength(entry, "utf8");
|
|
35902
36212
|
rotateIfNeeded(logPath, maxBytes, entryBytes);
|
|
35903
|
-
|
|
36213
|
+
fs13.appendFileSync(logPath, entry, "utf8");
|
|
35904
36214
|
}
|
|
35905
36215
|
function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
|
|
35906
|
-
if (!
|
|
36216
|
+
if (!fs13.existsSync(logPath)) {
|
|
35907
36217
|
return;
|
|
35908
36218
|
}
|
|
35909
|
-
const currentBytes =
|
|
36219
|
+
const currentBytes = fs13.statSync(logPath).size;
|
|
35910
36220
|
if (currentBytes + incomingBytes <= maxBytes) {
|
|
35911
36221
|
return;
|
|
35912
36222
|
}
|
|
35913
36223
|
const rotatedPath = `${logPath}.1`;
|
|
35914
36224
|
writeFileTail(logPath, rotatedPath, maxBytes);
|
|
35915
|
-
|
|
36225
|
+
fs13.writeFileSync(logPath, "", "utf8");
|
|
35916
36226
|
}
|
|
35917
36227
|
function writeFileTail(sourcePath, targetPath, maxBytes) {
|
|
35918
|
-
const size =
|
|
36228
|
+
const size = fs13.statSync(sourcePath).size;
|
|
35919
36229
|
const bytesToRead = Math.min(size, maxBytes);
|
|
35920
36230
|
const start = Math.max(0, size - bytesToRead);
|
|
35921
|
-
const fd =
|
|
36231
|
+
const fd = fs13.openSync(sourcePath, "r");
|
|
35922
36232
|
try {
|
|
35923
36233
|
const buffer = Buffer.alloc(bytesToRead);
|
|
35924
|
-
|
|
35925
|
-
|
|
36234
|
+
fs13.readSync(fd, buffer, 0, bytesToRead, start);
|
|
36235
|
+
fs13.writeFileSync(targetPath, buffer);
|
|
35926
36236
|
} finally {
|
|
35927
|
-
|
|
36237
|
+
fs13.closeSync(fd);
|
|
35928
36238
|
}
|
|
35929
36239
|
}
|
|
35930
36240
|
function truncateUtf8(value, maxBytes) {
|
|
@@ -37493,7 +37803,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
37493
37803
|
};
|
|
37494
37804
|
|
|
37495
37805
|
// src/mcp-proxy/proxy.ts
|
|
37496
|
-
import * as
|
|
37806
|
+
import * as path16 from "node:path";
|
|
37497
37807
|
import * as crypto5 from "node:crypto";
|
|
37498
37808
|
|
|
37499
37809
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -37675,8 +37985,8 @@ function createCookieFetch(cookieJar) {
|
|
|
37675
37985
|
}
|
|
37676
37986
|
|
|
37677
37987
|
// src/core/utils/logWriter.ts
|
|
37678
|
-
import * as
|
|
37679
|
-
import * as
|
|
37988
|
+
import * as fs14 from "node:fs";
|
|
37989
|
+
import * as path15 from "node:path";
|
|
37680
37990
|
import * as crypto4 from "node:crypto";
|
|
37681
37991
|
|
|
37682
37992
|
// src/core/types/log.ts
|
|
@@ -37717,7 +38027,7 @@ var LogWriter = class {
|
|
|
37717
38027
|
return;
|
|
37718
38028
|
}
|
|
37719
38029
|
try {
|
|
37720
|
-
await
|
|
38030
|
+
await fs14.promises.mkdir(this.config.logDir, { recursive: true });
|
|
37721
38031
|
await this.cleanupOldLogs();
|
|
37722
38032
|
this.initialized = true;
|
|
37723
38033
|
} catch (error2) {
|
|
@@ -37740,7 +38050,7 @@ var LogWriter = class {
|
|
|
37740
38050
|
*/
|
|
37741
38051
|
getLogFilePath(date5) {
|
|
37742
38052
|
const d = date5 || this.getCurrentDate();
|
|
37743
|
-
return
|
|
38053
|
+
return path15.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
37744
38054
|
}
|
|
37745
38055
|
/**
|
|
37746
38056
|
* 获取或创建写入流
|
|
@@ -37755,7 +38065,7 @@ var LogWriter = class {
|
|
|
37755
38065
|
}
|
|
37756
38066
|
this.currentDate = date5;
|
|
37757
38067
|
try {
|
|
37758
|
-
this.writeStream =
|
|
38068
|
+
this.writeStream = fs14.createWriteStream(this.getLogFilePath(date5), {
|
|
37759
38069
|
flags: "a",
|
|
37760
38070
|
encoding: "utf8"
|
|
37761
38071
|
});
|
|
@@ -37807,11 +38117,11 @@ var LogWriter = class {
|
|
|
37807
38117
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
37808
38118
|
try {
|
|
37809
38119
|
const filePath = this.getLogFilePath();
|
|
37810
|
-
const dir =
|
|
37811
|
-
if (!
|
|
37812
|
-
|
|
38120
|
+
const dir = path15.dirname(filePath);
|
|
38121
|
+
if (!fs14.existsSync(dir)) {
|
|
38122
|
+
fs14.mkdirSync(dir, { recursive: true });
|
|
37813
38123
|
}
|
|
37814
|
-
|
|
38124
|
+
fs14.appendFileSync(filePath, message, "utf8");
|
|
37815
38125
|
} catch {
|
|
37816
38126
|
}
|
|
37817
38127
|
}
|
|
@@ -37822,7 +38132,7 @@ var LogWriter = class {
|
|
|
37822
38132
|
async cleanupOldLogs() {
|
|
37823
38133
|
if (this.config.maxDays <= 0) return;
|
|
37824
38134
|
try {
|
|
37825
|
-
const files = await
|
|
38135
|
+
const files = await fs14.promises.readdir(this.config.logDir);
|
|
37826
38136
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
37827
38137
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
37828
38138
|
const prefix = this.config.prefix;
|
|
@@ -37837,7 +38147,7 @@ var LogWriter = class {
|
|
|
37837
38147
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
37838
38148
|
const fileDate = new Date(year, month - 1, day);
|
|
37839
38149
|
if (fileDate < cutoffDate) {
|
|
37840
|
-
await
|
|
38150
|
+
await fs14.promises.unlink(path15.join(this.config.logDir, file2));
|
|
37841
38151
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
37842
38152
|
`);
|
|
37843
38153
|
}
|
|
@@ -37908,10 +38218,10 @@ var TapTapMCPProxy = class {
|
|
|
37908
38218
|
const { user_id, project_id } = this.config.tenant;
|
|
37909
38219
|
let logDir;
|
|
37910
38220
|
if (user_id && project_id) {
|
|
37911
|
-
logDir =
|
|
38221
|
+
logDir = path16.join(logRoot, "proxy", user_id, project_id);
|
|
37912
38222
|
} else {
|
|
37913
38223
|
const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
37914
|
-
logDir =
|
|
38224
|
+
logDir = path16.join(logRoot, "proxy", kidHash);
|
|
37915
38225
|
}
|
|
37916
38226
|
return new LogWriter({
|
|
37917
38227
|
logDir,
|
|
@@ -38547,6 +38857,8 @@ function printHelp2() {
|
|
|
38547
38857
|
" taptap-maker python doctor [--json]",
|
|
38548
38858
|
" taptap-maker python setup [--json]",
|
|
38549
38859
|
" taptap-maker python path [--json]",
|
|
38860
|
+
" taptap-maker lua-lsp doctor [--json]",
|
|
38861
|
+
" taptap-maker lua-lsp setup [--json]",
|
|
38550
38862
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
38551
38863
|
" # --pat warns: PAT appears in ps/history",
|
|
38552
38864
|
" taptap-maker login [--env rnd|production] [--json]",
|