@taptap/maker 0.0.15 → 0.0.17-beta.1
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 +620 -213
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +9 -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,348 @@ 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 LUA_LSP_PROBE_TIMEOUT_MS = 5e3;
|
|
31624
|
+
var PYTHON_SCRIPTS_DIR_SCRIPT = [
|
|
31625
|
+
"import sysconfig",
|
|
31626
|
+
'print(sysconfig.get_path("scripts") or "")'
|
|
31627
|
+
].join("; ");
|
|
31628
|
+
function getMakerLuaLspConfigPath() {
|
|
31629
|
+
return path8.join(getMakerHome(), "lua-lsp.json");
|
|
31630
|
+
}
|
|
31631
|
+
function getMakerLuaLspVenvDir() {
|
|
31632
|
+
return path8.join(getMakerHome(), "lua-lsp-venv");
|
|
31633
|
+
}
|
|
31634
|
+
function checkMakerLuaLspEnvironment(options = {}) {
|
|
31635
|
+
const runner = options.spawn || spawnSync5;
|
|
31636
|
+
const python = options.pythonEnvironment || checkMakerPythonEnvironment(options);
|
|
31637
|
+
const platform = options.platform || python.platform || process.platform;
|
|
31638
|
+
const base = createLuaLspBase(platform);
|
|
31639
|
+
if (!python.ready || !python.python) {
|
|
31640
|
+
return {
|
|
31641
|
+
...base,
|
|
31642
|
+
ready: false,
|
|
31643
|
+
status: "python_missing",
|
|
31644
|
+
missing: ["python"],
|
|
31645
|
+
error: python.error,
|
|
31646
|
+
nextAction: "本地 Lua 诊断需要 Python 环境。请先运行 `taptap-maker python setup`,它会继续准备 maker-lua-lsp。"
|
|
31647
|
+
};
|
|
31648
|
+
}
|
|
31649
|
+
const saved = loadLuaLspRuntimeConfig();
|
|
31650
|
+
if (saved == null ? void 0 : saved.command) {
|
|
31651
|
+
const version3 = readLuaLspVersion(saved.command, runner);
|
|
31652
|
+
if (version3) {
|
|
31653
|
+
return {
|
|
31654
|
+
...base,
|
|
31655
|
+
ready: true,
|
|
31656
|
+
status: "ready",
|
|
31657
|
+
command: saved.command,
|
|
31658
|
+
version: version3,
|
|
31659
|
+
python: saved.python || python.python,
|
|
31660
|
+
scriptsDir: path8.dirname(saved.command),
|
|
31661
|
+
missing: [],
|
|
31662
|
+
nextAction: "maker-lua-lsp 已安装;本地 Lua 诊断可用。"
|
|
31663
|
+
};
|
|
31664
|
+
}
|
|
31665
|
+
}
|
|
31666
|
+
const resolved = resolveLuaLspCommand(python, platform, runner);
|
|
31667
|
+
const command = resolved.command || LUA_LSP_PACKAGE;
|
|
31668
|
+
const version2 = readLuaLspVersion(command, runner);
|
|
31669
|
+
if (version2) {
|
|
31670
|
+
return {
|
|
31671
|
+
...base,
|
|
31672
|
+
ready: true,
|
|
31673
|
+
status: "ready",
|
|
31674
|
+
command,
|
|
31675
|
+
version: version2,
|
|
31676
|
+
python: python.python,
|
|
31677
|
+
scriptsDir: resolved.scriptsDir,
|
|
31678
|
+
missing: [],
|
|
31679
|
+
nextAction: "maker-lua-lsp 已安装;本地 Lua 诊断可用。"
|
|
31680
|
+
};
|
|
31681
|
+
}
|
|
31682
|
+
if ((saved == null ? void 0 : saved.status) === "setup_failed") {
|
|
31683
|
+
return {
|
|
31684
|
+
...base,
|
|
31685
|
+
ready: false,
|
|
31686
|
+
status: "setup_failed",
|
|
31687
|
+
command: saved.command || resolved.command,
|
|
31688
|
+
python: python.python,
|
|
31689
|
+
scriptsDir: resolved.scriptsDir,
|
|
31690
|
+
missing: [LUA_LSP_PACKAGE],
|
|
31691
|
+
error: saved.error,
|
|
31692
|
+
nextAction: "上次 maker-lua-lsp 安装失败。请查看错误后重试 `taptap-maker lua-lsp setup`;失败不会阻塞远端构建。"
|
|
31693
|
+
};
|
|
31694
|
+
}
|
|
31695
|
+
return {
|
|
31696
|
+
...base,
|
|
31697
|
+
ready: false,
|
|
31698
|
+
status: "missing",
|
|
31699
|
+
command: resolved.command,
|
|
31700
|
+
python: python.python,
|
|
31701
|
+
scriptsDir: resolved.scriptsDir,
|
|
31702
|
+
missing: [LUA_LSP_PACKAGE],
|
|
31703
|
+
nextAction: "未检测到 maker-lua-lsp。请运行 `taptap-maker lua-lsp setup`,或运行 `taptap-maker python setup` 自动准备完整本地 Lua 诊断环境。"
|
|
31704
|
+
};
|
|
31705
|
+
}
|
|
31706
|
+
function setupMakerLuaLspEnvironment(options = {}) {
|
|
31707
|
+
const runner = options.spawn || spawnSync5;
|
|
31708
|
+
const python = options.pythonEnvironment || ensurePythonForLuaLsp(options);
|
|
31709
|
+
const platform = options.platform || python.platform || process.platform;
|
|
31710
|
+
if (!python.ready || !python.python) {
|
|
31711
|
+
const environment2 = {
|
|
31712
|
+
...createLuaLspBase(platform),
|
|
31713
|
+
ready: false,
|
|
31714
|
+
status: "python_missing",
|
|
31715
|
+
python: python.python,
|
|
31716
|
+
missing: ["python"],
|
|
31717
|
+
error: python.error,
|
|
31718
|
+
nextAction: "maker-lua-lsp 安装需要 Python >= 3.8 和 pip。请先运行 `taptap-maker python setup`。"
|
|
31719
|
+
};
|
|
31720
|
+
saveLuaLspRuntimeConfig(environment2);
|
|
31721
|
+
return { changed: false, environment: environment2, python };
|
|
31722
|
+
}
|
|
31723
|
+
const venv = ensureLuaLspVenv(python, platform, runner);
|
|
31724
|
+
if (venv.result && venv.result.status !== 0) {
|
|
31725
|
+
const environment2 = formatLuaLspSetupFailure(
|
|
31726
|
+
platform,
|
|
31727
|
+
python,
|
|
31728
|
+
"maker-lua-lsp venv creation failed",
|
|
31729
|
+
venv.result,
|
|
31730
|
+
venv.command,
|
|
31731
|
+
venv.scriptsDir
|
|
31732
|
+
);
|
|
31733
|
+
saveLuaLspRuntimeConfig(environment2);
|
|
31734
|
+
return { changed: false, environment: environment2, python };
|
|
31735
|
+
}
|
|
31736
|
+
const pipInstall = runner(venv.python, ["-m", "pip", "install", "--upgrade", LUA_LSP_PACKAGE], {
|
|
31737
|
+
encoding: "utf8",
|
|
31738
|
+
timeout: LUA_LSP_SETUP_TIMEOUT_MS
|
|
31739
|
+
});
|
|
31740
|
+
if (pipInstall.status !== 0) {
|
|
31741
|
+
const environment2 = formatLuaLspSetupFailure(
|
|
31742
|
+
platform,
|
|
31743
|
+
python,
|
|
31744
|
+
"maker-lua-lsp pip install failed",
|
|
31745
|
+
pipInstall,
|
|
31746
|
+
venv.command,
|
|
31747
|
+
venv.scriptsDir
|
|
31748
|
+
);
|
|
31749
|
+
saveLuaLspRuntimeConfig(environment2);
|
|
31750
|
+
return { changed: false, environment: environment2, python };
|
|
31751
|
+
}
|
|
31752
|
+
const resolved = resolveLuaLspCommand(
|
|
31753
|
+
{
|
|
31754
|
+
...python,
|
|
31755
|
+
python: venv.python
|
|
31756
|
+
},
|
|
31757
|
+
platform,
|
|
31758
|
+
runner
|
|
31759
|
+
);
|
|
31760
|
+
const command = resolved.command || venv.command;
|
|
31761
|
+
const scriptsDir = resolved.scriptsDir || venv.scriptsDir;
|
|
31762
|
+
const ideInstall = runner(command, ["install", "--ide", LUA_LSP_IDES], {
|
|
31763
|
+
encoding: "utf8",
|
|
31764
|
+
timeout: LUA_LSP_SETUP_TIMEOUT_MS
|
|
31765
|
+
});
|
|
31766
|
+
if (ideInstall.status !== 0) {
|
|
31767
|
+
const environment2 = formatLuaLspSetupFailure(
|
|
31768
|
+
platform,
|
|
31769
|
+
python,
|
|
31770
|
+
"maker-lua-lsp IDE install failed",
|
|
31771
|
+
ideInstall,
|
|
31772
|
+
command,
|
|
31773
|
+
scriptsDir
|
|
31774
|
+
);
|
|
31775
|
+
saveLuaLspRuntimeConfig(environment2);
|
|
31776
|
+
return { changed: false, environment: environment2, python };
|
|
31777
|
+
}
|
|
31778
|
+
const environment = {
|
|
31779
|
+
...createLuaLspBase(platform),
|
|
31780
|
+
ready: true,
|
|
31781
|
+
status: "ready",
|
|
31782
|
+
command,
|
|
31783
|
+
version: readLuaLspVersion(command, runner),
|
|
31784
|
+
python: python.python,
|
|
31785
|
+
scriptsDir,
|
|
31786
|
+
missing: [],
|
|
31787
|
+
nextAction: "maker-lua-lsp 已安装并完成 Codex/Cursor/Claude 配置。"
|
|
31788
|
+
};
|
|
31789
|
+
saveLuaLspRuntimeConfig(environment);
|
|
31790
|
+
return { changed: true, environment, python };
|
|
31791
|
+
}
|
|
31792
|
+
function formatMakerLuaLspEnvironmentStatus(environment) {
|
|
31793
|
+
return [
|
|
31794
|
+
"Lua LSP environment",
|
|
31795
|
+
"",
|
|
31796
|
+
`- lsp_status: ${environment.status}`,
|
|
31797
|
+
`- ready: ${environment.ready ? "yes" : "no"}`,
|
|
31798
|
+
environment.command ? `- command: ${environment.command}` : "",
|
|
31799
|
+
environment.version ? `- version: ${environment.version}` : "",
|
|
31800
|
+
environment.python ? `- python: ${environment.python}` : "",
|
|
31801
|
+
environment.scriptsDir ? `- scripts_dir: ${environment.scriptsDir}` : "",
|
|
31802
|
+
`- config: ${environment.configPath}`,
|
|
31803
|
+
`- missing: ${environment.missing.join(", ") || "(none)"}`,
|
|
31804
|
+
environment.error ? `- error: ${environment.error}` : "",
|
|
31805
|
+
`- install_command: ${environment.installCommand}`,
|
|
31806
|
+
`- setup_command: ${environment.setupCommand}`,
|
|
31807
|
+
`- doctor_command: ${environment.doctorCommand}`,
|
|
31808
|
+
`- next_action: ${environment.nextAction}`
|
|
31809
|
+
].filter(Boolean).join("\n");
|
|
31810
|
+
}
|
|
31811
|
+
function ensurePythonForLuaLsp(options) {
|
|
31812
|
+
const current = checkMakerPythonEnvironment(options);
|
|
31813
|
+
if (current.ready) {
|
|
31814
|
+
return current;
|
|
31815
|
+
}
|
|
31816
|
+
try {
|
|
31817
|
+
return setupMakerPythonEnvironment(options).environment;
|
|
31818
|
+
} catch (error2) {
|
|
31819
|
+
return {
|
|
31820
|
+
...current,
|
|
31821
|
+
status: "setup_failed",
|
|
31822
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
31823
|
+
};
|
|
31824
|
+
}
|
|
31825
|
+
}
|
|
31826
|
+
function createLuaLspBase(platform) {
|
|
31827
|
+
return {
|
|
31828
|
+
platform,
|
|
31829
|
+
configPath: getMakerLuaLspConfigPath(),
|
|
31830
|
+
setupCommand: "taptap-maker lua-lsp setup",
|
|
31831
|
+
doctorCommand: "taptap-maker lua-lsp doctor",
|
|
31832
|
+
installCommand: `${LUA_LSP_PACKAGE} install --ide ${LUA_LSP_IDES}`
|
|
31833
|
+
};
|
|
31834
|
+
}
|
|
31835
|
+
function resolveLuaLspCommand(python, platform, runner) {
|
|
31836
|
+
const venvCommand = getLuaLspVenvCommand(platform);
|
|
31837
|
+
if (fs7.existsSync(venvCommand)) {
|
|
31838
|
+
return { command: venvCommand, scriptsDir: path8.dirname(venvCommand) };
|
|
31839
|
+
}
|
|
31840
|
+
const scriptsDir = readPythonScriptsDir(python.python, runner);
|
|
31841
|
+
if (scriptsDir) {
|
|
31842
|
+
const command = path8.join(
|
|
31843
|
+
scriptsDir,
|
|
31844
|
+
platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
|
|
31845
|
+
);
|
|
31846
|
+
if (fs7.existsSync(command)) {
|
|
31847
|
+
return { command, scriptsDir };
|
|
31848
|
+
}
|
|
31849
|
+
return { scriptsDir };
|
|
31850
|
+
}
|
|
31851
|
+
return {};
|
|
31852
|
+
}
|
|
31853
|
+
function ensureLuaLspVenv(python, platform, runner) {
|
|
31854
|
+
const venvDir = getMakerLuaLspVenvDir();
|
|
31855
|
+
const venvPython = getLuaLspVenvPython(platform);
|
|
31856
|
+
const scriptsDir = getLuaLspVenvScriptsDir(platform);
|
|
31857
|
+
const command = getLuaLspVenvCommand(platform);
|
|
31858
|
+
if (!isLuaLspVenvComplete(platform)) {
|
|
31859
|
+
const result = runner(python.python || "", ["-m", "venv", venvDir], {
|
|
31860
|
+
encoding: "utf8",
|
|
31861
|
+
timeout: LUA_LSP_SETUP_TIMEOUT_MS
|
|
31862
|
+
});
|
|
31863
|
+
if (result.status !== 0) {
|
|
31864
|
+
return { python: venvPython, scriptsDir, command, result };
|
|
31865
|
+
}
|
|
31866
|
+
}
|
|
31867
|
+
return { python: venvPython, scriptsDir, command };
|
|
31868
|
+
}
|
|
31869
|
+
function isLuaLspVenvComplete(platform) {
|
|
31870
|
+
return fs7.existsSync(getLuaLspVenvPython(platform)) && fs7.existsSync(getLuaLspVenvConfigPath());
|
|
31871
|
+
}
|
|
31872
|
+
function getLuaLspVenvConfigPath() {
|
|
31873
|
+
return path8.join(getMakerLuaLspVenvDir(), "pyvenv.cfg");
|
|
31874
|
+
}
|
|
31875
|
+
function getLuaLspVenvPython(platform) {
|
|
31876
|
+
return path8.join(
|
|
31877
|
+
getMakerLuaLspVenvDir(),
|
|
31878
|
+
platform === "win32" ? "Scripts" : "bin",
|
|
31879
|
+
platform === "win32" ? "python.exe" : "python"
|
|
31880
|
+
);
|
|
31881
|
+
}
|
|
31882
|
+
function getLuaLspVenvScriptsDir(platform) {
|
|
31883
|
+
return path8.join(getMakerLuaLspVenvDir(), platform === "win32" ? "Scripts" : "bin");
|
|
31884
|
+
}
|
|
31885
|
+
function getLuaLspVenvCommand(platform) {
|
|
31886
|
+
return path8.join(
|
|
31887
|
+
getLuaLspVenvScriptsDir(platform),
|
|
31888
|
+
platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
|
|
31889
|
+
);
|
|
31890
|
+
}
|
|
31891
|
+
function readPythonScriptsDir(python, runner) {
|
|
31892
|
+
if (!python) {
|
|
31893
|
+
return void 0;
|
|
31894
|
+
}
|
|
31895
|
+
const result = runner(python, ["-c", PYTHON_SCRIPTS_DIR_SCRIPT], { encoding: "utf8" });
|
|
31896
|
+
return result.status === 0 ? result.stdout.trim().split(/\r?\n/)[0] || void 0 : void 0;
|
|
31897
|
+
}
|
|
31898
|
+
function readLuaLspVersion(command, runner) {
|
|
31899
|
+
const result = runner(command, ["--version"], {
|
|
31900
|
+
encoding: "utf8",
|
|
31901
|
+
timeout: LUA_LSP_PROBE_TIMEOUT_MS
|
|
31902
|
+
});
|
|
31903
|
+
if (result.status === 0) {
|
|
31904
|
+
return result.stdout.trim() || "installed";
|
|
31905
|
+
}
|
|
31906
|
+
const help = runner(command, ["--help"], {
|
|
31907
|
+
encoding: "utf8",
|
|
31908
|
+
timeout: LUA_LSP_PROBE_TIMEOUT_MS
|
|
31909
|
+
});
|
|
31910
|
+
return help.status === 0 ? "installed" : void 0;
|
|
31911
|
+
}
|
|
31912
|
+
function formatLuaLspSetupFailure(platform, python, message, result, command, scriptsDir) {
|
|
31913
|
+
var _a3, _b, _c;
|
|
31914
|
+
return {
|
|
31915
|
+
...createLuaLspBase(platform),
|
|
31916
|
+
ready: false,
|
|
31917
|
+
status: "setup_failed",
|
|
31918
|
+
command,
|
|
31919
|
+
python: python.python,
|
|
31920
|
+
scriptsDir,
|
|
31921
|
+
missing: [LUA_LSP_PACKAGE],
|
|
31922
|
+
error: [
|
|
31923
|
+
message,
|
|
31924
|
+
`- status: ${result.status ?? "(none)"}`,
|
|
31925
|
+
((_a3 = result.error) == null ? void 0 : _a3.message) ? `- error: ${result.error.message}` : "",
|
|
31926
|
+
((_b = result.stderr) == null ? void 0 : _b.trim()) ? `- stderr: ${result.stderr.trim()}` : "",
|
|
31927
|
+
((_c = result.stdout) == null ? void 0 : _c.trim()) ? `- stdout: ${result.stdout.trim()}` : ""
|
|
31928
|
+
].filter(Boolean).join("\n"),
|
|
31929
|
+
nextAction: "maker-lua-lsp 安装失败,但不会阻塞远端构建。请检查网络、pip、权限或脚本输出后重试 `taptap-maker lua-lsp setup`。"
|
|
31930
|
+
};
|
|
31931
|
+
}
|
|
31932
|
+
function loadLuaLspRuntimeConfig() {
|
|
31933
|
+
const configPath = getMakerLuaLspConfigPath();
|
|
31934
|
+
if (!fs7.existsSync(configPath)) {
|
|
31935
|
+
return void 0;
|
|
31936
|
+
}
|
|
31937
|
+
try {
|
|
31938
|
+
return JSON.parse(fs7.readFileSync(configPath, "utf8"));
|
|
31939
|
+
} catch {
|
|
31940
|
+
return void 0;
|
|
31941
|
+
}
|
|
31942
|
+
}
|
|
31943
|
+
function saveLuaLspRuntimeConfig(environment) {
|
|
31944
|
+
const config2 = {
|
|
31945
|
+
status: environment.status,
|
|
31946
|
+
command: environment.command,
|
|
31947
|
+
python: environment.python,
|
|
31948
|
+
error: environment.error,
|
|
31949
|
+
saved_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
31950
|
+
};
|
|
31951
|
+
fs7.mkdirSync(path8.dirname(getMakerLuaLspConfigPath()), { recursive: true });
|
|
31952
|
+
fs7.writeFileSync(getMakerLuaLspConfigPath(), JSON.stringify(config2, null, 2), "utf8");
|
|
31953
|
+
}
|
|
31954
|
+
|
|
31955
|
+
// src/maker/cli/skill.ts
|
|
31956
|
+
import fs8 from "node:fs";
|
|
31957
|
+
import path9 from "node:path";
|
|
31619
31958
|
import { fileURLToPath } from "node:url";
|
|
31620
31959
|
var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
|
|
31621
31960
|
var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
|
|
@@ -31634,7 +31973,7 @@ var BUNDLED_SKILLS = [
|
|
|
31634
31973
|
function formatMakerSkillStatus(_options = {}) {
|
|
31635
31974
|
const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
|
|
31636
31975
|
name: skill.name,
|
|
31637
|
-
path:
|
|
31976
|
+
path: path9.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
|
|
31638
31977
|
}));
|
|
31639
31978
|
return [
|
|
31640
31979
|
"TapTap Maker workflow guide documents",
|
|
@@ -31667,11 +32006,11 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
31667
32006
|
}
|
|
31668
32007
|
function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
|
|
31669
32008
|
const candidates = [
|
|
31670
|
-
|
|
32009
|
+
path9.join(process.cwd(), "skills", skillName),
|
|
31671
32010
|
getBundledSkillSourceDir(skillName)
|
|
31672
32011
|
].filter(Boolean);
|
|
31673
32012
|
for (const candidate of candidates) {
|
|
31674
|
-
if (
|
|
32013
|
+
if (fs8.existsSync(path9.join(candidate, "SKILL.md"))) {
|
|
31675
32014
|
return candidate;
|
|
31676
32015
|
}
|
|
31677
32016
|
}
|
|
@@ -31684,13 +32023,13 @@ function getBundledSkillSourceDir(skillName) {
|
|
|
31684
32023
|
return null;
|
|
31685
32024
|
}
|
|
31686
32025
|
const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
|
|
31687
|
-
const packageRoot =
|
|
31688
|
-
return
|
|
32026
|
+
const packageRoot = path9.dirname(path9.dirname(bundlePath));
|
|
32027
|
+
return path9.join(packageRoot, "skills", skillName);
|
|
31689
32028
|
}
|
|
31690
32029
|
|
|
31691
32030
|
// src/maker/server/runtimeLogs.ts
|
|
31692
|
-
import
|
|
31693
|
-
import
|
|
32031
|
+
import fs9 from "node:fs";
|
|
32032
|
+
import path10 from "node:path";
|
|
31694
32033
|
var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
|
|
31695
32034
|
var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
31696
32035
|
var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
|
|
@@ -31831,19 +32170,19 @@ async function pullRuntimeLogs(options) {
|
|
|
31831
32170
|
}
|
|
31832
32171
|
function resetRuntimeLogs(projectRoot) {
|
|
31833
32172
|
const runtimeDir = getRuntimeLogDir(projectRoot);
|
|
31834
|
-
|
|
32173
|
+
fs9.mkdirSync(runtimeDir, { recursive: true });
|
|
31835
32174
|
for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
|
|
31836
|
-
|
|
32175
|
+
fs9.rmSync(path10.join(runtimeDir, file2), { force: true });
|
|
31837
32176
|
}
|
|
31838
32177
|
return runtimeDir;
|
|
31839
32178
|
}
|
|
31840
32179
|
function readRuntimeLogState(projectRoot) {
|
|
31841
32180
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31842
|
-
if (!
|
|
32181
|
+
if (!fs9.existsSync(statePath)) {
|
|
31843
32182
|
return null;
|
|
31844
32183
|
}
|
|
31845
32184
|
try {
|
|
31846
|
-
const state = JSON.parse(
|
|
32185
|
+
const state = JSON.parse(fs9.readFileSync(statePath, "utf8"));
|
|
31847
32186
|
return isRuntimeLogState(state) ? state : null;
|
|
31848
32187
|
} catch {
|
|
31849
32188
|
return null;
|
|
@@ -31871,9 +32210,9 @@ function normalizeRuntimeLogQueryResult(result) {
|
|
|
31871
32210
|
};
|
|
31872
32211
|
}
|
|
31873
32212
|
function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
31874
|
-
const rawPath =
|
|
31875
|
-
|
|
31876
|
-
|
|
32213
|
+
const rawPath = path10.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
|
|
32214
|
+
fs9.mkdirSync(path10.dirname(rawPath), { recursive: true });
|
|
32215
|
+
fs9.writeFileSync(
|
|
31877
32216
|
rawPath,
|
|
31878
32217
|
`${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
|
|
31879
32218
|
`,
|
|
@@ -31882,7 +32221,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
|
31882
32221
|
return rawPath;
|
|
31883
32222
|
}
|
|
31884
32223
|
function appendRuntimeLogs(projectRoot, logs) {
|
|
31885
|
-
|
|
32224
|
+
fs9.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
|
|
31886
32225
|
if (logs.length === 0) {
|
|
31887
32226
|
return { files: [], written: 0 };
|
|
31888
32227
|
}
|
|
@@ -31890,7 +32229,7 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31890
32229
|
let written = 0;
|
|
31891
32230
|
for (const log of logs) {
|
|
31892
32231
|
const line = JSON.stringify(compactRuntimeLogEntry(log));
|
|
31893
|
-
|
|
32232
|
+
fs9.appendFileSync(filePath, `${line}
|
|
31894
32233
|
`, "utf8");
|
|
31895
32234
|
written += 1;
|
|
31896
32235
|
}
|
|
@@ -31898,11 +32237,11 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31898
32237
|
}
|
|
31899
32238
|
function writeRuntimeLogState(projectRoot, state) {
|
|
31900
32239
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31901
|
-
|
|
32240
|
+
fs9.mkdirSync(path10.dirname(statePath), { recursive: true });
|
|
31902
32241
|
const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
|
|
31903
|
-
|
|
32242
|
+
fs9.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
31904
32243
|
`, "utf8");
|
|
31905
|
-
|
|
32244
|
+
fs9.renameSync(tempPath, statePath);
|
|
31906
32245
|
}
|
|
31907
32246
|
function writeRuntimeLogFailureState(projectRoot, options) {
|
|
31908
32247
|
const nowIso = new Date(options.nowMs()).toISOString();
|
|
@@ -31934,13 +32273,13 @@ function isNonRetryableRuntimeLogError(error2) {
|
|
|
31934
32273
|
);
|
|
31935
32274
|
}
|
|
31936
32275
|
function getRuntimeLogDir(projectRoot) {
|
|
31937
|
-
return
|
|
32276
|
+
return path10.join(projectRoot, ".maker", "logs", "runtime");
|
|
31938
32277
|
}
|
|
31939
32278
|
function getRuntimeLogStatePath(projectRoot) {
|
|
31940
|
-
return
|
|
32279
|
+
return path10.join(getRuntimeLogDir(projectRoot), "state.json");
|
|
31941
32280
|
}
|
|
31942
32281
|
function getRuntimeLogPath(projectRoot) {
|
|
31943
|
-
return
|
|
32282
|
+
return path10.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
|
|
31944
32283
|
}
|
|
31945
32284
|
function resolveNextRuntimeLogCursor(result) {
|
|
31946
32285
|
const maxLogTime = result.logs.reduce((max, log) => {
|
|
@@ -32065,8 +32404,8 @@ function compactRuntimeLogEntry(entry) {
|
|
|
32065
32404
|
}
|
|
32066
32405
|
|
|
32067
32406
|
// src/maker/server/proxyAssets.ts
|
|
32068
|
-
import
|
|
32069
|
-
import
|
|
32407
|
+
import fs10 from "node:fs";
|
|
32408
|
+
import path11 from "node:path";
|
|
32070
32409
|
var IMAGE_ASSET_DIRS = ["assets/image"];
|
|
32071
32410
|
var VIDEO_ASSET_DIRS = ["assets/video"];
|
|
32072
32411
|
var AUDIO_ASSET_DIRS = ["assets/audio"];
|
|
@@ -32310,8 +32649,8 @@ async function materializeAsset(options) {
|
|
|
32310
32649
|
};
|
|
32311
32650
|
}
|
|
32312
32651
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
32313
|
-
|
|
32314
|
-
|
|
32652
|
+
fs10.mkdirSync(path11.dirname(absolutePath), { recursive: true });
|
|
32653
|
+
fs10.writeFileSync(absolutePath, bytes);
|
|
32315
32654
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
32316
32655
|
} catch (error2) {
|
|
32317
32656
|
return {
|
|
@@ -32325,12 +32664,12 @@ async function materializeAsset(options) {
|
|
|
32325
32664
|
function createUniqueAssetPath(options) {
|
|
32326
32665
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
32327
32666
|
for (let index = 1; index <= 9999; index += 1) {
|
|
32328
|
-
const relativePath =
|
|
32667
|
+
const relativePath = path11.posix.join(
|
|
32329
32668
|
options.relativeDir,
|
|
32330
32669
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
32331
32670
|
);
|
|
32332
|
-
const absolutePath =
|
|
32333
|
-
if (!
|
|
32671
|
+
const absolutePath = path11.join(options.targetDir, ...relativePath.split("/"));
|
|
32672
|
+
if (!fs10.existsSync(absolutePath)) {
|
|
32334
32673
|
return { relativePath, absolutePath };
|
|
32335
32674
|
}
|
|
32336
32675
|
}
|
|
@@ -32413,7 +32752,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
32413
32752
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
32414
32753
|
return false;
|
|
32415
32754
|
}
|
|
32416
|
-
const basename =
|
|
32755
|
+
const basename = path11.posix.basename(localPath);
|
|
32417
32756
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
32418
32757
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
32419
32758
|
});
|
|
@@ -32426,13 +32765,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
32426
32765
|
}
|
|
32427
32766
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
32428
32767
|
var _a3;
|
|
32429
|
-
const hasExtension = Boolean(
|
|
32768
|
+
const hasExtension = Boolean(path11.extname(value));
|
|
32430
32769
|
const candidates = [];
|
|
32431
32770
|
for (const assetDir of assetDirs) {
|
|
32432
|
-
const absoluteDir =
|
|
32771
|
+
const absoluteDir = path11.join(targetDir, ...assetDir.split("/"));
|
|
32433
32772
|
let entries;
|
|
32434
32773
|
try {
|
|
32435
|
-
entries =
|
|
32774
|
+
entries = fs10.readdirSync(absoluteDir);
|
|
32436
32775
|
} catch {
|
|
32437
32776
|
continue;
|
|
32438
32777
|
}
|
|
@@ -32441,11 +32780,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
32441
32780
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
32442
32781
|
continue;
|
|
32443
32782
|
}
|
|
32444
|
-
const absolutePath =
|
|
32783
|
+
const absolutePath = path11.join(absoluteDir, entry);
|
|
32445
32784
|
try {
|
|
32446
32785
|
candidates.push({
|
|
32447
|
-
localPath:
|
|
32448
|
-
mtimeMs:
|
|
32786
|
+
localPath: path11.posix.join(assetDir, entry),
|
|
32787
|
+
mtimeMs: fs10.statSync(absolutePath).mtimeMs
|
|
32449
32788
|
});
|
|
32450
32789
|
} catch {
|
|
32451
32790
|
}
|
|
@@ -32455,7 +32794,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
32455
32794
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
32456
32795
|
}
|
|
32457
32796
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
32458
|
-
if (relativePath.startsWith("../") ||
|
|
32797
|
+
if (relativePath.startsWith("../") || path11.isAbsolute(relativePath)) {
|
|
32459
32798
|
return false;
|
|
32460
32799
|
}
|
|
32461
32800
|
return assetDirs.some(
|
|
@@ -32469,31 +32808,31 @@ function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
|
32469
32808
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
32470
32809
|
registry2[localPath] = record2;
|
|
32471
32810
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
32472
|
-
|
|
32473
|
-
|
|
32811
|
+
fs10.mkdirSync(path11.dirname(registryPath), { recursive: true });
|
|
32812
|
+
fs10.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
32474
32813
|
`, "utf8");
|
|
32475
32814
|
}
|
|
32476
32815
|
function readGeneratedAssetRegistry(targetDir) {
|
|
32477
32816
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
32478
|
-
if (!
|
|
32817
|
+
if (!fs10.existsSync(registryPath)) {
|
|
32479
32818
|
return {};
|
|
32480
32819
|
}
|
|
32481
32820
|
try {
|
|
32482
|
-
const parsed = JSON.parse(
|
|
32821
|
+
const parsed = JSON.parse(fs10.readFileSync(registryPath, "utf8"));
|
|
32483
32822
|
return isRecord(parsed) ? parsed : {};
|
|
32484
32823
|
} catch {
|
|
32485
32824
|
return {};
|
|
32486
32825
|
}
|
|
32487
32826
|
}
|
|
32488
32827
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
32489
|
-
return
|
|
32828
|
+
return path11.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
32490
32829
|
}
|
|
32491
32830
|
function normalizeAssetRegistryKey(targetDir, value) {
|
|
32492
32831
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
32493
32832
|
return void 0;
|
|
32494
32833
|
}
|
|
32495
|
-
const relative =
|
|
32496
|
-
return relative.split(
|
|
32834
|
+
const relative = path11.isAbsolute(value) ? path11.relative(targetDir, value) : value;
|
|
32835
|
+
return relative.split(path11.sep).join("/");
|
|
32497
32836
|
}
|
|
32498
32837
|
function isRecord(value) {
|
|
32499
32838
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -32522,7 +32861,7 @@ function extensionFromUrl(url2) {
|
|
|
32522
32861
|
}
|
|
32523
32862
|
try {
|
|
32524
32863
|
const pathname = new URL(url2).pathname;
|
|
32525
|
-
const extension =
|
|
32864
|
+
const extension = path11.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
32526
32865
|
return extension || void 0;
|
|
32527
32866
|
} catch {
|
|
32528
32867
|
return void 0;
|
|
@@ -32530,7 +32869,7 @@ function extensionFromUrl(url2) {
|
|
|
32530
32869
|
}
|
|
32531
32870
|
|
|
32532
32871
|
// src/maker/server/mcp.ts
|
|
32533
|
-
var VERSION = true ? "0.0.
|
|
32872
|
+
var VERSION = true ? "0.0.17-beta.1" : "dev";
|
|
32534
32873
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
32535
32874
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
32536
32875
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -32557,7 +32896,7 @@ var MakerCloneFailedError = class extends Error {
|
|
|
32557
32896
|
var tools = [
|
|
32558
32897
|
{
|
|
32559
32898
|
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.",
|
|
32899
|
+
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
32900
|
inputSchema: {
|
|
32562
32901
|
type: "object",
|
|
32563
32902
|
properties: {
|
|
@@ -32574,7 +32913,7 @@ var tools = [
|
|
|
32574
32913
|
},
|
|
32575
32914
|
{
|
|
32576
32915
|
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,
|
|
32916
|
+
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
32917
|
inputSchema: {
|
|
32579
32918
|
type: "object",
|
|
32580
32919
|
properties: {
|
|
@@ -32888,7 +33227,7 @@ async function formatStatus(options = {}) {
|
|
|
32888
33227
|
const env = getMakerEnvironment(void 0, targetDir);
|
|
32889
33228
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
32890
33229
|
const mcpCwd = process.cwd();
|
|
32891
|
-
const mcpCwdIdentify =
|
|
33230
|
+
const mcpCwdIdentify = path12.resolve(mcpCwd) === path12.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
|
|
32892
33231
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
32893
33232
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
32894
33233
|
const pat = loadPat();
|
|
@@ -32913,6 +33252,7 @@ async function formatStatus(options = {}) {
|
|
|
32913
33252
|
}
|
|
32914
33253
|
const git = checkGitEnvironment();
|
|
32915
33254
|
const python = checkMakerPythonEnvironment();
|
|
33255
|
+
const luaLsp = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
|
|
32916
33256
|
const projectSection = identify.projectId ? [
|
|
32917
33257
|
"目标目录已绑定 Maker 项目。",
|
|
32918
33258
|
"请继续在当前绑定项目上执行状态、提交、构建等操作;用户明确要求切换或重新拉取项目时,再进入项目选择流程。",
|
|
@@ -32937,6 +33277,8 @@ async function formatStatus(options = {}) {
|
|
|
32937
33277
|
"",
|
|
32938
33278
|
formatMakerPythonEnvironmentStatus(python),
|
|
32939
33279
|
"",
|
|
33280
|
+
formatMakerLuaLspEnvironmentStatus(luaLsp),
|
|
33281
|
+
"",
|
|
32940
33282
|
formatMakerGitDirectoryStatus(gitDirectoryStatus),
|
|
32941
33283
|
"",
|
|
32942
33284
|
formatMakerToolRegistrationCwdStatus({
|
|
@@ -33005,10 +33347,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
|
|
|
33005
33347
|
if (!options.projectRoot) {
|
|
33006
33348
|
return "";
|
|
33007
33349
|
}
|
|
33008
|
-
const mcpCwd =
|
|
33009
|
-
const targetDir =
|
|
33010
|
-
const projectRoot =
|
|
33011
|
-
const mcpProjectRoot = options.mcpProjectRoot ?
|
|
33350
|
+
const mcpCwd = path12.resolve(options.mcpCwd);
|
|
33351
|
+
const targetDir = path12.resolve(options.targetDir);
|
|
33352
|
+
const projectRoot = path12.resolve(options.projectRoot);
|
|
33353
|
+
const mcpProjectRoot = options.mcpProjectRoot ? path12.resolve(options.mcpProjectRoot) : void 0;
|
|
33012
33354
|
if (mcpProjectRoot === projectRoot) {
|
|
33013
33355
|
return "";
|
|
33014
33356
|
}
|
|
@@ -33170,7 +33512,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
|
|
|
33170
33512
|
}
|
|
33171
33513
|
function resolveMakerToolTargetDir(targetDir) {
|
|
33172
33514
|
if (targetDir) {
|
|
33173
|
-
return
|
|
33515
|
+
return path12.resolve(targetDir);
|
|
33174
33516
|
}
|
|
33175
33517
|
return process.cwd();
|
|
33176
33518
|
}
|
|
@@ -33270,14 +33612,14 @@ function formatStatusProjectList(projects) {
|
|
|
33270
33612
|
].filter((line) => line !== void 0).join("\n");
|
|
33271
33613
|
}
|
|
33272
33614
|
function formatClonePartialStateLines(targetDir) {
|
|
33273
|
-
const resolvedTargetDir =
|
|
33615
|
+
const resolvedTargetDir = path12.resolve(targetDir);
|
|
33274
33616
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
33275
33617
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
33276
33618
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
33277
|
-
const stagedDevKitGitignorePath =
|
|
33619
|
+
const stagedDevKitGitignorePath = path12.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
33278
33620
|
const projectBound = Boolean(identify.projectId);
|
|
33279
33621
|
const gitInitialized = Boolean(
|
|
33280
|
-
gitStatus.isOwnGitRoot ||
|
|
33622
|
+
gitStatus.isOwnGitRoot || fs11.existsSync(path12.join(resolvedTargetDir, ".git"))
|
|
33281
33623
|
);
|
|
33282
33624
|
const safeToRetry = !projectBound;
|
|
33283
33625
|
return [
|
|
@@ -33291,7 +33633,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
33291
33633
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
33292
33634
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
33293
33635
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
33294
|
-
`- staged_dev_kit_gitignore: ${
|
|
33636
|
+
`- staged_dev_kit_gitignore: ${fs11.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
33295
33637
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
33296
33638
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
33297
33639
|
].filter(Boolean);
|
|
@@ -33364,7 +33706,7 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
33364
33706
|
}
|
|
33365
33707
|
return {
|
|
33366
33708
|
command: process.execPath,
|
|
33367
|
-
args: [
|
|
33709
|
+
args: [path12.resolve(makerEntry), "__maker-proxy"]
|
|
33368
33710
|
};
|
|
33369
33711
|
}
|
|
33370
33712
|
function createToolProgressReporter(progressToken, extra, operationName) {
|
|
@@ -33466,7 +33808,7 @@ function openMakerPageInBrowser(url2) {
|
|
|
33466
33808
|
var _a3;
|
|
33467
33809
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
33468
33810
|
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
33469
|
-
const result =
|
|
33811
|
+
const result = spawnSync6(command, args, {
|
|
33470
33812
|
stdio: "ignore",
|
|
33471
33813
|
windowsHide: true,
|
|
33472
33814
|
timeout: 5e3
|
|
@@ -33703,18 +34045,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
33703
34045
|
}
|
|
33704
34046
|
}
|
|
33705
34047
|
async function startRuntimeLogWatch(buildResult) {
|
|
33706
|
-
const runtimeDir =
|
|
33707
|
-
|
|
33708
|
-
const stdoutLog =
|
|
33709
|
-
const stderrLog =
|
|
33710
|
-
const pidFile =
|
|
34048
|
+
const runtimeDir = path12.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
34049
|
+
fs11.mkdirSync(runtimeDir, { recursive: true });
|
|
34050
|
+
const stdoutLog = path12.join(runtimeDir, "watcher.out.log");
|
|
34051
|
+
const stderrLog = path12.join(runtimeDir, "watcher.err.log");
|
|
34052
|
+
const pidFile = path12.join(runtimeDir, "watcher.pid");
|
|
33711
34053
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
33712
|
-
const outFd =
|
|
33713
|
-
const errFd =
|
|
34054
|
+
const outFd = fs11.openSync(stdoutLog, "a");
|
|
34055
|
+
const errFd = fs11.openSync(stderrLog, "a");
|
|
33714
34056
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
33715
34057
|
if (previous.previousStopError) {
|
|
33716
|
-
|
|
33717
|
-
|
|
34058
|
+
fs11.closeSync(outFd);
|
|
34059
|
+
fs11.closeSync(errFd);
|
|
33718
34060
|
return {
|
|
33719
34061
|
started: false,
|
|
33720
34062
|
command: command.text,
|
|
@@ -33777,18 +34119,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
33777
34119
|
...previous
|
|
33778
34120
|
};
|
|
33779
34121
|
} finally {
|
|
33780
|
-
|
|
33781
|
-
|
|
34122
|
+
fs11.closeSync(outFd);
|
|
34123
|
+
fs11.closeSync(errFd);
|
|
33782
34124
|
}
|
|
33783
34125
|
}
|
|
33784
34126
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
33785
|
-
if (!
|
|
34127
|
+
if (!fs11.existsSync(pidFile)) {
|
|
33786
34128
|
return {};
|
|
33787
34129
|
}
|
|
33788
34130
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
33789
34131
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
33790
34132
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
33791
|
-
|
|
34133
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33792
34134
|
return {};
|
|
33793
34135
|
}
|
|
33794
34136
|
try {
|
|
@@ -33796,7 +34138,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33796
34138
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
33797
34139
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
33798
34140
|
if (!verifiedCommand) {
|
|
33799
|
-
|
|
34141
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33800
34142
|
return {
|
|
33801
34143
|
previousPid: pid,
|
|
33802
34144
|
previousStopped: false,
|
|
@@ -33806,7 +34148,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33806
34148
|
process.kill(pid, "SIGTERM");
|
|
33807
34149
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
33808
34150
|
if (stopped) {
|
|
33809
|
-
|
|
34151
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33810
34152
|
return { previousPid: pid, previousStopped: true };
|
|
33811
34153
|
}
|
|
33812
34154
|
return {
|
|
@@ -33815,7 +34157,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33815
34157
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
33816
34158
|
};
|
|
33817
34159
|
} catch (error2) {
|
|
33818
|
-
|
|
34160
|
+
fs11.rmSync(pidFile, { force: true });
|
|
33819
34161
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
33820
34162
|
if (code === "ESRCH") {
|
|
33821
34163
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -33828,7 +34170,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33828
34170
|
}
|
|
33829
34171
|
}
|
|
33830
34172
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
33831
|
-
const raw =
|
|
34173
|
+
const raw = fs11.readFileSync(pidFile, "utf8").trim();
|
|
33832
34174
|
if (!raw) {
|
|
33833
34175
|
return null;
|
|
33834
34176
|
}
|
|
@@ -33844,7 +34186,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
33844
34186
|
}
|
|
33845
34187
|
}
|
|
33846
34188
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
33847
|
-
|
|
34189
|
+
fs11.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
33848
34190
|
`, "utf8");
|
|
33849
34191
|
}
|
|
33850
34192
|
function getProcessCommand(pid) {
|
|
@@ -33930,10 +34272,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
33930
34272
|
};
|
|
33931
34273
|
}
|
|
33932
34274
|
function resolveMakerCliEntry() {
|
|
33933
|
-
return process.argv[1] ||
|
|
34275
|
+
return process.argv[1] || path12.resolve(process.cwd(), "dist", "maker.js");
|
|
33934
34276
|
}
|
|
33935
34277
|
function getRuntimeLogFilePath(projectRoot) {
|
|
33936
|
-
return
|
|
34278
|
+
return path12.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
33937
34279
|
}
|
|
33938
34280
|
async function refreshMakerPreview(buildResult) {
|
|
33939
34281
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -34064,7 +34406,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
34064
34406
|
if (options.scriptsPath) {
|
|
34065
34407
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
34066
34408
|
}
|
|
34067
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
34409
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs11.existsSync(path12.join(projectRoot, "scripts", "main.lua"))) {
|
|
34068
34410
|
buildArgs.entry = "main.lua";
|
|
34069
34411
|
buildArgs.scriptsPath = "scripts";
|
|
34070
34412
|
}
|
|
@@ -34076,7 +34418,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
34076
34418
|
}
|
|
34077
34419
|
if (options.multiplayer) {
|
|
34078
34420
|
buildArgs.multiplayer = options.multiplayer;
|
|
34079
|
-
} else if (!
|
|
34421
|
+
} else if (!fs11.existsSync(path12.join(projectRoot, ".project", "settings.json"))) {
|
|
34080
34422
|
buildArgs.multiplayer = { enabled: false };
|
|
34081
34423
|
}
|
|
34082
34424
|
return buildArgs;
|
|
@@ -34251,11 +34593,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
34251
34593
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
34252
34594
|
`- watch_command: ${command}`,
|
|
34253
34595
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
34254
|
-
`- local_file: ${
|
|
34596
|
+
`- local_file: ${path12.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
34255
34597
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
34256
34598
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
34257
34599
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
34258
|
-
`- state_file: ${
|
|
34600
|
+
`- state_file: ${path12.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
34259
34601
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
34260
34602
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
34261
34603
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -34370,16 +34712,16 @@ function indent(value) {
|
|
|
34370
34712
|
}
|
|
34371
34713
|
|
|
34372
34714
|
// src/maker/cli/commands.ts
|
|
34373
|
-
import { spawnSync as
|
|
34715
|
+
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
34374
34716
|
import crypto2 from "node:crypto";
|
|
34375
|
-
import
|
|
34717
|
+
import fs12 from "node:fs";
|
|
34376
34718
|
import os4 from "node:os";
|
|
34377
|
-
import
|
|
34719
|
+
import path13 from "node:path";
|
|
34378
34720
|
import readline from "node:readline/promises";
|
|
34379
34721
|
import { stdin as input, stdout as output } from "node:process";
|
|
34380
34722
|
|
|
34381
34723
|
// src/maker/auth/cliLogin.ts
|
|
34382
|
-
import { spawnSync as
|
|
34724
|
+
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
34383
34725
|
import crypto from "node:crypto";
|
|
34384
34726
|
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
34385
34727
|
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
@@ -34498,7 +34840,7 @@ async function readJsonResponse(response) {
|
|
|
34498
34840
|
function openBrowser(url2) {
|
|
34499
34841
|
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
34500
34842
|
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
34501
|
-
const result =
|
|
34843
|
+
const result = spawnSync7(command, args, {
|
|
34502
34844
|
stdio: "ignore",
|
|
34503
34845
|
windowsHide: true
|
|
34504
34846
|
});
|
|
@@ -34522,7 +34864,7 @@ function formatError2(error2) {
|
|
|
34522
34864
|
// src/maker/cli/commands.ts
|
|
34523
34865
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
34524
34866
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
34525
|
-
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python"]);
|
|
34867
|
+
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp"]);
|
|
34526
34868
|
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
34527
34869
|
"json",
|
|
34528
34870
|
"skip_confirm",
|
|
@@ -34588,6 +34930,10 @@ async function runMakerCli(argv) {
|
|
|
34588
34930
|
await runPython(parsed, ctx);
|
|
34589
34931
|
return;
|
|
34590
34932
|
}
|
|
34933
|
+
if (command === "lua-lsp") {
|
|
34934
|
+
await runLuaLsp(parsed, ctx);
|
|
34935
|
+
return;
|
|
34936
|
+
}
|
|
34591
34937
|
throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
|
|
34592
34938
|
}
|
|
34593
34939
|
function parseArgs(argv) {
|
|
@@ -34637,7 +34983,7 @@ function toOptionKey(value) {
|
|
|
34637
34983
|
}
|
|
34638
34984
|
async function runInit(parsed, ctx) {
|
|
34639
34985
|
rejectPackageOption(parsed);
|
|
34640
|
-
const targetDir =
|
|
34986
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34641
34987
|
const env = makerEnvOption(parsed);
|
|
34642
34988
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
34643
34989
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -34730,10 +35076,11 @@ async function runInit(parsed, ctx) {
|
|
|
34730
35076
|
}
|
|
34731
35077
|
async function runDoctor(parsed, ctx) {
|
|
34732
35078
|
var _a3, _b;
|
|
34733
|
-
const targetDir =
|
|
35079
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34734
35080
|
const env = makerEnvOption(parsed);
|
|
34735
35081
|
const git = checkGitEnvironment();
|
|
34736
35082
|
const python = checkMakerPythonEnvironment();
|
|
35083
|
+
const luaLsp = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
|
|
34737
35084
|
const pat = loadPat();
|
|
34738
35085
|
const tapAuth = loadTapAuth();
|
|
34739
35086
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
@@ -34750,6 +35097,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
34750
35097
|
tap_auth: Boolean(tapAuth)
|
|
34751
35098
|
},
|
|
34752
35099
|
python,
|
|
35100
|
+
lua_lsp: luaLsp,
|
|
34753
35101
|
project: identify,
|
|
34754
35102
|
dev_kit: devKit,
|
|
34755
35103
|
dev_kit_update: devKitUpdate
|
|
@@ -34766,6 +35114,8 @@ async function runDoctor(parsed, ctx) {
|
|
|
34766
35114
|
"",
|
|
34767
35115
|
formatMakerPythonEnvironmentStatus(python),
|
|
34768
35116
|
"",
|
|
35117
|
+
formatMakerLuaLspEnvironmentStatus(luaLsp),
|
|
35118
|
+
"",
|
|
34769
35119
|
"Auth",
|
|
34770
35120
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
34771
35121
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
@@ -34797,6 +35147,7 @@ function ensureInitPythonReady(ctx, targetDir, env) {
|
|
|
34797
35147
|
version: initial.version,
|
|
34798
35148
|
provider: initial.provider
|
|
34799
35149
|
});
|
|
35150
|
+
ensureInitLuaLspReady(ctx, initial);
|
|
34800
35151
|
return;
|
|
34801
35152
|
}
|
|
34802
35153
|
const maxAttempts = 3;
|
|
@@ -34813,6 +35164,7 @@ function ensureInitPythonReady(ctx, targetDir, env) {
|
|
|
34813
35164
|
provider: result.environment.provider,
|
|
34814
35165
|
attempts: attempt
|
|
34815
35166
|
});
|
|
35167
|
+
ensureInitLuaLspReady(ctx, result.environment);
|
|
34816
35168
|
return;
|
|
34817
35169
|
} catch (error2) {
|
|
34818
35170
|
lastError = error2;
|
|
@@ -34863,6 +35215,22 @@ function ensureInitPythonReady(ctx, targetDir, env) {
|
|
|
34863
35215
|
}
|
|
34864
35216
|
throw new Error(message);
|
|
34865
35217
|
}
|
|
35218
|
+
function ensureInitLuaLspReady(ctx, python) {
|
|
35219
|
+
const current = checkMakerLuaLspEnvironment({ pythonEnvironment: python });
|
|
35220
|
+
const environment = current.ready ? current : setupMakerLuaLspEnvironment({ pythonEnvironment: python }).environment;
|
|
35221
|
+
emit(
|
|
35222
|
+
ctx,
|
|
35223
|
+
"lua_lsp",
|
|
35224
|
+
environment.ready ? "Maker Lua LSP is ready" : "Maker Lua LSP setup did not complete; continuing because remote build is not blocked",
|
|
35225
|
+
{
|
|
35226
|
+
status: environment.status,
|
|
35227
|
+
ready: environment.ready,
|
|
35228
|
+
command: environment.command,
|
|
35229
|
+
error: environment.error,
|
|
35230
|
+
next_action: environment.nextAction
|
|
35231
|
+
}
|
|
35232
|
+
);
|
|
35233
|
+
}
|
|
34866
35234
|
function formatInitPythonBlockedMessage(error2) {
|
|
34867
35235
|
const errorText = error2 instanceof Error ? error2.message : String(error2);
|
|
34868
35236
|
return [
|
|
@@ -34906,8 +35274,9 @@ async function runPython(parsed, ctx) {
|
|
|
34906
35274
|
"Maker Python setup may download and run the official uv installer from https://astral.sh.\n"
|
|
34907
35275
|
);
|
|
34908
35276
|
const result = setupMakerPythonEnvironment();
|
|
35277
|
+
const luaLsp = setupMakerLuaLspEnvironment({ pythonEnvironment: result.environment });
|
|
34909
35278
|
if (ctx.json) {
|
|
34910
|
-
writeJson(result);
|
|
35279
|
+
writeJson({ ...result, luaLsp });
|
|
34911
35280
|
return;
|
|
34912
35281
|
}
|
|
34913
35282
|
process.stdout.write(
|
|
@@ -34915,6 +35284,10 @@ async function runPython(parsed, ctx) {
|
|
|
34915
35284
|
result.changed ? "Maker Python runtime prepared" : "Maker Python runtime already available",
|
|
34916
35285
|
"",
|
|
34917
35286
|
formatMakerPythonEnvironmentStatus(result.environment),
|
|
35287
|
+
"",
|
|
35288
|
+
luaLsp.environment.ready ? "Maker Lua LSP prepared" : "Maker Lua LSP setup did not complete; remote build is not blocked.",
|
|
35289
|
+
"",
|
|
35290
|
+
formatMakerLuaLspEnvironmentStatus(luaLsp.environment),
|
|
34918
35291
|
""
|
|
34919
35292
|
].join("\n")
|
|
34920
35293
|
);
|
|
@@ -34948,6 +35321,36 @@ async function runPython(parsed, ctx) {
|
|
|
34948
35321
|
}
|
|
34949
35322
|
throw new Error(`Unknown taptap-maker python command: ${formatUnknownCommand(parsed.command)}`);
|
|
34950
35323
|
}
|
|
35324
|
+
async function runLuaLsp(parsed, ctx) {
|
|
35325
|
+
const [, subcommand] = parsed.command;
|
|
35326
|
+
if (!subcommand || subcommand === "doctor") {
|
|
35327
|
+
const environment = checkMakerLuaLspEnvironment();
|
|
35328
|
+
if (ctx.json) {
|
|
35329
|
+
writeJson(environment);
|
|
35330
|
+
return;
|
|
35331
|
+
}
|
|
35332
|
+
process.stdout.write(`${formatMakerLuaLspEnvironmentStatus(environment)}
|
|
35333
|
+
`);
|
|
35334
|
+
return;
|
|
35335
|
+
}
|
|
35336
|
+
if (subcommand === "setup") {
|
|
35337
|
+
const result = setupMakerLuaLspEnvironment();
|
|
35338
|
+
if (ctx.json) {
|
|
35339
|
+
writeJson(result);
|
|
35340
|
+
return;
|
|
35341
|
+
}
|
|
35342
|
+
process.stdout.write(
|
|
35343
|
+
[
|
|
35344
|
+
result.environment.ready ? "Maker Lua LSP prepared" : "Maker Lua LSP setup did not complete; remote build is not blocked.",
|
|
35345
|
+
"",
|
|
35346
|
+
formatMakerLuaLspEnvironmentStatus(result.environment),
|
|
35347
|
+
""
|
|
35348
|
+
].join("\n")
|
|
35349
|
+
);
|
|
35350
|
+
return;
|
|
35351
|
+
}
|
|
35352
|
+
throw new Error(`Unknown taptap-maker lua-lsp command: ${formatUnknownCommand(parsed.command)}`);
|
|
35353
|
+
}
|
|
34951
35354
|
async function runApps(parsed, ctx) {
|
|
34952
35355
|
rejectRemovedAppsPaginationOptions(parsed);
|
|
34953
35356
|
const pat = stringOption(parsed, "pat");
|
|
@@ -34998,7 +35401,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
34998
35401
|
}
|
|
34999
35402
|
async function resolvePatSet(parsed, ctx) {
|
|
35000
35403
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
35001
|
-
const pat =
|
|
35404
|
+
const pat = fs12.readFileSync(0, "utf8").trim();
|
|
35002
35405
|
if (!pat) {
|
|
35003
35406
|
throw new Error("No PAT found on stdin.");
|
|
35004
35407
|
}
|
|
@@ -35028,7 +35431,7 @@ async function runMcpInstall(parsed, ctx) {
|
|
|
35028
35431
|
env: makerEnvOption(parsed),
|
|
35029
35432
|
pkg: MAKER_NPM_PACKAGE,
|
|
35030
35433
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
35031
|
-
cwd: explicitTargetDir ?
|
|
35434
|
+
cwd: explicitTargetDir ? path13.resolve(explicitTargetDir) : void 0
|
|
35032
35435
|
});
|
|
35033
35436
|
if (ctx.json) {
|
|
35034
35437
|
writeJson(results);
|
|
@@ -35042,7 +35445,7 @@ async function runMcpVerify(parsed, ctx) {
|
|
|
35042
35445
|
rejectPackageOption(parsed);
|
|
35043
35446
|
const mode = mcpVerifyModeOption(parsed);
|
|
35044
35447
|
const command = mode === "npx" ? getNpxCliCommand(MAKER_NPM_PACKAGE) : getCurrentCliCommand();
|
|
35045
|
-
const result =
|
|
35448
|
+
const result = spawnSync8(command.command, [...command.args, "help"], {
|
|
35046
35449
|
encoding: "utf8"
|
|
35047
35450
|
});
|
|
35048
35451
|
const failureType = classifyMcpVerifyFailure(result);
|
|
@@ -35131,7 +35534,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
35131
35534
|
];
|
|
35132
35535
|
}
|
|
35133
35536
|
async function runDevKitUpdate(parsed, ctx) {
|
|
35134
|
-
const targetDir =
|
|
35537
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
35135
35538
|
const result = await installAiDevKit({
|
|
35136
35539
|
targetDir,
|
|
35137
35540
|
preserveExisting: false,
|
|
@@ -35143,7 +35546,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
35143
35546
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
35144
35547
|
}
|
|
35145
35548
|
async function runLogsWatch(parsed, ctx) {
|
|
35146
|
-
const targetDir =
|
|
35549
|
+
const targetDir = path13.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
35147
35550
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
35148
35551
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
|
|
35149
35552
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -35153,9 +35556,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
35153
35556
|
serverUrl: stringOption(parsed, "server_url"),
|
|
35154
35557
|
env: makerEnvOption(parsed)
|
|
35155
35558
|
});
|
|
35156
|
-
const runtimeDir =
|
|
35157
|
-
const runtimeLog =
|
|
35158
|
-
const pidFile =
|
|
35559
|
+
const runtimeDir = path13.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
35560
|
+
const runtimeLog = path13.join(runtimeDir, "runtime.log");
|
|
35561
|
+
const pidFile = path13.join(runtimeDir, "watcher.pid");
|
|
35159
35562
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
35160
35563
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
35161
35564
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -35200,10 +35603,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
35200
35603
|
}
|
|
35201
35604
|
}
|
|
35202
35605
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
35203
|
-
|
|
35606
|
+
fs12.mkdirSync(path13.dirname(pidFile), { recursive: true });
|
|
35204
35607
|
const existingPid = readPidFile(pidFile);
|
|
35205
35608
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
35206
|
-
|
|
35609
|
+
fs12.writeFileSync(
|
|
35207
35610
|
pidFile,
|
|
35208
35611
|
`${JSON.stringify(
|
|
35209
35612
|
{
|
|
@@ -35221,10 +35624,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
35221
35624
|
return previous;
|
|
35222
35625
|
}
|
|
35223
35626
|
function readPidFile(pidFile) {
|
|
35224
|
-
if (!
|
|
35627
|
+
if (!fs12.existsSync(pidFile)) {
|
|
35225
35628
|
return void 0;
|
|
35226
35629
|
}
|
|
35227
|
-
const raw =
|
|
35630
|
+
const raw = fs12.readFileSync(pidFile, "utf8").trim();
|
|
35228
35631
|
let pid = Number(raw);
|
|
35229
35632
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
35230
35633
|
try {
|
|
@@ -35244,7 +35647,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
35244
35647
|
}
|
|
35245
35648
|
cleaned = true;
|
|
35246
35649
|
if (readPidFile(pidFile) === process.pid) {
|
|
35247
|
-
|
|
35650
|
+
fs12.rmSync(pidFile, { force: true });
|
|
35248
35651
|
}
|
|
35249
35652
|
};
|
|
35250
35653
|
process.once("exit", cleanup);
|
|
@@ -35353,7 +35756,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
35353
35756
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
35354
35757
|
});
|
|
35355
35758
|
writeDevKitStagedGitignore(
|
|
35356
|
-
|
|
35759
|
+
path13.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
35357
35760
|
listPresentDevKitManagedEntries(targetDir)
|
|
35358
35761
|
);
|
|
35359
35762
|
if (options.finalizeGitignore) {
|
|
@@ -35370,7 +35773,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
35370
35773
|
);
|
|
35371
35774
|
} catch (error2) {
|
|
35372
35775
|
writeDevKitStagedGitignore(
|
|
35373
|
-
|
|
35776
|
+
path13.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
35374
35777
|
listPresentDevKitManagedEntries(targetDir)
|
|
35375
35778
|
);
|
|
35376
35779
|
if (options.finalizeGitignore) {
|
|
@@ -35458,7 +35861,7 @@ function installMcpConfig(ide, options) {
|
|
|
35458
35861
|
}
|
|
35459
35862
|
function installMcpConfigUnsafe(ide, options) {
|
|
35460
35863
|
if (ide === "codex") {
|
|
35461
|
-
const configPath =
|
|
35864
|
+
const configPath = path13.join(os4.homedir(), ".codex", "config.toml");
|
|
35462
35865
|
mergeCodexMcpConfig(configPath, options);
|
|
35463
35866
|
return {
|
|
35464
35867
|
ide,
|
|
@@ -35468,7 +35871,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
35468
35871
|
};
|
|
35469
35872
|
}
|
|
35470
35873
|
if (ide === "cursor") {
|
|
35471
|
-
const configPath =
|
|
35874
|
+
const configPath = path13.join(os4.homedir(), ".cursor", "mcp.json");
|
|
35472
35875
|
mergeJsonMcpConfig(configPath, options);
|
|
35473
35876
|
return {
|
|
35474
35877
|
ide,
|
|
@@ -35484,7 +35887,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
35484
35887
|
return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
|
|
35485
35888
|
}
|
|
35486
35889
|
}
|
|
35487
|
-
const configPath =
|
|
35890
|
+
const configPath = path13.join(os4.homedir(), ".claude.json");
|
|
35488
35891
|
mergeJsonMcpConfig(configPath, options);
|
|
35489
35892
|
return {
|
|
35490
35893
|
ide,
|
|
@@ -35501,13 +35904,13 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
35501
35904
|
const mcpServers = asObject(existing.mcpServers);
|
|
35502
35905
|
mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
|
|
35503
35906
|
existing.mcpServers = mcpServers;
|
|
35504
|
-
|
|
35505
|
-
|
|
35907
|
+
fs12.mkdirSync(path13.dirname(configPath), { recursive: true });
|
|
35908
|
+
fs12.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
|
|
35506
35909
|
`, "utf8");
|
|
35507
35910
|
}
|
|
35508
35911
|
function mergeCodexMcpConfig(configPath, options) {
|
|
35509
35912
|
const backupPath = backupIfExists(configPath);
|
|
35510
|
-
const existing =
|
|
35913
|
+
const existing = fs12.existsSync(configPath) ? fs12.readFileSync(configPath, "utf8") : "";
|
|
35511
35914
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
35512
35915
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
35513
35916
|
const launch = getNpxCliCommand(options.pkg);
|
|
@@ -35521,9 +35924,9 @@ function mergeCodexMcpConfig(configPath, options) {
|
|
|
35521
35924
|
`TAPTAP_MCP_ENV = "${options.env}"`,
|
|
35522
35925
|
""
|
|
35523
35926
|
].join("\n");
|
|
35524
|
-
|
|
35525
|
-
|
|
35526
|
-
const updated =
|
|
35927
|
+
fs12.mkdirSync(path13.dirname(configPath), { recursive: true });
|
|
35928
|
+
fs12.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
|
|
35929
|
+
const updated = fs12.readFileSync(configPath, "utf8");
|
|
35527
35930
|
const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
|
|
35528
35931
|
if (duplicates.length > 0) {
|
|
35529
35932
|
restoreBackup(configPath, backupPath);
|
|
@@ -35590,7 +35993,7 @@ function tryClaudeMcpAdd(options) {
|
|
|
35590
35993
|
...npxLaunch.commandAndArgs
|
|
35591
35994
|
];
|
|
35592
35995
|
const claude = getWindowsCmdLaunchCommand("claude.cmd", claudeArgs);
|
|
35593
|
-
const result =
|
|
35996
|
+
const result = spawnSync8(
|
|
35594
35997
|
process.platform === "win32" ? claude.command : "claude",
|
|
35595
35998
|
process.platform === "win32" ? claude.args : claudeArgs,
|
|
35596
35999
|
{ encoding: "utf8" }
|
|
@@ -35640,10 +36043,10 @@ function rejectPackageOption(parsed) {
|
|
|
35640
36043
|
}
|
|
35641
36044
|
}
|
|
35642
36045
|
function readJsonObject(filePath) {
|
|
35643
|
-
if (!
|
|
36046
|
+
if (!fs12.existsSync(filePath)) {
|
|
35644
36047
|
return {};
|
|
35645
36048
|
}
|
|
35646
|
-
return JSON.parse(
|
|
36049
|
+
return JSON.parse(fs12.readFileSync(filePath, "utf8"));
|
|
35647
36050
|
}
|
|
35648
36051
|
function asObject(value) {
|
|
35649
36052
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -35652,26 +36055,26 @@ function asObject(value) {
|
|
|
35652
36055
|
return {};
|
|
35653
36056
|
}
|
|
35654
36057
|
function backupIfExists(filePath) {
|
|
35655
|
-
if (!
|
|
36058
|
+
if (!fs12.existsSync(filePath)) {
|
|
35656
36059
|
return void 0;
|
|
35657
36060
|
}
|
|
35658
36061
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
|
|
35659
36062
|
const backupPath = `${filePath}.bak.${stamp}`;
|
|
35660
|
-
|
|
36063
|
+
fs12.copyFileSync(filePath, backupPath);
|
|
35661
36064
|
return backupPath;
|
|
35662
36065
|
}
|
|
35663
36066
|
function restoreBackup(filePath, backupPath) {
|
|
35664
36067
|
if (backupPath) {
|
|
35665
|
-
|
|
36068
|
+
fs12.copyFileSync(backupPath, filePath);
|
|
35666
36069
|
return;
|
|
35667
36070
|
}
|
|
35668
|
-
|
|
36071
|
+
fs12.rmSync(filePath, { force: true });
|
|
35669
36072
|
}
|
|
35670
36073
|
function saveInitState(targetDir, state) {
|
|
35671
|
-
|
|
35672
|
-
const key = crypto2.createHash("sha256").update(
|
|
35673
|
-
|
|
35674
|
-
|
|
36074
|
+
fs12.mkdirSync(getMakerHome(), { recursive: true });
|
|
36075
|
+
const key = crypto2.createHash("sha256").update(path13.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
36076
|
+
fs12.writeFileSync(
|
|
36077
|
+
path13.join(getMakerHome(), `init-state-${key}.json`),
|
|
35675
36078
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
35676
36079
|
`,
|
|
35677
36080
|
"utf8"
|
|
@@ -35772,7 +36175,7 @@ function formatUnknownCommand(command) {
|
|
|
35772
36175
|
return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
|
|
35773
36176
|
}
|
|
35774
36177
|
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");
|
|
36178
|
+
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
36179
|
}
|
|
35777
36180
|
function stringOption(parsed, key) {
|
|
35778
36181
|
const value = parsed.options[key];
|
|
@@ -35807,7 +36210,7 @@ function makerEnvOption(parsed) {
|
|
|
35807
36210
|
return env;
|
|
35808
36211
|
}
|
|
35809
36212
|
const targetDir = stringOption(parsed, "target_dir");
|
|
35810
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
36213
|
+
return getMakerEnvironment(void 0, targetDir ? path13.resolve(targetDir) : process.cwd());
|
|
35811
36214
|
}
|
|
35812
36215
|
function mcpVerifyModeOption(parsed) {
|
|
35813
36216
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -35852,6 +36255,8 @@ function printHelp() {
|
|
|
35852
36255
|
" taptap-maker python doctor [--json]",
|
|
35853
36256
|
" taptap-maker python setup [--json]",
|
|
35854
36257
|
" taptap-maker python path [--json]",
|
|
36258
|
+
" taptap-maker lua-lsp doctor [--json]",
|
|
36259
|
+
" taptap-maker lua-lsp setup [--json]",
|
|
35855
36260
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
35856
36261
|
" # --pat warns: PAT appears in ps/history",
|
|
35857
36262
|
" taptap-maker login [--env rnd|production] [--json]",
|
|
@@ -35883,14 +36288,14 @@ function formatCliError(error2) {
|
|
|
35883
36288
|
}
|
|
35884
36289
|
|
|
35885
36290
|
// src/maker/crashLog.ts
|
|
35886
|
-
import
|
|
35887
|
-
import
|
|
36291
|
+
import fs13 from "node:fs";
|
|
36292
|
+
import path14 from "node:path";
|
|
35888
36293
|
var DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
35889
36294
|
var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
|
|
35890
36295
|
function appendMakerCrashLog(source, error2, options = {}) {
|
|
35891
36296
|
const makerHome = getMakerHome();
|
|
35892
|
-
|
|
35893
|
-
const logPath =
|
|
36297
|
+
fs13.mkdirSync(makerHome, { recursive: true });
|
|
36298
|
+
const logPath = path14.join(makerHome, "mcp-crash.log");
|
|
35894
36299
|
const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
|
|
35895
36300
|
const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
|
|
35896
36301
|
const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
|
|
@@ -35900,31 +36305,31 @@ function appendMakerCrashLog(source, error2, options = {}) {
|
|
|
35900
36305
|
);
|
|
35901
36306
|
const entryBytes = Buffer.byteLength(entry, "utf8");
|
|
35902
36307
|
rotateIfNeeded(logPath, maxBytes, entryBytes);
|
|
35903
|
-
|
|
36308
|
+
fs13.appendFileSync(logPath, entry, "utf8");
|
|
35904
36309
|
}
|
|
35905
36310
|
function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
|
|
35906
|
-
if (!
|
|
36311
|
+
if (!fs13.existsSync(logPath)) {
|
|
35907
36312
|
return;
|
|
35908
36313
|
}
|
|
35909
|
-
const currentBytes =
|
|
36314
|
+
const currentBytes = fs13.statSync(logPath).size;
|
|
35910
36315
|
if (currentBytes + incomingBytes <= maxBytes) {
|
|
35911
36316
|
return;
|
|
35912
36317
|
}
|
|
35913
36318
|
const rotatedPath = `${logPath}.1`;
|
|
35914
36319
|
writeFileTail(logPath, rotatedPath, maxBytes);
|
|
35915
|
-
|
|
36320
|
+
fs13.writeFileSync(logPath, "", "utf8");
|
|
35916
36321
|
}
|
|
35917
36322
|
function writeFileTail(sourcePath, targetPath, maxBytes) {
|
|
35918
|
-
const size =
|
|
36323
|
+
const size = fs13.statSync(sourcePath).size;
|
|
35919
36324
|
const bytesToRead = Math.min(size, maxBytes);
|
|
35920
36325
|
const start = Math.max(0, size - bytesToRead);
|
|
35921
|
-
const fd =
|
|
36326
|
+
const fd = fs13.openSync(sourcePath, "r");
|
|
35922
36327
|
try {
|
|
35923
36328
|
const buffer = Buffer.alloc(bytesToRead);
|
|
35924
|
-
|
|
35925
|
-
|
|
36329
|
+
fs13.readSync(fd, buffer, 0, bytesToRead, start);
|
|
36330
|
+
fs13.writeFileSync(targetPath, buffer);
|
|
35926
36331
|
} finally {
|
|
35927
|
-
|
|
36332
|
+
fs13.closeSync(fd);
|
|
35928
36333
|
}
|
|
35929
36334
|
}
|
|
35930
36335
|
function truncateUtf8(value, maxBytes) {
|
|
@@ -37493,7 +37898,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
37493
37898
|
};
|
|
37494
37899
|
|
|
37495
37900
|
// src/mcp-proxy/proxy.ts
|
|
37496
|
-
import * as
|
|
37901
|
+
import * as path16 from "node:path";
|
|
37497
37902
|
import * as crypto5 from "node:crypto";
|
|
37498
37903
|
|
|
37499
37904
|
// src/mcp-proxy/cookieJar.ts
|
|
@@ -37675,8 +38080,8 @@ function createCookieFetch(cookieJar) {
|
|
|
37675
38080
|
}
|
|
37676
38081
|
|
|
37677
38082
|
// src/core/utils/logWriter.ts
|
|
37678
|
-
import * as
|
|
37679
|
-
import * as
|
|
38083
|
+
import * as fs14 from "node:fs";
|
|
38084
|
+
import * as path15 from "node:path";
|
|
37680
38085
|
import * as crypto4 from "node:crypto";
|
|
37681
38086
|
|
|
37682
38087
|
// src/core/types/log.ts
|
|
@@ -37717,7 +38122,7 @@ var LogWriter = class {
|
|
|
37717
38122
|
return;
|
|
37718
38123
|
}
|
|
37719
38124
|
try {
|
|
37720
|
-
await
|
|
38125
|
+
await fs14.promises.mkdir(this.config.logDir, { recursive: true });
|
|
37721
38126
|
await this.cleanupOldLogs();
|
|
37722
38127
|
this.initialized = true;
|
|
37723
38128
|
} catch (error2) {
|
|
@@ -37740,7 +38145,7 @@ var LogWriter = class {
|
|
|
37740
38145
|
*/
|
|
37741
38146
|
getLogFilePath(date5) {
|
|
37742
38147
|
const d = date5 || this.getCurrentDate();
|
|
37743
|
-
return
|
|
38148
|
+
return path15.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
37744
38149
|
}
|
|
37745
38150
|
/**
|
|
37746
38151
|
* 获取或创建写入流
|
|
@@ -37755,7 +38160,7 @@ var LogWriter = class {
|
|
|
37755
38160
|
}
|
|
37756
38161
|
this.currentDate = date5;
|
|
37757
38162
|
try {
|
|
37758
|
-
this.writeStream =
|
|
38163
|
+
this.writeStream = fs14.createWriteStream(this.getLogFilePath(date5), {
|
|
37759
38164
|
flags: "a",
|
|
37760
38165
|
encoding: "utf8"
|
|
37761
38166
|
});
|
|
@@ -37807,11 +38212,11 @@ var LogWriter = class {
|
|
|
37807
38212
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
37808
38213
|
try {
|
|
37809
38214
|
const filePath = this.getLogFilePath();
|
|
37810
|
-
const dir =
|
|
37811
|
-
if (!
|
|
37812
|
-
|
|
38215
|
+
const dir = path15.dirname(filePath);
|
|
38216
|
+
if (!fs14.existsSync(dir)) {
|
|
38217
|
+
fs14.mkdirSync(dir, { recursive: true });
|
|
37813
38218
|
}
|
|
37814
|
-
|
|
38219
|
+
fs14.appendFileSync(filePath, message, "utf8");
|
|
37815
38220
|
} catch {
|
|
37816
38221
|
}
|
|
37817
38222
|
}
|
|
@@ -37822,7 +38227,7 @@ var LogWriter = class {
|
|
|
37822
38227
|
async cleanupOldLogs() {
|
|
37823
38228
|
if (this.config.maxDays <= 0) return;
|
|
37824
38229
|
try {
|
|
37825
|
-
const files = await
|
|
38230
|
+
const files = await fs14.promises.readdir(this.config.logDir);
|
|
37826
38231
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
37827
38232
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
37828
38233
|
const prefix = this.config.prefix;
|
|
@@ -37837,7 +38242,7 @@ var LogWriter = class {
|
|
|
37837
38242
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
37838
38243
|
const fileDate = new Date(year, month - 1, day);
|
|
37839
38244
|
if (fileDate < cutoffDate) {
|
|
37840
|
-
await
|
|
38245
|
+
await fs14.promises.unlink(path15.join(this.config.logDir, file2));
|
|
37841
38246
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
37842
38247
|
`);
|
|
37843
38248
|
}
|
|
@@ -37908,10 +38313,10 @@ var TapTapMCPProxy = class {
|
|
|
37908
38313
|
const { user_id, project_id } = this.config.tenant;
|
|
37909
38314
|
let logDir;
|
|
37910
38315
|
if (user_id && project_id) {
|
|
37911
|
-
logDir =
|
|
38316
|
+
logDir = path16.join(logRoot, "proxy", user_id, project_id);
|
|
37912
38317
|
} else {
|
|
37913
38318
|
const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
37914
|
-
logDir =
|
|
38319
|
+
logDir = path16.join(logRoot, "proxy", kidHash);
|
|
37915
38320
|
}
|
|
37916
38321
|
return new LogWriter({
|
|
37917
38322
|
logDir,
|
|
@@ -38547,6 +38952,8 @@ function printHelp2() {
|
|
|
38547
38952
|
" taptap-maker python doctor [--json]",
|
|
38548
38953
|
" taptap-maker python setup [--json]",
|
|
38549
38954
|
" taptap-maker python path [--json]",
|
|
38955
|
+
" taptap-maker lua-lsp doctor [--json]",
|
|
38956
|
+
" taptap-maker lua-lsp setup [--json]",
|
|
38550
38957
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
38551
38958
|
" # --pat warns: PAT appears in ps/history",
|
|
38552
38959
|
" taptap-maker login [--env rnd|production] [--json]",
|