@taptap/maker 0.0.18 → 0.0.19
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 +5 -1
- package/dist/maker.js +965 -434
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +84 -21
- package/skills/update-taptap-mcp/SKILL.md +60 -173
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(path18) {
|
|
3237
|
+
let input2 = path18;
|
|
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 [path18, query] = wsComponent.resourceName.split("?");
|
|
3437
|
+
wsComponent.path = path18 && path18 !== "/" ? path18 : 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, fs16, 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, fs16[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 fs16 = __require("fs");
|
|
12513
|
+
function checkPathExt(path18, 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 && path18.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, path18, options) {
|
|
12531
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12532
|
return false;
|
|
12533
12533
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path18, options);
|
|
12535
12535
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
12536
|
+
function isexe(path18, options, cb) {
|
|
12537
|
+
fs16.stat(path18, function(er, stat) {
|
|
12538
|
+
cb(er, er ? false : checkStat(stat, path18, options));
|
|
12539
12539
|
});
|
|
12540
12540
|
}
|
|
12541
|
-
function sync(
|
|
12542
|
-
return checkStat(
|
|
12541
|
+
function sync(path18, options) {
|
|
12542
|
+
return checkStat(fs16.statSync(path18), path18, 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 fs16 = __require("fs");
|
|
12553
|
+
function isexe(path18, options, cb) {
|
|
12554
|
+
fs16.stat(path18, 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(path18, options) {
|
|
12559
|
+
return checkStat(fs16.statSync(path18), 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 fs16 = __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(path18, 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(path18, 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(path18, 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(path18, options) {
|
|
12622
12622
|
try {
|
|
12623
|
-
return core.sync(
|
|
12623
|
+
return core.sync(path18, 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 path18 = __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 = path18.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 = path18.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 path18 = __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 ? path18.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 = path18.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 [path18, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12834
|
+
const binary = path18.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 fs16 = __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 = fs16.openSync(command, "r");
|
|
12855
|
+
fs16.readSync(fd, buffer, 0, size, 0);
|
|
12856
|
+
fs16.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 path18 = __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 = path18.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(" ");
|
|
@@ -13003,8 +13003,8 @@ var require_cross_spawn = __commonJS({
|
|
|
13003
13003
|
|
|
13004
13004
|
// src/maker/server/mcp.ts
|
|
13005
13005
|
import { execFileSync, spawn as spawn4, spawnSync as spawnSync6 } from "node:child_process";
|
|
13006
|
-
import
|
|
13007
|
-
import
|
|
13006
|
+
import fs13 from "node:fs";
|
|
13007
|
+
import path14 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: path18, errorMaps, issueData } = params;
|
|
13369
|
+
const fullPath = [...path18, ...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, path18, key) {
|
|
13485
13485
|
this._cachedPath = [];
|
|
13486
13486
|
this.parent = parent;
|
|
13487
13487
|
this.data = value;
|
|
13488
|
-
this._path =
|
|
13488
|
+
this._path = path18;
|
|
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, path18) {
|
|
17138
|
+
if (!path18)
|
|
17139
17139
|
return obj;
|
|
17140
|
-
return
|
|
17140
|
+
return path18.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(path18, 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(path18);
|
|
17530
17530
|
return iss;
|
|
17531
17531
|
});
|
|
17532
17532
|
}
|
|
@@ -28507,8 +28507,8 @@ function logLifecycleEvent(source, message) {
|
|
|
28507
28507
|
|
|
28508
28508
|
// src/maker/cli/projects.ts
|
|
28509
28509
|
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
28510
|
-
import
|
|
28511
|
-
import
|
|
28510
|
+
import fs7 from "node:fs";
|
|
28511
|
+
import path8 from "node:path";
|
|
28512
28512
|
|
|
28513
28513
|
// src/maker/config.ts
|
|
28514
28514
|
import fs4 from "node:fs";
|
|
@@ -29124,9 +29124,9 @@ function formatGitMissingMessage(environment) {
|
|
|
29124
29124
|
|
|
29125
29125
|
// src/maker/cli/devKit.ts
|
|
29126
29126
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
29127
|
-
import
|
|
29127
|
+
import fs6 from "node:fs";
|
|
29128
29128
|
import os3 from "node:os";
|
|
29129
|
-
import
|
|
29129
|
+
import path7 from "node:path";
|
|
29130
29130
|
|
|
29131
29131
|
// src/maker/fetchTimeout.ts
|
|
29132
29132
|
var DEFAULT_SHORT_FETCH_TIMEOUT_MS = 10 * 1e3;
|
|
@@ -29151,13 +29151,141 @@ async function fetchWithTimeout(fetchImpl, url2, init, timeoutMs, label) {
|
|
|
29151
29151
|
}
|
|
29152
29152
|
}
|
|
29153
29153
|
|
|
29154
|
+
// src/maker/cli/agentsPolicy.ts
|
|
29155
|
+
import crypto from "node:crypto";
|
|
29156
|
+
import fs5 from "node:fs";
|
|
29157
|
+
import path6 from "node:path";
|
|
29158
|
+
var MAKER_AGENTS_FILE = "AGENTS.md";
|
|
29159
|
+
var POLICY_VERSION = "1";
|
|
29160
|
+
var POLICY_END = "<!-- <<< TapTap Maker managed AGENTS policy <<< -->";
|
|
29161
|
+
var POLICY_BLOCK_PATTERN = /(?:# TapTap Maker Project Asset Tool Policy\s*)?<!-- >>> TapTap Maker (?:managed AGENTS policy version=([^ ]+) hash=sha256:([0-9a-f]+)|asset tool policy) >>> -->[\s\S]*?<!-- <<< TapTap Maker (?:managed AGENTS policy|asset tool policy) <<< -->\n?/;
|
|
29162
|
+
function inspectMakerAgentsPolicy(targetDir) {
|
|
29163
|
+
const resolvedTargetDir = path6.resolve(targetDir);
|
|
29164
|
+
const agentsPath = path6.join(resolvedTargetDir, MAKER_AGENTS_FILE);
|
|
29165
|
+
const expectedHash = hashPolicyBody(createMakerAgentsPolicyBody());
|
|
29166
|
+
if (!fs5.existsSync(agentsPath)) {
|
|
29167
|
+
return {
|
|
29168
|
+
targetDir: resolvedTargetDir,
|
|
29169
|
+
path: agentsPath,
|
|
29170
|
+
status: "missing_file",
|
|
29171
|
+
expectedHash
|
|
29172
|
+
};
|
|
29173
|
+
}
|
|
29174
|
+
const existing = fs5.readFileSync(agentsPath, "utf8");
|
|
29175
|
+
const match = POLICY_BLOCK_PATTERN.exec(existing);
|
|
29176
|
+
if (!match) {
|
|
29177
|
+
return {
|
|
29178
|
+
targetDir: resolvedTargetDir,
|
|
29179
|
+
path: agentsPath,
|
|
29180
|
+
status: "missing_block",
|
|
29181
|
+
expectedHash
|
|
29182
|
+
};
|
|
29183
|
+
}
|
|
29184
|
+
const version2 = match[1];
|
|
29185
|
+
const hash2 = match[2];
|
|
29186
|
+
return {
|
|
29187
|
+
targetDir: resolvedTargetDir,
|
|
29188
|
+
path: agentsPath,
|
|
29189
|
+
status: version2 === POLICY_VERSION && hash2 === expectedHash ? "current" : "outdated",
|
|
29190
|
+
version: version2,
|
|
29191
|
+
hash: hash2,
|
|
29192
|
+
expectedHash
|
|
29193
|
+
};
|
|
29194
|
+
}
|
|
29195
|
+
function updateMakerAgentsPolicy(targetDir) {
|
|
29196
|
+
const resolvedTargetDir = path6.resolve(targetDir);
|
|
29197
|
+
fs5.mkdirSync(resolvedTargetDir, { recursive: true });
|
|
29198
|
+
const inspection = inspectMakerAgentsPolicy(resolvedTargetDir);
|
|
29199
|
+
const agentsPath = inspection.path;
|
|
29200
|
+
const existing = fs5.existsSync(agentsPath) ? fs5.readFileSync(agentsPath, "utf8") : "";
|
|
29201
|
+
const next = prependOrReplaceMakerAgentsPolicyBlock(existing);
|
|
29202
|
+
if (existing !== next) {
|
|
29203
|
+
fs5.writeFileSync(agentsPath, next, "utf8");
|
|
29204
|
+
}
|
|
29205
|
+
return {
|
|
29206
|
+
path: agentsPath,
|
|
29207
|
+
previousStatus: inspection.status,
|
|
29208
|
+
changed: existing !== next,
|
|
29209
|
+
expectedHash: inspection.expectedHash
|
|
29210
|
+
};
|
|
29211
|
+
}
|
|
29212
|
+
function formatMakerAgentsPolicyStatus(targetDir) {
|
|
29213
|
+
const inspection = inspectMakerAgentsPolicy(targetDir);
|
|
29214
|
+
const lines = [
|
|
29215
|
+
"AGENTS.md",
|
|
29216
|
+
`- path: ${inspection.path}`,
|
|
29217
|
+
`- status: ${inspection.status}`,
|
|
29218
|
+
`- expected_hash: sha256:${inspection.expectedHash}`,
|
|
29219
|
+
inspection.version ? `- current_version: ${inspection.version}` : "",
|
|
29220
|
+
inspection.hash ? `- current_hash: sha256:${inspection.hash}` : "",
|
|
29221
|
+
inspection.status === "current" ? "" : "- next_step: taptap-maker agents update --target-dir <Maker project dir>"
|
|
29222
|
+
];
|
|
29223
|
+
return lines.filter(Boolean).join("\n");
|
|
29224
|
+
}
|
|
29225
|
+
function prependOrReplaceMakerAgentsPolicyBlock(existing) {
|
|
29226
|
+
const withoutOldBlock = existing.replace(POLICY_BLOCK_PATTERN, "").trimStart();
|
|
29227
|
+
return [createMakerAgentsPolicyBlock(), withoutOldBlock].filter((part) => part.length > 0).join("\n\n");
|
|
29228
|
+
}
|
|
29229
|
+
function createMakerAgentsPolicyBlock() {
|
|
29230
|
+
const body = createMakerAgentsPolicyBody();
|
|
29231
|
+
const hash2 = hashPolicyBody(body);
|
|
29232
|
+
return [
|
|
29233
|
+
`<!-- >>> TapTap Maker managed AGENTS policy version=${POLICY_VERSION} hash=sha256:${hash2} >>> -->`,
|
|
29234
|
+
body,
|
|
29235
|
+
POLICY_END,
|
|
29236
|
+
""
|
|
29237
|
+
].join("\n");
|
|
29238
|
+
}
|
|
29239
|
+
function createMakerAgentsPolicyBody() {
|
|
29240
|
+
return [
|
|
29241
|
+
"# TapTap Maker Project Asset Tool Policy",
|
|
29242
|
+
"",
|
|
29243
|
+
"This is a bound TapTap Maker project. For game asset generation or editing in this project,",
|
|
29244
|
+
"the local AI/Agent should prefer Maker MCP proxy tools when they are available:",
|
|
29245
|
+
"",
|
|
29246
|
+
"- `generate_image` for one image asset.",
|
|
29247
|
+
"- `batch_generate_images` for multiple image assets.",
|
|
29248
|
+
"- `edit_image` for modifying existing project images.",
|
|
29249
|
+
"- `create_video_task` for game video assets or referenced image/video generation.",
|
|
29250
|
+
"- `query_video_task` for refreshing video task status and fetching completed videos.",
|
|
29251
|
+
"- `text_to_music` for game music or audio assets.",
|
|
29252
|
+
"- `create_3d_model_task` for game 3D model assets.",
|
|
29253
|
+
"- `query_3d_model_task` for polling 3D model tasks.",
|
|
29254
|
+
"- For 3D characters that need skeletons, animation, or FBX output, ask whether to use",
|
|
29255
|
+
" `rig=true`. Use it only for biped humanoid characters in A-pose or A-pose-compatible",
|
|
29256
|
+
" front-view inputs; otherwise keep static model generation.",
|
|
29257
|
+
"",
|
|
29258
|
+
"Follow each Maker tool schema for supported local path, remote URL, and data URL inputs.",
|
|
29259
|
+
"If the user references attached/local media, inspect the attachment or workspace file path",
|
|
29260
|
+
"before calling the tool. Local proxy may convert resolvable local reference media to data URLs",
|
|
29261
|
+
"before forwarding to the remote Maker MCP server.",
|
|
29262
|
+
"",
|
|
29263
|
+
"If the required Maker proxy tool is not exposed in the current AI session, explain that the",
|
|
29264
|
+
"Maker proxy tool is unavailable and suggest checking/reconnecting the Maker MCP session.",
|
|
29265
|
+
"Other client media tools may still be usable when their output is passed back through a supported",
|
|
29266
|
+
"local path, remote URL, or data URL input.",
|
|
29267
|
+
"",
|
|
29268
|
+
"Generated Maker proxy assets should stay in the Maker project asset workflow under",
|
|
29269
|
+
"`assets/image`, `assets/video`, `assets/audio`, or `assets/model`, with remote mappings",
|
|
29270
|
+
"preserved for later edits and builds.",
|
|
29271
|
+
"3D model results save the original GLB/FBX, the MDL zip, extracted MDL assets, and rendered",
|
|
29272
|
+
"preview images when those URLs are returned."
|
|
29273
|
+
].join("\n");
|
|
29274
|
+
}
|
|
29275
|
+
function hashPolicyBody(body) {
|
|
29276
|
+
return crypto.createHash("sha256").update(normalizePolicyText(body)).digest("hex");
|
|
29277
|
+
}
|
|
29278
|
+
function normalizePolicyText(text) {
|
|
29279
|
+
return text.replace(/\r\n/g, "\n").trim();
|
|
29280
|
+
}
|
|
29281
|
+
|
|
29154
29282
|
// src/maker/cli/devKit.ts
|
|
29155
29283
|
var AI_DEV_KIT_URLS = {
|
|
29156
29284
|
production: "https://urhox-demo-platform.spark.xd.com/ai-dev-kit/pd/stable/ai-dev-kit.zip",
|
|
29157
29285
|
rnd: "https://urhox-demo-platform.spark.xd.com/ai-dev-kit/rnd/latest/ai-dev-kit.zip"
|
|
29158
29286
|
};
|
|
29159
29287
|
var DEFAULT_AI_DEV_KIT_URL = AI_DEV_KIT_URLS.production;
|
|
29160
|
-
var AI_DEV_KIT_VERSION_METADATA_FILE =
|
|
29288
|
+
var AI_DEV_KIT_VERSION_METADATA_FILE = path7.join(".maker", "ai-dev-kit-version.json");
|
|
29161
29289
|
var AI_DEV_KIT_DOWNLOAD_ENV = {
|
|
29162
29290
|
production: "pd",
|
|
29163
29291
|
rnd: "rnd"
|
|
@@ -29168,9 +29296,6 @@ function resolveDefaultAiDevKitUrl(environment = EnvConfig.environment) {
|
|
|
29168
29296
|
}
|
|
29169
29297
|
var DEV_KIT_IGNORE_BEGIN = "# >>> TapTap Maker AI dev kit (local only) >>>";
|
|
29170
29298
|
var DEV_KIT_IGNORE_END = "# <<< TapTap Maker AI dev kit (local only) <<<";
|
|
29171
|
-
var MAKER_ASSET_POLICY_BEGIN = "<!-- >>> TapTap Maker asset tool policy >>> -->";
|
|
29172
|
-
var MAKER_ASSET_POLICY_END = "<!-- <<< TapTap Maker asset tool policy <<< -->";
|
|
29173
|
-
var AGENTS_INSTRUCTION_FILE = "AGENTS.md";
|
|
29174
29299
|
var DEV_KIT_GITIGNORE_STAGING_FILE = ".gitignore.dev-kit-before-clone";
|
|
29175
29300
|
var DEV_KIT_REQUIRED_ENTRIES = ["CLAUDE.md", "examples", "templates", "urhox-libs"];
|
|
29176
29301
|
var ALWAYS_IGNORED_LOCAL_ENTRIES = [".DS_Store", ".maker", ".installer"];
|
|
@@ -29195,9 +29320,9 @@ var DEV_KIT_MANAGED_ENTRY_CANDIDATES = [
|
|
|
29195
29320
|
var SKIPPED_TOP_LEVEL_ENTRIES = /* @__PURE__ */ new Set(["scripts", ".DS_Store", "ai-dev-kit.zip"]);
|
|
29196
29321
|
var SKILL_INSTALLER_OUTPUT_ENTRIES = [".claude", ".codex", ".cursor", ".gemini"];
|
|
29197
29322
|
function inspectAiDevKit(targetDir) {
|
|
29198
|
-
const resolvedTargetDir =
|
|
29323
|
+
const resolvedTargetDir = path7.resolve(targetDir);
|
|
29199
29324
|
const presentEntries = DEV_KIT_REQUIRED_ENTRIES.filter(
|
|
29200
|
-
(entry) =>
|
|
29325
|
+
(entry) => fs6.existsSync(path7.join(resolvedTargetDir, entry))
|
|
29201
29326
|
);
|
|
29202
29327
|
const missingEntries = DEV_KIT_REQUIRED_ENTRIES.filter(
|
|
29203
29328
|
(entry) => !presentEntries.includes(entry)
|
|
@@ -29212,16 +29337,16 @@ function inspectAiDevKit(targetDir) {
|
|
|
29212
29337
|
};
|
|
29213
29338
|
}
|
|
29214
29339
|
function getAiDevKitVersionMetadataPath(targetDir) {
|
|
29215
|
-
return
|
|
29340
|
+
return path7.join(path7.resolve(targetDir), AI_DEV_KIT_VERSION_METADATA_FILE);
|
|
29216
29341
|
}
|
|
29217
29342
|
function readAiDevKitVersionMetadata(targetDir) {
|
|
29218
29343
|
const metadataPath = getAiDevKitVersionMetadataPath(targetDir);
|
|
29219
|
-
if (!
|
|
29344
|
+
if (!fs6.existsSync(metadataPath)) {
|
|
29220
29345
|
return void 0;
|
|
29221
29346
|
}
|
|
29222
29347
|
try {
|
|
29223
29348
|
const data = JSON.parse(
|
|
29224
|
-
|
|
29349
|
+
fs6.readFileSync(metadataPath, "utf8")
|
|
29225
29350
|
);
|
|
29226
29351
|
if (data.env !== "production" && data.env !== "rnd" || !isValidDevKitVersion(data.version) || typeof data.source_url !== "string" || typeof data.installed_at !== "string") {
|
|
29227
29352
|
return void 0;
|
|
@@ -29233,8 +29358,8 @@ function readAiDevKitVersionMetadata(targetDir) {
|
|
|
29233
29358
|
}
|
|
29234
29359
|
function writeAiDevKitVersionMetadata(targetDir, metadata) {
|
|
29235
29360
|
const metadataPath = getAiDevKitVersionMetadataPath(targetDir);
|
|
29236
|
-
|
|
29237
|
-
|
|
29361
|
+
fs6.mkdirSync(path7.dirname(metadataPath), { recursive: true });
|
|
29362
|
+
fs6.writeFileSync(metadataPath, `${JSON.stringify(metadata, null, 2)}
|
|
29238
29363
|
`, "utf8");
|
|
29239
29364
|
}
|
|
29240
29365
|
async function fetchAiDevKitVersions(options = {}) {
|
|
@@ -29289,7 +29414,7 @@ async function resolveAiDevKitDownload(options = {}) {
|
|
|
29289
29414
|
}
|
|
29290
29415
|
async function checkAiDevKitUpdate(targetDir, options = {}) {
|
|
29291
29416
|
var _a3;
|
|
29292
|
-
const resolvedTargetDir =
|
|
29417
|
+
const resolvedTargetDir = path7.resolve(targetDir);
|
|
29293
29418
|
const installed = readAiDevKitVersionMetadata(resolvedTargetDir);
|
|
29294
29419
|
const download = await resolveAiDevKitDownload({
|
|
29295
29420
|
environment: options.environment,
|
|
@@ -29307,24 +29432,24 @@ async function checkAiDevKitUpdate(targetDir, options = {}) {
|
|
|
29307
29432
|
};
|
|
29308
29433
|
}
|
|
29309
29434
|
function listPresentDevKitManagedEntries(targetDir) {
|
|
29310
|
-
const resolvedTargetDir =
|
|
29435
|
+
const resolvedTargetDir = path7.resolve(targetDir);
|
|
29311
29436
|
return DEV_KIT_MANAGED_ENTRY_CANDIDATES.filter(
|
|
29312
|
-
(entry) =>
|
|
29437
|
+
(entry) => fs6.existsSync(path7.join(resolvedTargetDir, entry))
|
|
29313
29438
|
);
|
|
29314
29439
|
}
|
|
29315
29440
|
async function installAiDevKit(options = {}) {
|
|
29316
29441
|
var _a3;
|
|
29317
|
-
const targetDir =
|
|
29318
|
-
|
|
29442
|
+
const targetDir = path7.resolve(options.targetDir || ".");
|
|
29443
|
+
fs6.mkdirSync(targetDir, { recursive: true });
|
|
29319
29444
|
const download = options.sourceDir ? void 0 : options.url ? void 0 : await resolveAiDevKitDownload({
|
|
29320
29445
|
environment: options.environment,
|
|
29321
29446
|
fetchImpl: options.fetchImpl,
|
|
29322
29447
|
versionCheckTimeoutMs: options.versionCheckTimeoutMs
|
|
29323
29448
|
});
|
|
29324
29449
|
const downloadUrl = options.url || (download == null ? void 0 : download.url) || resolveDefaultAiDevKitUrl(options.environment);
|
|
29325
|
-
const preparedSource = options.sourceDir ?
|
|
29450
|
+
const preparedSource = options.sourceDir ? path7.resolve(options.sourceDir) : await downloadAndExtractDevKit(downloadUrl, options.fetchImpl, options.downloadTimeoutMs);
|
|
29326
29451
|
const sourceDir = resolveDevKitRoot(preparedSource);
|
|
29327
|
-
const entries =
|
|
29452
|
+
const entries = fs6.readdirSync(sourceDir, { withFileTypes: true });
|
|
29328
29453
|
const installedEntries = [];
|
|
29329
29454
|
const skippedEntries = [];
|
|
29330
29455
|
if (options.replaceManagedEntries) {
|
|
@@ -29338,7 +29463,7 @@ async function installAiDevKit(options = {}) {
|
|
|
29338
29463
|
skippedEntries.push(entry.name);
|
|
29339
29464
|
continue;
|
|
29340
29465
|
}
|
|
29341
|
-
copyEntry(
|
|
29466
|
+
copyEntry(path7.join(sourceDir, entry.name), path7.join(targetDir, entry.name), {
|
|
29342
29467
|
preserveExisting: options.preserveExisting
|
|
29343
29468
|
});
|
|
29344
29469
|
installedEntries.push(entry.name);
|
|
@@ -29352,7 +29477,7 @@ async function installAiDevKit(options = {}) {
|
|
|
29352
29477
|
installedEntries.push(entry);
|
|
29353
29478
|
}
|
|
29354
29479
|
}
|
|
29355
|
-
const stagedGitignorePath =
|
|
29480
|
+
const stagedGitignorePath = path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
29356
29481
|
writeDevKitStagedGitignore(stagedGitignorePath, [
|
|
29357
29482
|
...installedEntries,
|
|
29358
29483
|
...listPresentSkillInstallerOutputEntries(targetDir)
|
|
@@ -29368,7 +29493,7 @@ async function installAiDevKit(options = {}) {
|
|
|
29368
29493
|
sourceDir,
|
|
29369
29494
|
installedEntries: installedEntries.sort(),
|
|
29370
29495
|
skippedEntries: skippedEntries.sort(),
|
|
29371
|
-
gitignorePath:
|
|
29496
|
+
gitignorePath: path7.join(targetDir, ".gitignore"),
|
|
29372
29497
|
stagedGitignorePath,
|
|
29373
29498
|
skillInstaller,
|
|
29374
29499
|
download,
|
|
@@ -29376,11 +29501,11 @@ async function installAiDevKit(options = {}) {
|
|
|
29376
29501
|
};
|
|
29377
29502
|
}
|
|
29378
29503
|
function inspectAiDevKitSkillInstallStatus(targetDir) {
|
|
29379
|
-
const resolvedTargetDir =
|
|
29504
|
+
const resolvedTargetDir = path7.resolve(targetDir);
|
|
29380
29505
|
const targets = SKILL_INSTALLER_OUTPUT_ENTRIES.map((entry) => {
|
|
29381
|
-
const skillsDir =
|
|
29382
|
-
const present =
|
|
29383
|
-
const skillCount = present ?
|
|
29506
|
+
const skillsDir = path7.join(resolvedTargetDir, entry, "skills");
|
|
29507
|
+
const present = fs6.existsSync(skillsDir) && fs6.statSync(skillsDir).isDirectory();
|
|
29508
|
+
const skillCount = present ? fs6.readdirSync(skillsDir, { withFileTypes: true }).filter((item) => item.isDirectory() || item.isSymbolicLink()).length : 0;
|
|
29384
29509
|
return {
|
|
29385
29510
|
name: entry.replace(/^\./, ""),
|
|
29386
29511
|
path: skillsDir,
|
|
@@ -29403,68 +29528,15 @@ function createDevKitGitignoreBlock(entries) {
|
|
|
29403
29528
|
return [DEV_KIT_IGNORE_BEGIN, ...ignoreEntries, DEV_KIT_IGNORE_END].join("\n");
|
|
29404
29529
|
}
|
|
29405
29530
|
function writeDevKitStagedGitignore(stagedGitignorePath, entries) {
|
|
29406
|
-
|
|
29531
|
+
fs6.writeFileSync(stagedGitignorePath, `${createDevKitGitignoreBlock(entries)}
|
|
29407
29532
|
`, "utf8");
|
|
29408
29533
|
}
|
|
29409
29534
|
function ensureMakerAssetPolicyInstructionFiles(targetDir) {
|
|
29410
|
-
|
|
29411
|
-
|
|
29412
|
-
const agentsPath = path6.join(resolvedTargetDir, AGENTS_INSTRUCTION_FILE);
|
|
29413
|
-
const existingAgents = fs5.existsSync(agentsPath) ? fs5.readFileSync(agentsPath, "utf8") : "";
|
|
29414
|
-
fs5.writeFileSync(agentsPath, prependMakerAssetPolicyBlock(existingAgents), "utf8");
|
|
29415
|
-
return [AGENTS_INSTRUCTION_FILE];
|
|
29416
|
-
}
|
|
29417
|
-
function prependMakerAssetPolicyBlock(existing) {
|
|
29418
|
-
const withoutOldBlock = removeMakerAssetPolicyBlock(existing).trimStart();
|
|
29419
|
-
const block = createMakerAssetPolicyBlock();
|
|
29420
|
-
return [block, withoutOldBlock].filter((part) => part.length > 0).join("\n\n");
|
|
29421
|
-
}
|
|
29422
|
-
function removeMakerAssetPolicyBlock(content) {
|
|
29423
|
-
return content.replace(
|
|
29424
|
-
new RegExp(
|
|
29425
|
-
`${escapeRegExp(MAKER_ASSET_POLICY_BEGIN)}[\\s\\S]*?${escapeRegExp(
|
|
29426
|
-
MAKER_ASSET_POLICY_END
|
|
29427
|
-
)}\\n?`,
|
|
29428
|
-
"g"
|
|
29429
|
-
),
|
|
29430
|
-
""
|
|
29431
|
-
).replace(/^# TapTap Maker Project Asset Tool Policy\n\n(?=\s*)/, "");
|
|
29432
|
-
}
|
|
29433
|
-
function createMakerAssetPolicyBlock() {
|
|
29434
|
-
return [
|
|
29435
|
-
"# TapTap Maker Project Asset Tool Policy",
|
|
29436
|
-
"",
|
|
29437
|
-
MAKER_ASSET_POLICY_BEGIN,
|
|
29438
|
-
"",
|
|
29439
|
-
"This is a bound TapTap Maker project. For game asset generation or editing in this project,",
|
|
29440
|
-
"the local AI/Agent should prefer Maker MCP proxy tools when they are available:",
|
|
29441
|
-
"",
|
|
29442
|
-
"- `generate_image` for one image asset.",
|
|
29443
|
-
"- `batch_generate_images` for multiple image assets.",
|
|
29444
|
-
"- `edit_image` for modifying existing project images.",
|
|
29445
|
-
"- `create_video_task` for game video assets or referenced image/video generation.",
|
|
29446
|
-
"- `query_video_task` for refreshing video task status and fetching completed videos.",
|
|
29447
|
-
"- `text_to_music` for game music or audio assets.",
|
|
29448
|
-
"",
|
|
29449
|
-
"Follow each Maker tool schema for supported local path, remote URL, and data URL inputs.",
|
|
29450
|
-
"If the user references attached/local media, inspect the attachment or workspace file path",
|
|
29451
|
-
"before calling the tool. Local proxy may convert resolvable local reference media to data URLs",
|
|
29452
|
-
"before forwarding to the remote Maker MCP server.",
|
|
29453
|
-
"",
|
|
29454
|
-
"If the required Maker proxy tool is not exposed in the current AI session, explain that the",
|
|
29455
|
-
"Maker proxy tool is unavailable and suggest checking/reconnecting the Maker MCP session.",
|
|
29456
|
-
"Other client media tools may still be usable when their output is passed back through a supported",
|
|
29457
|
-
"local path, remote URL, or data URL input.",
|
|
29458
|
-
"",
|
|
29459
|
-
"Generated Maker proxy assets should stay in the Maker project asset workflow under",
|
|
29460
|
-
"`assets/image`, `assets/video`, or `assets/audio`, with remote mappings preserved for later",
|
|
29461
|
-
"edits and builds.",
|
|
29462
|
-
"",
|
|
29463
|
-
MAKER_ASSET_POLICY_END
|
|
29464
|
-
].join("\n");
|
|
29535
|
+
updateMakerAgentsPolicy(targetDir);
|
|
29536
|
+
return [MAKER_AGENTS_FILE];
|
|
29465
29537
|
}
|
|
29466
29538
|
function mergeDevKitGitignoreBlock(gitignorePath, block) {
|
|
29467
|
-
const existing =
|
|
29539
|
+
const existing = fs6.existsSync(gitignorePath) ? fs6.readFileSync(gitignorePath, "utf8") : "";
|
|
29468
29540
|
const withoutOldBlock = existing.replace(
|
|
29469
29541
|
new RegExp(
|
|
29470
29542
|
`${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}[\\s\\S]*?${escapeRegExp(DEV_KIT_IGNORE_END)}\\n?`,
|
|
@@ -29473,38 +29545,38 @@ function mergeDevKitGitignoreBlock(gitignorePath, block) {
|
|
|
29473
29545
|
""
|
|
29474
29546
|
).trimEnd();
|
|
29475
29547
|
const next = [withoutOldBlock, block, ""].filter((part) => part.length > 0).join("\n\n");
|
|
29476
|
-
|
|
29548
|
+
fs6.writeFileSync(gitignorePath, next, "utf8");
|
|
29477
29549
|
}
|
|
29478
29550
|
function finalizeStagedDevKitGitignore(targetDir) {
|
|
29479
|
-
const stagedGitignorePath =
|
|
29480
|
-
if (!
|
|
29551
|
+
const stagedGitignorePath = path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
29552
|
+
if (!fs6.existsSync(stagedGitignorePath)) {
|
|
29481
29553
|
return false;
|
|
29482
29554
|
}
|
|
29483
|
-
const block =
|
|
29555
|
+
const block = fs6.readFileSync(stagedGitignorePath, "utf8").trim();
|
|
29484
29556
|
if (block.length > 0) {
|
|
29485
|
-
mergeDevKitGitignoreBlock(
|
|
29557
|
+
mergeDevKitGitignoreBlock(path7.join(targetDir, ".gitignore"), block);
|
|
29486
29558
|
}
|
|
29487
|
-
|
|
29559
|
+
fs6.rmSync(stagedGitignorePath, { force: true });
|
|
29488
29560
|
return true;
|
|
29489
29561
|
}
|
|
29490
29562
|
function copyEntry(source, target, options = {}) {
|
|
29491
|
-
const stat =
|
|
29563
|
+
const stat = fs6.statSync(source);
|
|
29492
29564
|
if (stat.isDirectory()) {
|
|
29493
|
-
|
|
29494
|
-
for (const child of
|
|
29565
|
+
fs6.mkdirSync(target, { recursive: true });
|
|
29566
|
+
for (const child of fs6.readdirSync(source)) {
|
|
29495
29567
|
if (child === ".DS_Store") {
|
|
29496
29568
|
continue;
|
|
29497
29569
|
}
|
|
29498
|
-
copyEntry(
|
|
29570
|
+
copyEntry(path7.join(source, child), path7.join(target, child), options);
|
|
29499
29571
|
}
|
|
29500
29572
|
return;
|
|
29501
29573
|
}
|
|
29502
29574
|
if (stat.isFile()) {
|
|
29503
|
-
if (options.preserveExisting &&
|
|
29575
|
+
if (options.preserveExisting && fs6.existsSync(target)) {
|
|
29504
29576
|
return;
|
|
29505
29577
|
}
|
|
29506
|
-
|
|
29507
|
-
|
|
29578
|
+
fs6.mkdirSync(path7.dirname(target), { recursive: true });
|
|
29579
|
+
fs6.copyFileSync(source, target);
|
|
29508
29580
|
}
|
|
29509
29581
|
}
|
|
29510
29582
|
function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
|
|
@@ -29514,11 +29586,11 @@ function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
|
|
|
29514
29586
|
candidates.add(entry);
|
|
29515
29587
|
}
|
|
29516
29588
|
}
|
|
29517
|
-
for (const entry of readManagedGitignoreEntries(
|
|
29589
|
+
for (const entry of readManagedGitignoreEntries(path7.join(targetDir, ".gitignore"))) {
|
|
29518
29590
|
candidates.add(entry);
|
|
29519
29591
|
}
|
|
29520
29592
|
for (const entry of readManagedGitignoreEntries(
|
|
29521
|
-
|
|
29593
|
+
path7.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
|
|
29522
29594
|
)) {
|
|
29523
29595
|
candidates.add(entry);
|
|
29524
29596
|
}
|
|
@@ -29529,14 +29601,14 @@ function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
|
|
|
29529
29601
|
if (!DEV_KIT_MANAGED_ENTRY_CANDIDATES.includes(entry)) {
|
|
29530
29602
|
continue;
|
|
29531
29603
|
}
|
|
29532
|
-
|
|
29604
|
+
fs6.rmSync(path7.join(targetDir, entry), { recursive: true, force: true });
|
|
29533
29605
|
}
|
|
29534
29606
|
}
|
|
29535
29607
|
function readManagedGitignoreEntries(gitignorePath) {
|
|
29536
|
-
if (!
|
|
29608
|
+
if (!fs6.existsSync(gitignorePath)) {
|
|
29537
29609
|
return [];
|
|
29538
29610
|
}
|
|
29539
|
-
const content =
|
|
29611
|
+
const content = fs6.readFileSync(gitignorePath, "utf8");
|
|
29540
29612
|
const blockPattern = new RegExp(
|
|
29541
29613
|
`${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}\\n([\\s\\S]*?)\\n${escapeRegExp(DEV_KIT_IGNORE_END)}`,
|
|
29542
29614
|
"g"
|
|
@@ -29555,8 +29627,8 @@ function readManagedGitignoreEntries(gitignorePath) {
|
|
|
29555
29627
|
}
|
|
29556
29628
|
function installAiDevKitSkills(targetDir, options = {}) {
|
|
29557
29629
|
var _a3;
|
|
29558
|
-
const toolsDir =
|
|
29559
|
-
if (!
|
|
29630
|
+
const toolsDir = path7.join(targetDir, "tools");
|
|
29631
|
+
if (!fs6.existsSync(toolsDir) || !fs6.statSync(toolsDir).isDirectory()) {
|
|
29560
29632
|
return {
|
|
29561
29633
|
ok: false,
|
|
29562
29634
|
status: "skipped",
|
|
@@ -29568,8 +29640,8 @@ function installAiDevKitSkills(targetDir, options = {}) {
|
|
|
29568
29640
|
}
|
|
29569
29641
|
const isWindows = process.platform === "win32";
|
|
29570
29642
|
const scriptName = isWindows ? "install-skills.ps1" : "install-skills.sh";
|
|
29571
|
-
const scriptPath =
|
|
29572
|
-
if (!
|
|
29643
|
+
const scriptPath = path7.join(toolsDir, scriptName);
|
|
29644
|
+
if (!fs6.existsSync(scriptPath)) {
|
|
29573
29645
|
return {
|
|
29574
29646
|
ok: false,
|
|
29575
29647
|
status: "skipped",
|
|
@@ -29631,7 +29703,7 @@ function runDevKitSkillInstallerForInstall(targetDir, options = {}) {
|
|
|
29631
29703
|
}
|
|
29632
29704
|
function listPresentSkillInstallerOutputEntries(targetDir) {
|
|
29633
29705
|
return SKILL_INSTALLER_OUTPUT_ENTRIES.filter(
|
|
29634
|
-
(entry) =>
|
|
29706
|
+
(entry) => fs6.existsSync(path7.join(targetDir, entry))
|
|
29635
29707
|
);
|
|
29636
29708
|
}
|
|
29637
29709
|
function getAiDevKitVersionsUrl(environment) {
|
|
@@ -29663,19 +29735,19 @@ function writeResolvedDevKitVersionMetadata(targetDir, environment, sourceUrl, c
|
|
|
29663
29735
|
return metadata;
|
|
29664
29736
|
}
|
|
29665
29737
|
async function downloadAndExtractDevKit(url2, fetchImpl = fetch, timeoutMs = DEFAULT_DOWNLOAD_FETCH_TIMEOUT_MS) {
|
|
29666
|
-
const tempDir =
|
|
29667
|
-
const zipPath =
|
|
29738
|
+
const tempDir = fs6.mkdtempSync(path7.join(os3.tmpdir(), "taptap-maker-ai-dev-kit-"));
|
|
29739
|
+
const zipPath = path7.join(tempDir, "ai-dev-kit.zip");
|
|
29668
29740
|
const response = await fetchWithTimeout(fetchImpl, url2, {}, timeoutMs, "AI dev kit download");
|
|
29669
29741
|
if (!response.ok) {
|
|
29670
29742
|
throw new Error(`AI dev kit download failed: HTTP ${response.status} ${response.statusText}`);
|
|
29671
29743
|
}
|
|
29672
29744
|
const payload = Buffer.from(await response.arrayBuffer());
|
|
29673
|
-
|
|
29745
|
+
fs6.writeFileSync(zipPath, payload);
|
|
29674
29746
|
extractZip(zipPath, tempDir);
|
|
29675
|
-
|
|
29747
|
+
fs6.rmSync(zipPath, { force: true });
|
|
29676
29748
|
return tempDir;
|
|
29677
29749
|
}
|
|
29678
|
-
function extractZip(zipPath, targetDir) {
|
|
29750
|
+
function extractZip(zipPath, targetDir, label = "AI dev kit") {
|
|
29679
29751
|
if (process.platform === "win32") {
|
|
29680
29752
|
const result = spawnSync2(
|
|
29681
29753
|
"powershell.exe",
|
|
@@ -29692,11 +29764,11 @@ function extractZip(zipPath, targetDir) {
|
|
|
29692
29764
|
{ encoding: "utf8" }
|
|
29693
29765
|
);
|
|
29694
29766
|
if (result.status !== 0) {
|
|
29695
|
-
throw new Error(`Failed to extract
|
|
29767
|
+
throw new Error(`Failed to extract ${label} zip: ${formatSpawnFailure(result)}`);
|
|
29696
29768
|
}
|
|
29697
29769
|
return;
|
|
29698
29770
|
}
|
|
29699
|
-
const unzipResult = spawnSync2("unzip", ["-
|
|
29771
|
+
const unzipResult = spawnSync2("unzip", ["-oq", zipPath, "-d", targetDir], { encoding: "utf8" });
|
|
29700
29772
|
if (unzipResult.status === 0) {
|
|
29701
29773
|
return;
|
|
29702
29774
|
}
|
|
@@ -29714,7 +29786,7 @@ function extractZip(zipPath, targetDir) {
|
|
|
29714
29786
|
}
|
|
29715
29787
|
throw new Error(
|
|
29716
29788
|
[
|
|
29717
|
-
`Failed to extract
|
|
29789
|
+
`Failed to extract ${label} zip: unzip: ${formatSpawnFailure(unzipResult)}`,
|
|
29718
29790
|
...pythonFailures
|
|
29719
29791
|
].join("; ")
|
|
29720
29792
|
);
|
|
@@ -29800,11 +29872,11 @@ function shellQuote(value) {
|
|
|
29800
29872
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
29801
29873
|
}
|
|
29802
29874
|
function resolveDevKitRoot(sourceDir) {
|
|
29803
|
-
const directEntries =
|
|
29875
|
+
const directEntries = fs6.existsSync(sourceDir) ? fs6.readdirSync(sourceDir) : [];
|
|
29804
29876
|
if (looksLikeDevKitRoot(sourceDir)) {
|
|
29805
29877
|
return sourceDir;
|
|
29806
29878
|
}
|
|
29807
|
-
const childDirs = directEntries.map((entry) =>
|
|
29879
|
+
const childDirs = directEntries.map((entry) => path7.join(sourceDir, entry)).filter((entryPath) => fs6.existsSync(entryPath) && fs6.statSync(entryPath).isDirectory());
|
|
29808
29880
|
for (const childDir of childDirs) {
|
|
29809
29881
|
if (looksLikeDevKitRoot(childDir)) {
|
|
29810
29882
|
return childDir;
|
|
@@ -29813,7 +29885,7 @@ function resolveDevKitRoot(sourceDir) {
|
|
|
29813
29885
|
throw new Error(`AI dev kit root not found under ${sourceDir}`);
|
|
29814
29886
|
}
|
|
29815
29887
|
function looksLikeDevKitRoot(dir) {
|
|
29816
|
-
return
|
|
29888
|
+
return fs6.existsSync(path7.join(dir, "engine-docs")) || fs6.existsSync(path7.join(dir, ".emmylua")) || fs6.existsSync(path7.join(dir, "urhox-libs"));
|
|
29817
29889
|
}
|
|
29818
29890
|
function formatIgnoreEntry(entry) {
|
|
29819
29891
|
if (entry === ".DS_Store") {
|
|
@@ -29929,9 +30001,38 @@ async function listMakerProjects(options) {
|
|
|
29929
30001
|
}
|
|
29930
30002
|
return normalizeProjectsResponse(json2);
|
|
29931
30003
|
}
|
|
30004
|
+
async function createMakerProject(options) {
|
|
30005
|
+
const name = options.name.trim();
|
|
30006
|
+
if (!name) {
|
|
30007
|
+
throw new Error("Maker project name is required.");
|
|
30008
|
+
}
|
|
30009
|
+
const response = await fetch(`${getMakerApiBase()}/apps`, {
|
|
30010
|
+
method: "POST",
|
|
30011
|
+
headers: {
|
|
30012
|
+
Authorization: `Bearer ${options.pat}`,
|
|
30013
|
+
Accept: "application/json",
|
|
30014
|
+
"Content-Type": "application/json"
|
|
30015
|
+
},
|
|
30016
|
+
body: JSON.stringify({
|
|
30017
|
+
name,
|
|
30018
|
+
gameType: options.gameType || "sce"
|
|
30019
|
+
})
|
|
30020
|
+
});
|
|
30021
|
+
const json2 = await response.json();
|
|
30022
|
+
if (!response.ok) {
|
|
30023
|
+
throw new Error(`Maker project create failed: HTTP ${response.status} ${JSON.stringify(json2)}`);
|
|
30024
|
+
}
|
|
30025
|
+
const body = json2;
|
|
30026
|
+
const projects = normalizeProjectsResponse(body.app ? { apps: [body.app] } : json2);
|
|
30027
|
+
const project = projects[0];
|
|
30028
|
+
if (!(project == null ? void 0 : project.id)) {
|
|
30029
|
+
throw new Error(`Maker project create returned no app id: ${JSON.stringify(json2)}`);
|
|
30030
|
+
}
|
|
30031
|
+
return project;
|
|
30032
|
+
}
|
|
29932
30033
|
async function cloneMakerProject(options) {
|
|
29933
30034
|
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
29934
|
-
const target =
|
|
30035
|
+
const target = path8.resolve(options.targetDir);
|
|
29935
30036
|
ensureTargetCanBindApp(target, options.appId);
|
|
29936
30037
|
const warnings = createPreCloneWarnings(target);
|
|
29937
30038
|
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
@@ -30097,7 +30198,7 @@ async function pushMakerProject(options) {
|
|
|
30097
30198
|
phase: "prepare",
|
|
30098
30199
|
message: "Preparing Maker project push"
|
|
30099
30200
|
});
|
|
30100
|
-
const requestedCwd =
|
|
30201
|
+
const requestedCwd = path8.resolve(options.cwd);
|
|
30101
30202
|
const workspace = resolveUsableMakerGitWorkspace(requestedCwd);
|
|
30102
30203
|
const cwd = workspace.projectRoot;
|
|
30103
30204
|
const project = loadProjectConfig(cwd);
|
|
@@ -30728,7 +30829,7 @@ function makeAuthenticatedGitUrl(gitUrl, pat) {
|
|
|
30728
30829
|
return gitUrl.replace(/^https:\/\//, `https://git:${encodeURIComponent(pat)}@`);
|
|
30729
30830
|
}
|
|
30730
30831
|
async function fetchAndCheckoutTarget(target, authUrl, pat, onProgress) {
|
|
30731
|
-
if (
|
|
30832
|
+
if (fs7.existsSync(target) && hasDirectoryEntries(target)) {
|
|
30732
30833
|
onProgress == null ? void 0 : onProgress({
|
|
30733
30834
|
progress: 10,
|
|
30734
30835
|
total: 100,
|
|
@@ -30775,23 +30876,23 @@ function emitFirstCloneWaitNotice(onProgress, phase) {
|
|
|
30775
30876
|
});
|
|
30776
30877
|
}
|
|
30777
30878
|
function hasDirectoryEntries(target) {
|
|
30778
|
-
if (!
|
|
30879
|
+
if (!fs7.existsSync(target)) {
|
|
30779
30880
|
return false;
|
|
30780
30881
|
}
|
|
30781
|
-
return
|
|
30882
|
+
return fs7.readdirSync(target).length > 0;
|
|
30782
30883
|
}
|
|
30783
30884
|
function listLocalFiles(root) {
|
|
30784
|
-
if (!
|
|
30885
|
+
if (!fs7.existsSync(root)) {
|
|
30785
30886
|
return [];
|
|
30786
30887
|
}
|
|
30787
30888
|
const files = [];
|
|
30788
30889
|
const visit = (dir, relativeDir) => {
|
|
30789
|
-
for (const entry of
|
|
30890
|
+
for (const entry of fs7.readdirSync(dir, { withFileTypes: true })) {
|
|
30790
30891
|
const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
|
|
30791
30892
|
if (entry.name === ".git" || relativePath === ".maker-mcp" || relativePath.startsWith(".maker-mcp/") || entry.name === ".DS_Store") {
|
|
30792
30893
|
continue;
|
|
30793
30894
|
}
|
|
30794
|
-
const fullPath =
|
|
30895
|
+
const fullPath = path8.join(dir, entry.name);
|
|
30795
30896
|
if (entry.isDirectory()) {
|
|
30796
30897
|
visit(fullPath, relativePath);
|
|
30797
30898
|
continue;
|
|
@@ -30805,10 +30906,10 @@ function listLocalFiles(root) {
|
|
|
30805
30906
|
return files;
|
|
30806
30907
|
}
|
|
30807
30908
|
function listPreCloneNoticeFiles(root) {
|
|
30808
|
-
if (!
|
|
30909
|
+
if (!fs7.existsSync(root)) {
|
|
30809
30910
|
return [];
|
|
30810
30911
|
}
|
|
30811
|
-
return
|
|
30912
|
+
return fs7.readdirSync(root, { withFileTypes: true }).filter((entry) => !isIgnorablePreCloneEntry(entry.name)).map((entry) => entry.name).sort();
|
|
30812
30913
|
}
|
|
30813
30914
|
function createPreCloneWarnings(target) {
|
|
30814
30915
|
const preCloneLocalFiles = listPreCloneNoticeFiles(target);
|
|
@@ -30931,7 +31032,7 @@ function ensureOwnGitRoot(repoDir) {
|
|
|
30931
31032
|
);
|
|
30932
31033
|
}
|
|
30933
31034
|
function inspectMakerDirectoryGitStatus(cwd) {
|
|
30934
|
-
const targetDir =
|
|
31035
|
+
const targetDir = path8.resolve(cwd);
|
|
30935
31036
|
const gitRoot = resolveGitRoot(targetDir);
|
|
30936
31037
|
const gitDir = resolveGitDir(targetDir);
|
|
30937
31038
|
const makerBinding = findMakerProjectBinding(targetDir);
|
|
@@ -31004,16 +31105,16 @@ function formatMakerGitRootMismatch(status) {
|
|
|
31004
31105
|
}
|
|
31005
31106
|
function findMakerProjectBinding(startDir) {
|
|
31006
31107
|
var _a3;
|
|
31007
|
-
let current =
|
|
31108
|
+
let current = path8.resolve(startDir);
|
|
31008
31109
|
while (current.length > 0) {
|
|
31009
31110
|
const configPath = getProjectConfigPath(current);
|
|
31010
|
-
if (
|
|
31111
|
+
if (fs7.existsSync(configPath) && ((_a3 = loadProjectConfig(current)) == null ? void 0 : _a3.project_id)) {
|
|
31011
31112
|
return {
|
|
31012
31113
|
projectRoot: current,
|
|
31013
31114
|
configPath
|
|
31014
31115
|
};
|
|
31015
31116
|
}
|
|
31016
|
-
const parent =
|
|
31117
|
+
const parent = path8.dirname(current);
|
|
31017
31118
|
if (parent === current) {
|
|
31018
31119
|
return null;
|
|
31019
31120
|
}
|
|
@@ -31023,7 +31124,7 @@ function findMakerProjectBinding(startDir) {
|
|
|
31023
31124
|
}
|
|
31024
31125
|
function resolveGitRoot(cwd) {
|
|
31025
31126
|
try {
|
|
31026
|
-
return
|
|
31127
|
+
return path8.resolve(readGitSync(["-C", cwd, "rev-parse", "--show-toplevel"]).trim());
|
|
31027
31128
|
} catch {
|
|
31028
31129
|
return void 0;
|
|
31029
31130
|
}
|
|
@@ -31031,7 +31132,7 @@ function resolveGitRoot(cwd) {
|
|
|
31031
31132
|
function resolveGitDir(cwd) {
|
|
31032
31133
|
try {
|
|
31033
31134
|
const gitDir = readGitSync(["-C", cwd, "rev-parse", "--git-dir"]).trim();
|
|
31034
|
-
return
|
|
31135
|
+
return path8.isAbsolute(gitDir) ? path8.resolve(gitDir) : path8.resolve(cwd, gitDir);
|
|
31035
31136
|
} catch {
|
|
31036
31137
|
return void 0;
|
|
31037
31138
|
}
|
|
@@ -31040,9 +31141,9 @@ function samePath(left, right) {
|
|
|
31040
31141
|
return normalizePathForCompare(left) === normalizePathForCompare(right);
|
|
31041
31142
|
}
|
|
31042
31143
|
function normalizePathForCompare(value) {
|
|
31043
|
-
const resolved =
|
|
31144
|
+
const resolved = path8.resolve(value);
|
|
31044
31145
|
try {
|
|
31045
|
-
return
|
|
31146
|
+
return fs7.realpathSync.native(resolved);
|
|
31046
31147
|
} catch {
|
|
31047
31148
|
return resolved;
|
|
31048
31149
|
}
|
|
@@ -31408,8 +31509,8 @@ async function requestTapAuthWithPat(manualPat, environment, options = {}) {
|
|
|
31408
31509
|
|
|
31409
31510
|
// src/maker/system/python.ts
|
|
31410
31511
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
31411
|
-
import
|
|
31412
|
-
import
|
|
31512
|
+
import fs8 from "node:fs";
|
|
31513
|
+
import path9 from "node:path";
|
|
31413
31514
|
var PYTHON_INFO_SCRIPT = [
|
|
31414
31515
|
"import json, sys",
|
|
31415
31516
|
'print(json.dumps({"executable": sys.executable, "version": ".".join(map(str, sys.version_info[:3]))}))'
|
|
@@ -31418,16 +31519,16 @@ var DEFAULT_PYTHON_VERSION = "3.12";
|
|
|
31418
31519
|
var MINIMUM_PYTHON_VERSION = "3.8";
|
|
31419
31520
|
var RECOMMENDED_PYTHON_VERSION = "3.12";
|
|
31420
31521
|
function getMakerPythonConfigPath() {
|
|
31421
|
-
return
|
|
31522
|
+
return path9.join(getMakerHome(), "python.json");
|
|
31422
31523
|
}
|
|
31423
31524
|
function getMakerUvInstallRoot() {
|
|
31424
|
-
return
|
|
31525
|
+
return path9.join(getMakerHome(), "bin");
|
|
31425
31526
|
}
|
|
31426
31527
|
function getMakerUvPath(platform = process.platform) {
|
|
31427
|
-
return
|
|
31528
|
+
return path9.join(getMakerUvInstallRoot(), platform === "win32" ? "uv.exe" : "uv");
|
|
31428
31529
|
}
|
|
31429
31530
|
function getMakerUvPythonInstallDir() {
|
|
31430
|
-
return
|
|
31531
|
+
return path9.join(getMakerHome(), "python", "uv");
|
|
31431
31532
|
}
|
|
31432
31533
|
function checkMakerPythonEnvironment(options = {}) {
|
|
31433
31534
|
const platform = options.platform || process.platform;
|
|
@@ -31443,7 +31544,7 @@ function checkMakerPythonEnvironment(options = {}) {
|
|
|
31443
31544
|
pathCommand,
|
|
31444
31545
|
uv: {
|
|
31445
31546
|
path: uvPath,
|
|
31446
|
-
installed:
|
|
31547
|
+
installed: fs8.existsSync(uvPath),
|
|
31447
31548
|
version: readUvVersion(uvPath, runner)
|
|
31448
31549
|
}
|
|
31449
31550
|
};
|
|
@@ -31665,10 +31766,10 @@ function resultToEnvironment(result, base) {
|
|
|
31665
31766
|
}
|
|
31666
31767
|
function ensureUvInstalled(platform, runner) {
|
|
31667
31768
|
const uvPath = getMakerUvPath(platform);
|
|
31668
|
-
if (
|
|
31769
|
+
if (fs8.existsSync(uvPath)) {
|
|
31669
31770
|
return uvPath;
|
|
31670
31771
|
}
|
|
31671
|
-
|
|
31772
|
+
fs8.mkdirSync(getMakerUvInstallRoot(), { recursive: true });
|
|
31672
31773
|
const env = {
|
|
31673
31774
|
...process.env,
|
|
31674
31775
|
INSTALLER_NO_MODIFY_PATH: "1",
|
|
@@ -31691,13 +31792,13 @@ function ensureUvInstalled(platform, runner) {
|
|
|
31691
31792
|
if (install.status !== 0) {
|
|
31692
31793
|
throw new Error(formatSetupFailure("uv installer failed", install));
|
|
31693
31794
|
}
|
|
31694
|
-
if (!
|
|
31695
|
-
const nestedUvPath =
|
|
31795
|
+
if (!fs8.existsSync(uvPath)) {
|
|
31796
|
+
const nestedUvPath = path9.join(
|
|
31696
31797
|
getMakerUvInstallRoot(),
|
|
31697
31798
|
"bin",
|
|
31698
31799
|
platform === "win32" ? "uv.exe" : "uv"
|
|
31699
31800
|
);
|
|
31700
|
-
if (
|
|
31801
|
+
if (fs8.existsSync(nestedUvPath)) {
|
|
31701
31802
|
return nestedUvPath;
|
|
31702
31803
|
}
|
|
31703
31804
|
throw new Error(`uv installer finished, but ${uvPath} was not created.`);
|
|
@@ -31708,11 +31809,11 @@ function createUvPythonEnv() {
|
|
|
31708
31809
|
return {
|
|
31709
31810
|
...process.env,
|
|
31710
31811
|
UV_PYTHON_INSTALL_DIR: getMakerUvPythonInstallDir(),
|
|
31711
|
-
UV_CACHE_DIR:
|
|
31812
|
+
UV_CACHE_DIR: path9.join(getMakerHome(), "cache", "uv")
|
|
31712
31813
|
};
|
|
31713
31814
|
}
|
|
31714
31815
|
function readUvVersion(uvPath, runner) {
|
|
31715
|
-
if (!
|
|
31816
|
+
if (!fs8.existsSync(uvPath)) {
|
|
31716
31817
|
return void 0;
|
|
31717
31818
|
}
|
|
31718
31819
|
const result = runner(uvPath, ["--version"], { encoding: "utf8" });
|
|
@@ -31765,11 +31866,11 @@ function parseVersionTuple(version2) {
|
|
|
31765
31866
|
}
|
|
31766
31867
|
function loadPythonRuntimeConfig() {
|
|
31767
31868
|
const configPath = getMakerPythonConfigPath();
|
|
31768
|
-
if (!
|
|
31869
|
+
if (!fs8.existsSync(configPath)) {
|
|
31769
31870
|
return void 0;
|
|
31770
31871
|
}
|
|
31771
31872
|
try {
|
|
31772
|
-
const data = JSON.parse(
|
|
31873
|
+
const data = JSON.parse(fs8.readFileSync(configPath, "utf8"));
|
|
31773
31874
|
if (typeof data.python === "string" || data.status === "setup_failed") {
|
|
31774
31875
|
return data;
|
|
31775
31876
|
}
|
|
@@ -31788,8 +31889,8 @@ function savePythonRuntimeConfig(environment) {
|
|
|
31788
31889
|
version: environment.version,
|
|
31789
31890
|
saved_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
31790
31891
|
};
|
|
31791
|
-
|
|
31792
|
-
|
|
31892
|
+
fs8.mkdirSync(path9.dirname(getMakerPythonConfigPath()), { recursive: true });
|
|
31893
|
+
fs8.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
|
|
31793
31894
|
}
|
|
31794
31895
|
function savePythonSetupFailure(error2) {
|
|
31795
31896
|
const config2 = {
|
|
@@ -31797,8 +31898,8 @@ function savePythonSetupFailure(error2) {
|
|
|
31797
31898
|
error: error2 instanceof Error ? error2.message : String(error2),
|
|
31798
31899
|
saved_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
31799
31900
|
};
|
|
31800
|
-
|
|
31801
|
-
|
|
31901
|
+
fs8.mkdirSync(path9.dirname(getMakerPythonConfigPath()), { recursive: true });
|
|
31902
|
+
fs8.writeFileSync(getMakerPythonConfigPath(), JSON.stringify(config2, null, 2), "utf8");
|
|
31802
31903
|
}
|
|
31803
31904
|
function formatSetupFailure(message, result) {
|
|
31804
31905
|
var _a3, _b, _c;
|
|
@@ -31813,8 +31914,8 @@ function formatSetupFailure(message, result) {
|
|
|
31813
31914
|
|
|
31814
31915
|
// src/maker/system/luaLsp.ts
|
|
31815
31916
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
31816
|
-
import
|
|
31817
|
-
import
|
|
31917
|
+
import fs9 from "node:fs";
|
|
31918
|
+
import path10 from "node:path";
|
|
31818
31919
|
var LUA_LSP_PACKAGE = "maker-lua-lsp";
|
|
31819
31920
|
var LUA_LSP_IDES = "codex,cursor,claude";
|
|
31820
31921
|
var LUA_LSP_SETUP_TIMEOUT_MS = 12e4;
|
|
@@ -31824,10 +31925,10 @@ var PYTHON_SCRIPTS_DIR_SCRIPT = [
|
|
|
31824
31925
|
'print(sysconfig.get_path("scripts") or "")'
|
|
31825
31926
|
].join("; ");
|
|
31826
31927
|
function getMakerLuaLspConfigPath() {
|
|
31827
|
-
return
|
|
31928
|
+
return path10.join(getMakerHome(), "lua-lsp.json");
|
|
31828
31929
|
}
|
|
31829
31930
|
function getMakerLuaLspVenvDir() {
|
|
31830
|
-
return
|
|
31931
|
+
return path10.join(getMakerHome(), "lua-lsp-venv");
|
|
31831
31932
|
}
|
|
31832
31933
|
function checkMakerLuaLspEnvironment(options = {}) {
|
|
31833
31934
|
const runner = options.spawn || spawnSync5;
|
|
@@ -31855,7 +31956,7 @@ function checkMakerLuaLspEnvironment(options = {}) {
|
|
|
31855
31956
|
command: saved.command,
|
|
31856
31957
|
version: version3,
|
|
31857
31958
|
python: saved.python || python.python,
|
|
31858
|
-
scriptsDir:
|
|
31959
|
+
scriptsDir: path10.dirname(saved.command),
|
|
31859
31960
|
missing: [],
|
|
31860
31961
|
nextAction: "maker-lua-lsp 已安装;本地 Lua 诊断可用。"
|
|
31861
31962
|
};
|
|
@@ -32032,16 +32133,16 @@ function createLuaLspBase(platform) {
|
|
|
32032
32133
|
}
|
|
32033
32134
|
function resolveLuaLspCommand(python, platform, runner) {
|
|
32034
32135
|
const venvCommand = getLuaLspVenvCommand(platform);
|
|
32035
|
-
if (
|
|
32036
|
-
return { command: venvCommand, scriptsDir:
|
|
32136
|
+
if (fs9.existsSync(venvCommand)) {
|
|
32137
|
+
return { command: venvCommand, scriptsDir: path10.dirname(venvCommand) };
|
|
32037
32138
|
}
|
|
32038
32139
|
const scriptsDir = readPythonScriptsDir(python.python, runner);
|
|
32039
32140
|
if (scriptsDir) {
|
|
32040
|
-
const command =
|
|
32141
|
+
const command = path10.join(
|
|
32041
32142
|
scriptsDir,
|
|
32042
32143
|
platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
|
|
32043
32144
|
);
|
|
32044
|
-
if (
|
|
32145
|
+
if (fs9.existsSync(command)) {
|
|
32045
32146
|
return { command, scriptsDir };
|
|
32046
32147
|
}
|
|
32047
32148
|
return { scriptsDir };
|
|
@@ -32065,23 +32166,23 @@ function ensureLuaLspVenv(python, platform, runner) {
|
|
|
32065
32166
|
return { python: venvPython, scriptsDir, command };
|
|
32066
32167
|
}
|
|
32067
32168
|
function isLuaLspVenvComplete(platform) {
|
|
32068
|
-
return
|
|
32169
|
+
return fs9.existsSync(getLuaLspVenvPython(platform)) && fs9.existsSync(getLuaLspVenvConfigPath());
|
|
32069
32170
|
}
|
|
32070
32171
|
function getLuaLspVenvConfigPath() {
|
|
32071
|
-
return
|
|
32172
|
+
return path10.join(getMakerLuaLspVenvDir(), "pyvenv.cfg");
|
|
32072
32173
|
}
|
|
32073
32174
|
function getLuaLspVenvPython(platform) {
|
|
32074
|
-
return
|
|
32175
|
+
return path10.join(
|
|
32075
32176
|
getMakerLuaLspVenvDir(),
|
|
32076
32177
|
platform === "win32" ? "Scripts" : "bin",
|
|
32077
32178
|
platform === "win32" ? "python.exe" : "python"
|
|
32078
32179
|
);
|
|
32079
32180
|
}
|
|
32080
32181
|
function getLuaLspVenvScriptsDir(platform) {
|
|
32081
|
-
return
|
|
32182
|
+
return path10.join(getMakerLuaLspVenvDir(), platform === "win32" ? "Scripts" : "bin");
|
|
32082
32183
|
}
|
|
32083
32184
|
function getLuaLspVenvCommand(platform) {
|
|
32084
|
-
return
|
|
32185
|
+
return path10.join(
|
|
32085
32186
|
getLuaLspVenvScriptsDir(platform),
|
|
32086
32187
|
platform === "win32" ? "maker-lua-lsp.exe" : "maker-lua-lsp"
|
|
32087
32188
|
);
|
|
@@ -32129,11 +32230,11 @@ function formatLuaLspSetupFailure(platform, python, message, result, command, sc
|
|
|
32129
32230
|
}
|
|
32130
32231
|
function loadLuaLspRuntimeConfig() {
|
|
32131
32232
|
const configPath = getMakerLuaLspConfigPath();
|
|
32132
|
-
if (!
|
|
32233
|
+
if (!fs9.existsSync(configPath)) {
|
|
32133
32234
|
return void 0;
|
|
32134
32235
|
}
|
|
32135
32236
|
try {
|
|
32136
|
-
return JSON.parse(
|
|
32237
|
+
return JSON.parse(fs9.readFileSync(configPath, "utf8"));
|
|
32137
32238
|
} catch {
|
|
32138
32239
|
return void 0;
|
|
32139
32240
|
}
|
|
@@ -32146,13 +32247,13 @@ function saveLuaLspRuntimeConfig(environment) {
|
|
|
32146
32247
|
error: environment.error,
|
|
32147
32248
|
saved_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
32148
32249
|
};
|
|
32149
|
-
|
|
32150
|
-
|
|
32250
|
+
fs9.mkdirSync(path10.dirname(getMakerLuaLspConfigPath()), { recursive: true });
|
|
32251
|
+
fs9.writeFileSync(getMakerLuaLspConfigPath(), JSON.stringify(config2, null, 2), "utf8");
|
|
32151
32252
|
}
|
|
32152
32253
|
|
|
32153
32254
|
// src/maker/cli/skill.ts
|
|
32154
|
-
import
|
|
32155
|
-
import
|
|
32255
|
+
import fs10 from "node:fs";
|
|
32256
|
+
import path11 from "node:path";
|
|
32156
32257
|
import { fileURLToPath } from "node:url";
|
|
32157
32258
|
var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
|
|
32158
32259
|
var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
|
|
@@ -32171,7 +32272,7 @@ var BUNDLED_SKILLS = [
|
|
|
32171
32272
|
function formatMakerSkillStatus(_options = {}) {
|
|
32172
32273
|
const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
|
|
32173
32274
|
name: skill.name,
|
|
32174
|
-
path:
|
|
32275
|
+
path: path11.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
|
|
32175
32276
|
}));
|
|
32176
32277
|
return [
|
|
32177
32278
|
"TapTap Maker workflow guide documents",
|
|
@@ -32192,20 +32293,23 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
32192
32293
|
"- If Maker proxy tools are missing, explain the session/configuration issue and available alternatives.",
|
|
32193
32294
|
"- Use generate_image, batch_generate_images, edit_image for game image assets.",
|
|
32194
32295
|
"- Use create_video_task, query_video_task, and text_to_music for game video/audio assets.",
|
|
32195
|
-
"-
|
|
32296
|
+
"- Use create_3d_model_task and query_3d_model_task for game 3D model assets.",
|
|
32297
|
+
"- Generated assets are saved under assets/image, assets/video, assets/audio, or assets/model with remote mappings.",
|
|
32196
32298
|
"- Follow each tool schema for supported local path, remote URL, and data URL inputs.",
|
|
32197
32299
|
"- Local proxy may convert resolvable local reference media to data URLs before forwarding.",
|
|
32300
|
+
"- Generated 3D outputs save original GLB/FBX and MDL zip under assets/model.",
|
|
32301
|
+
"- MDL zip contents are extracted into assets/Meshes, assets/Materials, assets/Textures, and assets/Prefabs.",
|
|
32198
32302
|
"Maker initialization next_step: execute `taptap-maker init`.",
|
|
32199
32303
|
"Load these documents when the current AI client supports reading local guide files."
|
|
32200
32304
|
].join("\n");
|
|
32201
32305
|
}
|
|
32202
32306
|
function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
|
|
32203
32307
|
const candidates = [
|
|
32204
|
-
|
|
32308
|
+
path11.join(process.cwd(), "skills", skillName),
|
|
32205
32309
|
getBundledSkillSourceDir(skillName)
|
|
32206
32310
|
].filter(Boolean);
|
|
32207
32311
|
for (const candidate of candidates) {
|
|
32208
|
-
if (
|
|
32312
|
+
if (fs10.existsSync(path11.join(candidate, "SKILL.md"))) {
|
|
32209
32313
|
return candidate;
|
|
32210
32314
|
}
|
|
32211
32315
|
}
|
|
@@ -32218,13 +32322,13 @@ function getBundledSkillSourceDir(skillName) {
|
|
|
32218
32322
|
return null;
|
|
32219
32323
|
}
|
|
32220
32324
|
const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
|
|
32221
|
-
const packageRoot =
|
|
32222
|
-
return
|
|
32325
|
+
const packageRoot = path11.dirname(path11.dirname(bundlePath));
|
|
32326
|
+
return path11.join(packageRoot, "skills", skillName);
|
|
32223
32327
|
}
|
|
32224
32328
|
|
|
32225
32329
|
// src/maker/server/runtimeLogs.ts
|
|
32226
|
-
import
|
|
32227
|
-
import
|
|
32330
|
+
import fs11 from "node:fs";
|
|
32331
|
+
import path12 from "node:path";
|
|
32228
32332
|
var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
|
|
32229
32333
|
var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
32230
32334
|
var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
|
|
@@ -32365,19 +32469,19 @@ async function pullRuntimeLogs(options) {
|
|
|
32365
32469
|
}
|
|
32366
32470
|
function resetRuntimeLogs(projectRoot) {
|
|
32367
32471
|
const runtimeDir = getRuntimeLogDir(projectRoot);
|
|
32368
|
-
|
|
32472
|
+
fs11.mkdirSync(runtimeDir, { recursive: true });
|
|
32369
32473
|
for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
|
|
32370
|
-
|
|
32474
|
+
fs11.rmSync(path12.join(runtimeDir, file2), { force: true });
|
|
32371
32475
|
}
|
|
32372
32476
|
return runtimeDir;
|
|
32373
32477
|
}
|
|
32374
32478
|
function readRuntimeLogState(projectRoot) {
|
|
32375
32479
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
32376
|
-
if (!
|
|
32480
|
+
if (!fs11.existsSync(statePath)) {
|
|
32377
32481
|
return null;
|
|
32378
32482
|
}
|
|
32379
32483
|
try {
|
|
32380
|
-
const state = JSON.parse(
|
|
32484
|
+
const state = JSON.parse(fs11.readFileSync(statePath, "utf8"));
|
|
32381
32485
|
return isRuntimeLogState(state) ? state : null;
|
|
32382
32486
|
} catch {
|
|
32383
32487
|
return null;
|
|
@@ -32405,9 +32509,9 @@ function normalizeRuntimeLogQueryResult(result) {
|
|
|
32405
32509
|
};
|
|
32406
32510
|
}
|
|
32407
32511
|
function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
32408
|
-
const rawPath =
|
|
32409
|
-
|
|
32410
|
-
|
|
32512
|
+
const rawPath = path12.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
|
|
32513
|
+
fs11.mkdirSync(path12.dirname(rawPath), { recursive: true });
|
|
32514
|
+
fs11.writeFileSync(
|
|
32411
32515
|
rawPath,
|
|
32412
32516
|
`${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
|
|
32413
32517
|
`,
|
|
@@ -32416,7 +32520,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
|
32416
32520
|
return rawPath;
|
|
32417
32521
|
}
|
|
32418
32522
|
function appendRuntimeLogs(projectRoot, logs) {
|
|
32419
|
-
|
|
32523
|
+
fs11.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
|
|
32420
32524
|
if (logs.length === 0) {
|
|
32421
32525
|
return { files: [], written: 0 };
|
|
32422
32526
|
}
|
|
@@ -32424,7 +32528,7 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
32424
32528
|
let written = 0;
|
|
32425
32529
|
for (const log of logs) {
|
|
32426
32530
|
const line = JSON.stringify(compactRuntimeLogEntry(log));
|
|
32427
|
-
|
|
32531
|
+
fs11.appendFileSync(filePath, `${line}
|
|
32428
32532
|
`, "utf8");
|
|
32429
32533
|
written += 1;
|
|
32430
32534
|
}
|
|
@@ -32432,11 +32536,11 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
32432
32536
|
}
|
|
32433
32537
|
function writeRuntimeLogState(projectRoot, state) {
|
|
32434
32538
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
32435
|
-
|
|
32539
|
+
fs11.mkdirSync(path12.dirname(statePath), { recursive: true });
|
|
32436
32540
|
const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
|
|
32437
|
-
|
|
32541
|
+
fs11.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
32438
32542
|
`, "utf8");
|
|
32439
|
-
|
|
32543
|
+
fs11.renameSync(tempPath, statePath);
|
|
32440
32544
|
}
|
|
32441
32545
|
function writeRuntimeLogFailureState(projectRoot, options) {
|
|
32442
32546
|
const nowIso = new Date(options.nowMs()).toISOString();
|
|
@@ -32468,13 +32572,13 @@ function isNonRetryableRuntimeLogError(error2) {
|
|
|
32468
32572
|
);
|
|
32469
32573
|
}
|
|
32470
32574
|
function getRuntimeLogDir(projectRoot) {
|
|
32471
|
-
return
|
|
32575
|
+
return path12.join(projectRoot, ".maker", "logs", "runtime");
|
|
32472
32576
|
}
|
|
32473
32577
|
function getRuntimeLogStatePath(projectRoot) {
|
|
32474
|
-
return
|
|
32578
|
+
return path12.join(getRuntimeLogDir(projectRoot), "state.json");
|
|
32475
32579
|
}
|
|
32476
32580
|
function getRuntimeLogPath(projectRoot) {
|
|
32477
|
-
return
|
|
32581
|
+
return path12.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
|
|
32478
32582
|
}
|
|
32479
32583
|
function resolveNextRuntimeLogCursor(result) {
|
|
32480
32584
|
const maxLogTime = result.logs.reduce((max, log) => {
|
|
@@ -32599,11 +32703,13 @@ function compactRuntimeLogEntry(entry) {
|
|
|
32599
32703
|
}
|
|
32600
32704
|
|
|
32601
32705
|
// src/maker/server/proxyAssets.ts
|
|
32602
|
-
import
|
|
32603
|
-
import
|
|
32706
|
+
import fs12 from "node:fs";
|
|
32707
|
+
import path13 from "node:path";
|
|
32604
32708
|
var IMAGE_ASSET_DIRS = ["assets/image"];
|
|
32605
32709
|
var VIDEO_ASSET_DIRS = ["assets/video"];
|
|
32606
32710
|
var AUDIO_ASSET_DIRS = ["assets/audio"];
|
|
32711
|
+
var MODEL_ASSET_DIRS = ["assets/model"];
|
|
32712
|
+
var THREE_D_MODEL_VIEWS = ["front", "left", "back", "right"];
|
|
32607
32713
|
var IMAGE_REFERENCE_MAX_BYTES = 10 * 1024 * 1024;
|
|
32608
32714
|
var VIDEO_TASK_IMAGE_REFERENCE_MAX_BYTES = 30 * 1024 * 1024;
|
|
32609
32715
|
var VIDEO_REFERENCE_MAX_BYTES = 50 * 1024 * 1024;
|
|
@@ -32652,6 +32758,9 @@ function prepareRemoteProxyToolArgs(options) {
|
|
|
32652
32758
|
if (options.toolName === "create_video_task") {
|
|
32653
32759
|
return rewriteVideoReferenceAssetArgs(options.targetDir, options.args);
|
|
32654
32760
|
}
|
|
32761
|
+
if (options.toolName === "create_3d_model_task") {
|
|
32762
|
+
return rewrite3dModelAssetArgs(options.targetDir, options.args);
|
|
32763
|
+
}
|
|
32655
32764
|
return options.args;
|
|
32656
32765
|
}
|
|
32657
32766
|
async function materializeRemoteProxyToolAssets(options) {
|
|
@@ -32667,6 +32776,7 @@ async function materializeRemoteProxyToolAssets(options) {
|
|
|
32667
32776
|
}
|
|
32668
32777
|
let changed = false;
|
|
32669
32778
|
const nextContent = [];
|
|
32779
|
+
const structuredPayloads = [];
|
|
32670
32780
|
for (const item of content) {
|
|
32671
32781
|
if (!isTextContent(item)) {
|
|
32672
32782
|
nextContent.push(item);
|
|
@@ -32684,6 +32794,7 @@ async function materializeRemoteProxyToolAssets(options) {
|
|
|
32684
32794
|
now: options.now ?? /* @__PURE__ */ new Date(),
|
|
32685
32795
|
fetchImpl: options.fetchImpl ?? fetch
|
|
32686
32796
|
});
|
|
32797
|
+
structuredPayloads.push(nextParsed);
|
|
32687
32798
|
if (nextParsed === parsed) {
|
|
32688
32799
|
nextContent.push(item);
|
|
32689
32800
|
continue;
|
|
@@ -32694,6 +32805,14 @@ async function materializeRemoteProxyToolAssets(options) {
|
|
|
32694
32805
|
text: JSON.stringify(nextParsed, null, 2)
|
|
32695
32806
|
});
|
|
32696
32807
|
}
|
|
32808
|
+
const structuredContent = structuredPayloads.length === 1 ? structuredPayloads[0] : { results: structuredPayloads };
|
|
32809
|
+
if (structuredPayloads.length > 0) {
|
|
32810
|
+
return {
|
|
32811
|
+
...options.result,
|
|
32812
|
+
...changed ? { content: nextContent } : {},
|
|
32813
|
+
structuredContent
|
|
32814
|
+
};
|
|
32815
|
+
}
|
|
32697
32816
|
return changed ? { ...options.result, content: nextContent } : options.result;
|
|
32698
32817
|
}
|
|
32699
32818
|
function shouldMaterializeRemoteProxyTool(toolName) {
|
|
@@ -32703,7 +32822,9 @@ function shouldMaterializeRemoteProxyTool(toolName) {
|
|
|
32703
32822
|
"edit_image",
|
|
32704
32823
|
"create_video_task",
|
|
32705
32824
|
"query_video_task",
|
|
32706
|
-
"text_to_music"
|
|
32825
|
+
"text_to_music",
|
|
32826
|
+
"create_3d_model_task",
|
|
32827
|
+
"query_3d_model_task"
|
|
32707
32828
|
].includes(toolName);
|
|
32708
32829
|
}
|
|
32709
32830
|
function isTextContent(item) {
|
|
@@ -32749,6 +32870,9 @@ async function materializeParsedProxyResult(options) {
|
|
|
32749
32870
|
if (options.toolName === "text_to_music") {
|
|
32750
32871
|
return await materializeMusicResult(options);
|
|
32751
32872
|
}
|
|
32873
|
+
if (options.toolName === "create_3d_model_task" || options.toolName === "query_3d_model_task") {
|
|
32874
|
+
return await materialize3dModelResult(options, options.toolName);
|
|
32875
|
+
}
|
|
32752
32876
|
return options.payload;
|
|
32753
32877
|
}
|
|
32754
32878
|
async function materializeSingleImageResult(options, toolName) {
|
|
@@ -32864,13 +32988,13 @@ function findExistingMaterializedVideo(targetDir, options) {
|
|
|
32864
32988
|
function resolveExistingMaterializedAssetPath(targetDir, record2, localPath) {
|
|
32865
32989
|
const candidates = [];
|
|
32866
32990
|
const absolutePath = stringField2(record2.absolutePath);
|
|
32867
|
-
if (absolutePath &&
|
|
32991
|
+
if (absolutePath && path13.isAbsolute(absolutePath)) {
|
|
32868
32992
|
candidates.push(absolutePath);
|
|
32869
32993
|
}
|
|
32870
|
-
candidates.push(
|
|
32994
|
+
candidates.push(path13.join(targetDir, ...localPath.split("/")));
|
|
32871
32995
|
for (const candidate of candidates) {
|
|
32872
32996
|
try {
|
|
32873
|
-
if (
|
|
32997
|
+
if (fs12.statSync(candidate).isFile()) {
|
|
32874
32998
|
return candidate;
|
|
32875
32999
|
}
|
|
32876
33000
|
} catch {
|
|
@@ -32910,6 +33034,198 @@ async function materializeMusicResult(options) {
|
|
|
32910
33034
|
})
|
|
32911
33035
|
} : options.payload;
|
|
32912
33036
|
}
|
|
33037
|
+
async function materialize3dModelResult(options, toolName) {
|
|
33038
|
+
if (options.payload.phase === 1) {
|
|
33039
|
+
return await materialize3dPreviewResult(options);
|
|
33040
|
+
}
|
|
33041
|
+
return await materialize3dFinalResult(options, toolName);
|
|
33042
|
+
}
|
|
33043
|
+
async function materialize3dPreviewResult(options) {
|
|
33044
|
+
if (!isRecord(options.payload.preview_urls)) {
|
|
33045
|
+
return options.payload;
|
|
33046
|
+
}
|
|
33047
|
+
let changed = false;
|
|
33048
|
+
const previewAssets = {};
|
|
33049
|
+
const taskId = get3dTaskId(options.payload);
|
|
33050
|
+
const mode = stringField2(options.payload.mode);
|
|
33051
|
+
for (const view of THREE_D_MODEL_VIEWS) {
|
|
33052
|
+
const url2 = stringField2(options.payload.preview_urls[view]);
|
|
33053
|
+
const materialized = await materializeAsset({
|
|
33054
|
+
targetDir: options.targetDir,
|
|
33055
|
+
url: url2,
|
|
33056
|
+
baseName: `${taskId || "3d_model"}_${view}`,
|
|
33057
|
+
relativeDir: "assets/image",
|
|
33058
|
+
extension: extensionFromUrl(url2) || "png",
|
|
33059
|
+
now: options.now,
|
|
33060
|
+
fetchImpl: options.fetchImpl
|
|
33061
|
+
});
|
|
33062
|
+
if (!materialized) {
|
|
33063
|
+
continue;
|
|
33064
|
+
}
|
|
33065
|
+
changed = true;
|
|
33066
|
+
previewAssets[view] = { ...materialized, cdnUrl: url2 };
|
|
33067
|
+
if ("localPath" in materialized && url2) {
|
|
33068
|
+
upsertGeneratedAssetRecord(options.targetDir, materialized.localPath, {
|
|
33069
|
+
tool: "create_3d_model_task",
|
|
33070
|
+
name: `${taskId || "3d_model"}_${view}`,
|
|
33071
|
+
cdnUrl: url2,
|
|
33072
|
+
previewUrl: url2,
|
|
33073
|
+
localPath: materialized.localPath,
|
|
33074
|
+
absolutePath: materialized.absolutePath,
|
|
33075
|
+
createdAt: options.now.toISOString(),
|
|
33076
|
+
taskId,
|
|
33077
|
+
mode,
|
|
33078
|
+
phase: 1,
|
|
33079
|
+
view
|
|
33080
|
+
});
|
|
33081
|
+
}
|
|
33082
|
+
}
|
|
33083
|
+
return {
|
|
33084
|
+
...options.payload,
|
|
33085
|
+
...changed ? { preview_assets: previewAssets } : {},
|
|
33086
|
+
...create3dPreviewReviewGuidance()
|
|
33087
|
+
};
|
|
33088
|
+
}
|
|
33089
|
+
function create3dPreviewReviewGuidance() {
|
|
33090
|
+
return {
|
|
33091
|
+
workflow_state: "awaiting_user_review",
|
|
33092
|
+
user_review_required: true,
|
|
33093
|
+
next_action: "Show the four-view previews to the user and ask whether they approve them or want changes.",
|
|
33094
|
+
approval_next_step: "If the user approves, continue the original 3D model generation flow by calling create_3d_model_task again with the approved four-view images.",
|
|
33095
|
+
revision_next_step: "If the user requests changes, call create_3d_model_task again with the requested changes to regenerate the four-view previews before model generation.",
|
|
33096
|
+
agent_instruction: "Do not stop after phase 1. The 3D model is not complete until the user approves the four-view previews and final model generation finishes."
|
|
33097
|
+
};
|
|
33098
|
+
}
|
|
33099
|
+
async function materialize3dFinalResult(options, toolName) {
|
|
33100
|
+
if (options.payload.status !== "success") {
|
|
33101
|
+
return options.payload;
|
|
33102
|
+
}
|
|
33103
|
+
let changed = false;
|
|
33104
|
+
const nextPayload = { ...options.payload };
|
|
33105
|
+
const taskId = get3dTaskId(options.payload);
|
|
33106
|
+
const modelCdnUrl = stringField2(options.payload.model_cdn_url);
|
|
33107
|
+
const renderedImageUrl = stringField2(options.payload.rendered_image_url);
|
|
33108
|
+
const mdlConversionError = stringField2(options.payload.mdl_conversion_error);
|
|
33109
|
+
const modelMaterialized = await materializeAsset({
|
|
33110
|
+
targetDir: options.targetDir,
|
|
33111
|
+
url: modelCdnUrl,
|
|
33112
|
+
baseName: taskId || "3d_model",
|
|
33113
|
+
relativeDir: MODEL_ASSET_DIRS[0],
|
|
33114
|
+
extension: extensionFromUrl(modelCdnUrl) || "glb",
|
|
33115
|
+
now: options.now,
|
|
33116
|
+
fetchImpl: options.fetchImpl
|
|
33117
|
+
});
|
|
33118
|
+
if (modelMaterialized) {
|
|
33119
|
+
changed = true;
|
|
33120
|
+
nextPayload.modelDownload = modelMaterialized.download;
|
|
33121
|
+
if ("localPath" in modelMaterialized) {
|
|
33122
|
+
nextPayload.modelLocalPath = modelMaterialized.localPath;
|
|
33123
|
+
nextPayload.modelAbsolutePath = modelMaterialized.absolutePath;
|
|
33124
|
+
if (modelCdnUrl) {
|
|
33125
|
+
upsertGeneratedAssetRecord(options.targetDir, modelMaterialized.localPath, {
|
|
33126
|
+
tool: toolName,
|
|
33127
|
+
name: taskId,
|
|
33128
|
+
assetKind: "model",
|
|
33129
|
+
cdnUrl: modelCdnUrl,
|
|
33130
|
+
previewUrl: renderedImageUrl || modelCdnUrl,
|
|
33131
|
+
localPath: modelMaterialized.localPath,
|
|
33132
|
+
absolutePath: modelMaterialized.absolutePath,
|
|
33133
|
+
createdAt: options.now.toISOString(),
|
|
33134
|
+
taskId,
|
|
33135
|
+
modelCdnUrl,
|
|
33136
|
+
renderedImageUrl,
|
|
33137
|
+
mdlConversionError
|
|
33138
|
+
});
|
|
33139
|
+
}
|
|
33140
|
+
}
|
|
33141
|
+
}
|
|
33142
|
+
const mdlUrl = stringField2(options.payload.mdl_cdn_url);
|
|
33143
|
+
const mdlMaterialized = await materializeAsset({
|
|
33144
|
+
targetDir: options.targetDir,
|
|
33145
|
+
url: mdlUrl,
|
|
33146
|
+
baseName: taskId || "3d_model",
|
|
33147
|
+
relativeDir: MODEL_ASSET_DIRS[0],
|
|
33148
|
+
extension: extensionFromUrl(mdlUrl) || "zip",
|
|
33149
|
+
now: options.now,
|
|
33150
|
+
fetchImpl: options.fetchImpl
|
|
33151
|
+
});
|
|
33152
|
+
if (mdlMaterialized) {
|
|
33153
|
+
changed = true;
|
|
33154
|
+
nextPayload.mdlDownload = mdlMaterialized.download;
|
|
33155
|
+
if ("localPath" in mdlMaterialized) {
|
|
33156
|
+
nextPayload.mdlLocalPath = mdlMaterialized.localPath;
|
|
33157
|
+
nextPayload.mdlAbsolutePath = mdlMaterialized.absolutePath;
|
|
33158
|
+
let mdlExtractError;
|
|
33159
|
+
try {
|
|
33160
|
+
extractZip(
|
|
33161
|
+
mdlMaterialized.absolutePath,
|
|
33162
|
+
path13.join(options.targetDir, "assets"),
|
|
33163
|
+
"3D model asset"
|
|
33164
|
+
);
|
|
33165
|
+
nextPayload.mdlExtracted = true;
|
|
33166
|
+
nextPayload.mdlExtractedTo = "assets";
|
|
33167
|
+
} catch (error2) {
|
|
33168
|
+
mdlExtractError = `3D model asset extraction failed: ${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
33169
|
+
nextPayload.mdlExtracted = false;
|
|
33170
|
+
nextPayload.mdlExtractError = mdlExtractError;
|
|
33171
|
+
}
|
|
33172
|
+
if (mdlUrl) {
|
|
33173
|
+
upsertGeneratedAssetRecord(options.targetDir, mdlMaterialized.localPath, {
|
|
33174
|
+
tool: toolName,
|
|
33175
|
+
name: taskId,
|
|
33176
|
+
assetKind: "mdl_zip",
|
|
33177
|
+
cdnUrl: mdlUrl,
|
|
33178
|
+
previewUrl: renderedImageUrl || mdlUrl,
|
|
33179
|
+
localPath: mdlMaterialized.localPath,
|
|
33180
|
+
absolutePath: mdlMaterialized.absolutePath,
|
|
33181
|
+
createdAt: options.now.toISOString(),
|
|
33182
|
+
taskId,
|
|
33183
|
+
modelCdnUrl,
|
|
33184
|
+
renderedImageUrl,
|
|
33185
|
+
mdlConversionError,
|
|
33186
|
+
mdlExtractError
|
|
33187
|
+
});
|
|
33188
|
+
}
|
|
33189
|
+
}
|
|
33190
|
+
}
|
|
33191
|
+
const renderedImageMaterialized = await materializeAsset({
|
|
33192
|
+
targetDir: options.targetDir,
|
|
33193
|
+
url: renderedImageUrl,
|
|
33194
|
+
baseName: `${taskId || "3d_model"}_render`,
|
|
33195
|
+
relativeDir: "assets/image",
|
|
33196
|
+
extension: extensionFromUrl(renderedImageUrl) || "png",
|
|
33197
|
+
now: options.now,
|
|
33198
|
+
fetchImpl: options.fetchImpl
|
|
33199
|
+
});
|
|
33200
|
+
if (renderedImageMaterialized) {
|
|
33201
|
+
changed = true;
|
|
33202
|
+
nextPayload.renderedImageDownload = renderedImageMaterialized.download;
|
|
33203
|
+
if ("localPath" in renderedImageMaterialized) {
|
|
33204
|
+
nextPayload.renderedImageLocalPath = renderedImageMaterialized.localPath;
|
|
33205
|
+
nextPayload.renderedImageAbsolutePath = renderedImageMaterialized.absolutePath;
|
|
33206
|
+
if (renderedImageUrl) {
|
|
33207
|
+
upsertGeneratedAssetRecord(options.targetDir, renderedImageMaterialized.localPath, {
|
|
33208
|
+
tool: toolName,
|
|
33209
|
+
name: `${taskId || "3d_model"}_render`,
|
|
33210
|
+
assetKind: "render",
|
|
33211
|
+
cdnUrl: renderedImageUrl,
|
|
33212
|
+
previewUrl: renderedImageUrl,
|
|
33213
|
+
localPath: renderedImageMaterialized.localPath,
|
|
33214
|
+
absolutePath: renderedImageMaterialized.absolutePath,
|
|
33215
|
+
createdAt: options.now.toISOString(),
|
|
33216
|
+
taskId,
|
|
33217
|
+
modelCdnUrl,
|
|
33218
|
+
renderedImageUrl,
|
|
33219
|
+
mdlConversionError
|
|
33220
|
+
});
|
|
33221
|
+
}
|
|
33222
|
+
}
|
|
33223
|
+
}
|
|
33224
|
+
return changed ? nextPayload : options.payload;
|
|
33225
|
+
}
|
|
33226
|
+
function get3dTaskId(payload) {
|
|
33227
|
+
return stringField2(payload.task_id) || stringField2(payload.taskId);
|
|
33228
|
+
}
|
|
32913
33229
|
function persistMaterializedAsset(options) {
|
|
32914
33230
|
const nextPayload = { ...options.payload, ...options.materialized };
|
|
32915
33231
|
if (!("localPath" in options.materialized) || !options.cdnUrl) {
|
|
@@ -32950,8 +33266,8 @@ async function materializeAsset(options) {
|
|
|
32950
33266
|
};
|
|
32951
33267
|
}
|
|
32952
33268
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
32953
|
-
|
|
32954
|
-
|
|
33269
|
+
fs12.mkdirSync(path13.dirname(absolutePath), { recursive: true });
|
|
33270
|
+
fs12.writeFileSync(absolutePath, bytes);
|
|
32955
33271
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
32956
33272
|
} catch (error2) {
|
|
32957
33273
|
return {
|
|
@@ -32965,12 +33281,12 @@ async function materializeAsset(options) {
|
|
|
32965
33281
|
function createUniqueAssetPath(options) {
|
|
32966
33282
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
32967
33283
|
for (let index = 1; index <= 9999; index += 1) {
|
|
32968
|
-
const relativePath =
|
|
33284
|
+
const relativePath = path13.posix.join(
|
|
32969
33285
|
options.relativeDir,
|
|
32970
33286
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
32971
33287
|
);
|
|
32972
|
-
const absolutePath =
|
|
32973
|
-
if (!
|
|
33288
|
+
const absolutePath = path13.join(options.targetDir, ...relativePath.split("/"));
|
|
33289
|
+
if (!fs12.existsSync(absolutePath)) {
|
|
32974
33290
|
return { relativePath, absolutePath };
|
|
32975
33291
|
}
|
|
32976
33292
|
}
|
|
@@ -33049,6 +33365,50 @@ function rewriteVideoReferenceAssetArgs(targetDir, args) {
|
|
|
33049
33365
|
})
|
|
33050
33366
|
};
|
|
33051
33367
|
}
|
|
33368
|
+
function rewrite3dModelAssetArgs(targetDir, args) {
|
|
33369
|
+
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
33370
|
+
const imageOptions = {
|
|
33371
|
+
assetDirs: IMAGE_ASSET_DIRS,
|
|
33372
|
+
mediaKind: "image",
|
|
33373
|
+
maxBytes: IMAGE_REFERENCE_MAX_BYTES
|
|
33374
|
+
};
|
|
33375
|
+
return {
|
|
33376
|
+
...args,
|
|
33377
|
+
image: rewriteGeneratedAssetReference(targetDir, args.image, registry2, imageOptions),
|
|
33378
|
+
front_image: rewriteGeneratedAssetReference(
|
|
33379
|
+
targetDir,
|
|
33380
|
+
args.front_image,
|
|
33381
|
+
registry2,
|
|
33382
|
+
imageOptions
|
|
33383
|
+
),
|
|
33384
|
+
left_image: rewriteGeneratedAssetReference(targetDir, args.left_image, registry2, imageOptions),
|
|
33385
|
+
back_image: rewriteGeneratedAssetReference(targetDir, args.back_image, registry2, imageOptions),
|
|
33386
|
+
right_image: rewriteGeneratedAssetReference(
|
|
33387
|
+
targetDir,
|
|
33388
|
+
args.right_image,
|
|
33389
|
+
registry2,
|
|
33390
|
+
imageOptions
|
|
33391
|
+
),
|
|
33392
|
+
confirmed_image_paths: rewrite3dConfirmedImagePaths(
|
|
33393
|
+
targetDir,
|
|
33394
|
+
args.confirmed_image_paths,
|
|
33395
|
+
registry2,
|
|
33396
|
+
imageOptions
|
|
33397
|
+
)
|
|
33398
|
+
};
|
|
33399
|
+
}
|
|
33400
|
+
function rewrite3dConfirmedImagePaths(targetDir, value, registry2, options) {
|
|
33401
|
+
if (!isRecord(value)) {
|
|
33402
|
+
return value;
|
|
33403
|
+
}
|
|
33404
|
+
return {
|
|
33405
|
+
...value,
|
|
33406
|
+
front: rewriteGeneratedAssetReference(targetDir, value.front, registry2, options),
|
|
33407
|
+
left: rewriteGeneratedAssetReference(targetDir, value.left, registry2, options),
|
|
33408
|
+
back: rewriteGeneratedAssetReference(targetDir, value.back, registry2, options),
|
|
33409
|
+
right: rewriteGeneratedAssetReference(targetDir, value.right, registry2, options)
|
|
33410
|
+
};
|
|
33411
|
+
}
|
|
33052
33412
|
function rewriteUrlObjectArray(targetDir, value, registry2, options) {
|
|
33053
33413
|
if (!Array.isArray(value)) {
|
|
33054
33414
|
return value;
|
|
@@ -33104,7 +33464,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
33104
33464
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
33105
33465
|
return false;
|
|
33106
33466
|
}
|
|
33107
|
-
const basename =
|
|
33467
|
+
const basename = path13.posix.basename(localPath);
|
|
33108
33468
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
33109
33469
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
33110
33470
|
});
|
|
@@ -33117,13 +33477,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
33117
33477
|
}
|
|
33118
33478
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
33119
33479
|
var _a3;
|
|
33120
|
-
const hasExtension = Boolean(
|
|
33480
|
+
const hasExtension = Boolean(path13.extname(value));
|
|
33121
33481
|
const candidates = [];
|
|
33122
33482
|
for (const assetDir of assetDirs) {
|
|
33123
|
-
const absoluteDir =
|
|
33483
|
+
const absoluteDir = path13.join(targetDir, ...assetDir.split("/"));
|
|
33124
33484
|
let entries;
|
|
33125
33485
|
try {
|
|
33126
|
-
entries =
|
|
33486
|
+
entries = fs12.readdirSync(absoluteDir);
|
|
33127
33487
|
} catch {
|
|
33128
33488
|
continue;
|
|
33129
33489
|
}
|
|
@@ -33132,11 +33492,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
33132
33492
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
33133
33493
|
continue;
|
|
33134
33494
|
}
|
|
33135
|
-
const absolutePath =
|
|
33495
|
+
const absolutePath = path13.join(absoluteDir, entry);
|
|
33136
33496
|
try {
|
|
33137
33497
|
candidates.push({
|
|
33138
|
-
localPath:
|
|
33139
|
-
mtimeMs:
|
|
33498
|
+
localPath: path13.posix.join(assetDir, entry),
|
|
33499
|
+
mtimeMs: fs12.statSync(absolutePath).mtimeMs
|
|
33140
33500
|
});
|
|
33141
33501
|
} catch {
|
|
33142
33502
|
}
|
|
@@ -33146,7 +33506,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
33146
33506
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
33147
33507
|
}
|
|
33148
33508
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
33149
|
-
if (relativePath.startsWith("../") ||
|
|
33509
|
+
if (relativePath.startsWith("../") || path13.isAbsolute(relativePath)) {
|
|
33150
33510
|
return false;
|
|
33151
33511
|
}
|
|
33152
33512
|
return assetDirs.some(
|
|
@@ -33170,14 +33530,14 @@ function localAssetReferenceToDataUrl(options) {
|
|
|
33170
33530
|
}
|
|
33171
33531
|
let stat;
|
|
33172
33532
|
try {
|
|
33173
|
-
stat =
|
|
33533
|
+
stat = fs12.statSync(absolutePath);
|
|
33174
33534
|
} catch {
|
|
33175
33535
|
return void 0;
|
|
33176
33536
|
}
|
|
33177
33537
|
if (!stat.isFile() || stat.size > options.maxBytes) {
|
|
33178
33538
|
return void 0;
|
|
33179
33539
|
}
|
|
33180
|
-
const bytes =
|
|
33540
|
+
const bytes = fs12.readFileSync(absolutePath);
|
|
33181
33541
|
return `data:${mime};base64,${bytes.toString("base64")}`;
|
|
33182
33542
|
}
|
|
33183
33543
|
function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
@@ -33188,7 +33548,7 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
33188
33548
|
candidates.push(localPath);
|
|
33189
33549
|
}
|
|
33190
33550
|
}
|
|
33191
|
-
if (
|
|
33551
|
+
if (path13.isAbsolute(options.value)) {
|
|
33192
33552
|
candidates.push(options.value);
|
|
33193
33553
|
} else {
|
|
33194
33554
|
const localPath = resolveProjectRelativePath(targetDir, options.value);
|
|
@@ -33197,54 +33557,54 @@ function resolveLocalAssetAbsolutePath(targetDir, options) {
|
|
|
33197
33557
|
}
|
|
33198
33558
|
}
|
|
33199
33559
|
for (const candidate of candidates) {
|
|
33200
|
-
if (
|
|
33560
|
+
if (fs12.existsSync(candidate)) {
|
|
33201
33561
|
return candidate;
|
|
33202
33562
|
}
|
|
33203
33563
|
}
|
|
33204
33564
|
return void 0;
|
|
33205
33565
|
}
|
|
33206
33566
|
function resolveProjectRelativePath(targetDir, value) {
|
|
33207
|
-
const root =
|
|
33208
|
-
const absolutePath =
|
|
33209
|
-
const relativePath =
|
|
33210
|
-
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${
|
|
33567
|
+
const root = path13.resolve(targetDir);
|
|
33568
|
+
const absolutePath = path13.resolve(root, value);
|
|
33569
|
+
const relativePath = path13.relative(root, absolutePath);
|
|
33570
|
+
const escapesRoot = relativePath === ".." || relativePath.startsWith(`..${path13.sep}`) || path13.isAbsolute(relativePath);
|
|
33211
33571
|
if (!escapesRoot) {
|
|
33212
33572
|
return absolutePath;
|
|
33213
33573
|
}
|
|
33214
33574
|
return void 0;
|
|
33215
33575
|
}
|
|
33216
33576
|
function dataUrlMimeForPath(filePath, mediaKind) {
|
|
33217
|
-
return DATA_URL_MIME_BY_EXTENSION[mediaKind][
|
|
33577
|
+
return DATA_URL_MIME_BY_EXTENSION[mediaKind][path13.extname(filePath).toLowerCase()];
|
|
33218
33578
|
}
|
|
33219
33579
|
function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
33220
33580
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
33221
33581
|
registry2[localPath] = record2;
|
|
33222
33582
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
33223
|
-
|
|
33224
|
-
|
|
33583
|
+
fs12.mkdirSync(path13.dirname(registryPath), { recursive: true });
|
|
33584
|
+
fs12.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
33225
33585
|
`, "utf8");
|
|
33226
33586
|
}
|
|
33227
33587
|
function readGeneratedAssetRegistry(targetDir) {
|
|
33228
33588
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
33229
|
-
if (!
|
|
33589
|
+
if (!fs12.existsSync(registryPath)) {
|
|
33230
33590
|
return {};
|
|
33231
33591
|
}
|
|
33232
33592
|
try {
|
|
33233
|
-
const parsed = JSON.parse(
|
|
33593
|
+
const parsed = JSON.parse(fs12.readFileSync(registryPath, "utf8"));
|
|
33234
33594
|
return isRecord(parsed) ? parsed : {};
|
|
33235
33595
|
} catch {
|
|
33236
33596
|
return {};
|
|
33237
33597
|
}
|
|
33238
33598
|
}
|
|
33239
33599
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
33240
|
-
return
|
|
33600
|
+
return path13.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
33241
33601
|
}
|
|
33242
33602
|
function normalizeAssetRegistryKey(targetDir, value) {
|
|
33243
33603
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
33244
33604
|
return void 0;
|
|
33245
33605
|
}
|
|
33246
|
-
const relative =
|
|
33247
|
-
return relative.split(
|
|
33606
|
+
const relative = path13.isAbsolute(value) ? path13.relative(targetDir, value) : value;
|
|
33607
|
+
return relative.split(path13.sep).join("/");
|
|
33248
33608
|
}
|
|
33249
33609
|
function isRecord(value) {
|
|
33250
33610
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -33273,7 +33633,7 @@ function extensionFromUrl(url2) {
|
|
|
33273
33633
|
}
|
|
33274
33634
|
try {
|
|
33275
33635
|
const pathname = new URL(url2).pathname;
|
|
33276
|
-
const extension =
|
|
33636
|
+
const extension = path13.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
33277
33637
|
return extension || void 0;
|
|
33278
33638
|
} catch {
|
|
33279
33639
|
return void 0;
|
|
@@ -33281,9 +33641,8 @@ function extensionFromUrl(url2) {
|
|
|
33281
33641
|
}
|
|
33282
33642
|
|
|
33283
33643
|
// src/maker/server/mcp.ts
|
|
33284
|
-
var VERSION = true ? "0.0.
|
|
33644
|
+
var VERSION = true ? "0.0.19" : "dev";
|
|
33285
33645
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
33286
|
-
var REMOTE_PROXY_FORWARD_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
33287
33646
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
33288
33647
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
33289
33648
|
var PREVIEW_REFRESH_TIMEOUT_MS = 15 * 1e3;
|
|
@@ -33296,7 +33655,9 @@ var MAKER_REMOTE_PROXY_EXPOSED_TOOL_NAMES = [
|
|
|
33296
33655
|
"edit_image",
|
|
33297
33656
|
"create_video_task",
|
|
33298
33657
|
"query_video_task",
|
|
33299
|
-
"text_to_music"
|
|
33658
|
+
"text_to_music",
|
|
33659
|
+
"create_3d_model_task",
|
|
33660
|
+
"query_3d_model_task"
|
|
33300
33661
|
];
|
|
33301
33662
|
var MakerCloneFailedError = class extends Error {
|
|
33302
33663
|
constructor(targetDir, originalError) {
|
|
@@ -33310,7 +33671,7 @@ var MakerCloneFailedError = class extends Error {
|
|
|
33310
33671
|
var tools = [
|
|
33311
33672
|
{
|
|
33312
33673
|
name: "maker_status_lite",
|
|
33313
|
-
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, supported local path/remote URL/data URL
|
|
33674
|
+
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, supported local path/remote URL/data URL inputs, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init. If the user explicitly asks to create a project/game in an unbound directory, prioritize taptap-maker init --create over same-name app matching.",
|
|
33314
33675
|
inputSchema: {
|
|
33315
33676
|
type: "object",
|
|
33316
33677
|
properties: {
|
|
@@ -33389,7 +33750,7 @@ var resources = [
|
|
|
33389
33750
|
{
|
|
33390
33751
|
uri: "maker://status",
|
|
33391
33752
|
name: "Maker status",
|
|
33392
|
-
description: "Local TapTap Maker project status, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.",
|
|
33753
|
+
description: "Local TapTap Maker project status, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init. If the user explicitly asks to create a project/game in an unbound directory, prioritize taptap-maker init --create over same-name app matching.",
|
|
33393
33754
|
mimeType: "text/plain"
|
|
33394
33755
|
}
|
|
33395
33756
|
];
|
|
@@ -33537,9 +33898,7 @@ async function callRemoteProxyTool(options) {
|
|
|
33537
33898
|
},
|
|
33538
33899
|
void 0,
|
|
33539
33900
|
{
|
|
33540
|
-
|
|
33541
|
-
resetTimeoutOnProgress: true,
|
|
33542
|
-
onprogress: createRemoteProxyProgressHandler(options.progressToken, options.extra)
|
|
33901
|
+
...createRemoteProxyCallToolOptions(options.progressToken, options.extra)
|
|
33543
33902
|
}
|
|
33544
33903
|
);
|
|
33545
33904
|
} finally {
|
|
@@ -33581,6 +33940,11 @@ function createRemoteProxyProgressHandler(progressToken, extra) {
|
|
|
33581
33940
|
});
|
|
33582
33941
|
};
|
|
33583
33942
|
}
|
|
33943
|
+
function createRemoteProxyCallToolOptions(progressToken, extra) {
|
|
33944
|
+
return {
|
|
33945
|
+
onprogress: createRemoteProxyProgressHandler(progressToken, extra)
|
|
33946
|
+
};
|
|
33947
|
+
}
|
|
33584
33948
|
async function startMakerMcpServer() {
|
|
33585
33949
|
const server = new Server(
|
|
33586
33950
|
{
|
|
@@ -33733,7 +34097,7 @@ async function formatStatus(options = {}) {
|
|
|
33733
34097
|
const env = getMakerEnvironment(void 0, targetDir);
|
|
33734
34098
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
33735
34099
|
const mcpCwd = process.cwd();
|
|
33736
|
-
const mcpCwdIdentify =
|
|
34100
|
+
const mcpCwdIdentify = path14.resolve(mcpCwd) === path14.resolve(targetDir) ? identify : identifyMakerProject({ cwd: mcpCwd });
|
|
33737
34101
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
33738
34102
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
33739
34103
|
const pat = loadPat();
|
|
@@ -33802,6 +34166,8 @@ async function formatStatus(options = {}) {
|
|
|
33802
34166
|
"",
|
|
33803
34167
|
tapAuthRefreshText,
|
|
33804
34168
|
"",
|
|
34169
|
+
identify.projectRoot ? formatMakerAgentsPolicyStatus(identify.projectRoot) : "",
|
|
34170
|
+
"",
|
|
33805
34171
|
identify.projectRoot ? await formatAiDevKitStatus(identify.projectRoot, {
|
|
33806
34172
|
environment: env,
|
|
33807
34173
|
skipVersionCheck: options.skipRemoteSync
|
|
@@ -33853,10 +34219,10 @@ function formatMakerToolRegistrationCwdStatus(options) {
|
|
|
33853
34219
|
if (!options.projectRoot) {
|
|
33854
34220
|
return "";
|
|
33855
34221
|
}
|
|
33856
|
-
const mcpCwd =
|
|
33857
|
-
const targetDir =
|
|
33858
|
-
const projectRoot =
|
|
33859
|
-
const mcpProjectRoot = options.mcpProjectRoot ?
|
|
34222
|
+
const mcpCwd = path14.resolve(options.mcpCwd);
|
|
34223
|
+
const targetDir = path14.resolve(options.targetDir);
|
|
34224
|
+
const projectRoot = path14.resolve(options.projectRoot);
|
|
34225
|
+
const mcpProjectRoot = options.mcpProjectRoot ? path14.resolve(options.mcpProjectRoot) : void 0;
|
|
33860
34226
|
if (mcpProjectRoot === projectRoot) {
|
|
33861
34227
|
return "";
|
|
33862
34228
|
}
|
|
@@ -34018,7 +34384,7 @@ function formatAiDialogueDirectoryHint(targetDir) {
|
|
|
34018
34384
|
}
|
|
34019
34385
|
function resolveMakerToolTargetDir(targetDir) {
|
|
34020
34386
|
if (targetDir) {
|
|
34021
|
-
return
|
|
34387
|
+
return path14.resolve(targetDir);
|
|
34022
34388
|
}
|
|
34023
34389
|
return process.cwd();
|
|
34024
34390
|
}
|
|
@@ -34060,8 +34426,10 @@ async function formatAutoProjectListFromPat() {
|
|
|
34060
34426
|
const projects = await listMakerProjects();
|
|
34061
34427
|
return [
|
|
34062
34428
|
"本地已有 Maker PAT,当前目录尚未绑定 Maker 项目。",
|
|
34429
|
+
"绑定项目时必须先提醒用户:0,创建新项目 / 0. Create a new Maker project。",
|
|
34430
|
+
"即使发现和当前目录同名的 Maker app,也不能只推荐同名 app;必须同时展示创建新项目选项。",
|
|
34063
34431
|
"当前目录未绑定时,先展示下面的 Maker Apps 预览和总数;选择、解释和 clone 顺序请参考 taptap-maker-local workflow guide document。",
|
|
34064
|
-
"用户选择 app 后,next_step: 执行 `taptap-maker init`。",
|
|
34432
|
+
"用户选择 0/new 或已有 app 后,next_step: 执行 `taptap-maker init`。",
|
|
34065
34433
|
"",
|
|
34066
34434
|
formatStatusProjectList(projects)
|
|
34067
34435
|
].join("\n");
|
|
@@ -34093,7 +34461,8 @@ function formatStatusProjectList(projects) {
|
|
|
34093
34461
|
return [
|
|
34094
34462
|
"No Maker apps found.",
|
|
34095
34463
|
"",
|
|
34096
|
-
"
|
|
34464
|
+
"0,创建新项目 / 0. Create a new Maker project",
|
|
34465
|
+
"当前账号没有可展示的 Maker app。用户要开始新项目时,直接引导其执行 `taptap-maker init`,并在交互中选择 `0`/`new` 创建项目。"
|
|
34097
34466
|
].join("\n");
|
|
34098
34467
|
}
|
|
34099
34468
|
const visibleProjects = sortStatusProjectsByRecentActivity(projects).slice(
|
|
@@ -34106,6 +34475,8 @@ function formatStatusProjectList(projects) {
|
|
|
34106
34475
|
"",
|
|
34107
34476
|
hiddenCount > 0 ? `为了保持友好的可读性,默认最多展示 ${visibleProjects.length} 个 app;如需完整列表,可以选择显示全部。` : "已显示全部 app;请询问用户选择。",
|
|
34108
34477
|
hiddenCount > 0 ? "如需完整列表,请运行 taptap-maker apps --json 查看全部 app。" : void 0,
|
|
34478
|
+
"0,创建新项目 / 0. Create a new Maker project",
|
|
34479
|
+
"AI 必须把上面这一行作为可选项展示给用户;即使压缩 app 列表,也不要删除创建项目入口。",
|
|
34109
34480
|
"AI 展示建议:如果聊天或客户端宽度足够,可把 app 预览整理成两列紧凑布局;每个 app 保留序号、app_id、名称,以及可用的最近活跃时间或 user_id。窄屏保持单列。选择 app 前先获取用户确认。",
|
|
34110
34481
|
"",
|
|
34111
34482
|
...visibleProjects.map(
|
|
@@ -34118,14 +34489,14 @@ function formatStatusProjectList(projects) {
|
|
|
34118
34489
|
].filter((line) => line !== void 0).join("\n");
|
|
34119
34490
|
}
|
|
34120
34491
|
function formatClonePartialStateLines(targetDir) {
|
|
34121
|
-
const resolvedTargetDir =
|
|
34492
|
+
const resolvedTargetDir = path14.resolve(targetDir);
|
|
34122
34493
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
34123
34494
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
34124
34495
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
34125
|
-
const stagedDevKitGitignorePath =
|
|
34496
|
+
const stagedDevKitGitignorePath = path14.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
34126
34497
|
const projectBound = Boolean(identify.projectId);
|
|
34127
34498
|
const gitInitialized = Boolean(
|
|
34128
|
-
gitStatus.isOwnGitRoot ||
|
|
34499
|
+
gitStatus.isOwnGitRoot || fs13.existsSync(path14.join(resolvedTargetDir, ".git"))
|
|
34129
34500
|
);
|
|
34130
34501
|
const safeToRetry = !projectBound;
|
|
34131
34502
|
return [
|
|
@@ -34139,7 +34510,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
34139
34510
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
34140
34511
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
34141
34512
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
34142
|
-
`- staged_dev_kit_gitignore: ${
|
|
34513
|
+
`- staged_dev_kit_gitignore: ${fs13.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
34143
34514
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
34144
34515
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
34145
34516
|
].filter(Boolean);
|
|
@@ -34208,15 +34579,27 @@ function createRemoteProxyContext(options) {
|
|
|
34208
34579
|
};
|
|
34209
34580
|
}
|
|
34210
34581
|
function resolveEmbeddedProxyCommand(options) {
|
|
34211
|
-
const
|
|
34582
|
+
const currentEntry = process.argv[1];
|
|
34583
|
+
const makerEntry = (options == null ? void 0 : options.makerEntry) || (isUsableEmbeddedMakerEntry(currentEntry) ? currentEntry : void 0) || resolveBundledMakerEntry();
|
|
34212
34584
|
if (!makerEntry) {
|
|
34213
34585
|
throw new Error("Cannot resolve current taptap-maker entry for embedded MCP proxy.");
|
|
34214
34586
|
}
|
|
34215
34587
|
return {
|
|
34216
34588
|
command: process.execPath,
|
|
34217
|
-
args: [
|
|
34589
|
+
args: [path14.resolve(makerEntry), "__maker-proxy"]
|
|
34218
34590
|
};
|
|
34219
34591
|
}
|
|
34592
|
+
function resolveBundledMakerEntry() {
|
|
34593
|
+
const bundledEntry = path14.resolve(__dirname, "../../../bin/taptap-maker");
|
|
34594
|
+
return fs13.existsSync(bundledEntry) ? bundledEntry : void 0;
|
|
34595
|
+
}
|
|
34596
|
+
function isUsableEmbeddedMakerEntry(entry) {
|
|
34597
|
+
if (!entry) {
|
|
34598
|
+
return false;
|
|
34599
|
+
}
|
|
34600
|
+
const normalized = entry.replace(/\\/g, "/");
|
|
34601
|
+
return /(?:^|\/)(?:taptap-maker(?:\.cmd)?|maker\.(?:c|m)?js)$/.test(normalized);
|
|
34602
|
+
}
|
|
34220
34603
|
function createToolProgressReporter(progressToken, extra, operationName) {
|
|
34221
34604
|
var _a3;
|
|
34222
34605
|
const startedAt = Date.now();
|
|
@@ -34555,18 +34938,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
34555
34938
|
}
|
|
34556
34939
|
}
|
|
34557
34940
|
async function startRuntimeLogWatch(buildResult) {
|
|
34558
|
-
const runtimeDir =
|
|
34559
|
-
|
|
34560
|
-
const stdoutLog =
|
|
34561
|
-
const stderrLog =
|
|
34562
|
-
const pidFile =
|
|
34941
|
+
const runtimeDir = path14.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
34942
|
+
fs13.mkdirSync(runtimeDir, { recursive: true });
|
|
34943
|
+
const stdoutLog = path14.join(runtimeDir, "watcher.out.log");
|
|
34944
|
+
const stderrLog = path14.join(runtimeDir, "watcher.err.log");
|
|
34945
|
+
const pidFile = path14.join(runtimeDir, "watcher.pid");
|
|
34563
34946
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
34564
|
-
const outFd =
|
|
34565
|
-
const errFd =
|
|
34947
|
+
const outFd = fs13.openSync(stdoutLog, "a");
|
|
34948
|
+
const errFd = fs13.openSync(stderrLog, "a");
|
|
34566
34949
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
34567
34950
|
if (previous.previousStopError) {
|
|
34568
|
-
|
|
34569
|
-
|
|
34951
|
+
fs13.closeSync(outFd);
|
|
34952
|
+
fs13.closeSync(errFd);
|
|
34570
34953
|
return {
|
|
34571
34954
|
started: false,
|
|
34572
34955
|
command: command.text,
|
|
@@ -34629,18 +35012,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
34629
35012
|
...previous
|
|
34630
35013
|
};
|
|
34631
35014
|
} finally {
|
|
34632
|
-
|
|
34633
|
-
|
|
35015
|
+
fs13.closeSync(outFd);
|
|
35016
|
+
fs13.closeSync(errFd);
|
|
34634
35017
|
}
|
|
34635
35018
|
}
|
|
34636
35019
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
34637
|
-
if (!
|
|
35020
|
+
if (!fs13.existsSync(pidFile)) {
|
|
34638
35021
|
return {};
|
|
34639
35022
|
}
|
|
34640
35023
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
34641
35024
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
34642
35025
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
34643
|
-
|
|
35026
|
+
fs13.rmSync(pidFile, { force: true });
|
|
34644
35027
|
return {};
|
|
34645
35028
|
}
|
|
34646
35029
|
try {
|
|
@@ -34648,7 +35031,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
34648
35031
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
34649
35032
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
34650
35033
|
if (!verifiedCommand) {
|
|
34651
|
-
|
|
35034
|
+
fs13.rmSync(pidFile, { force: true });
|
|
34652
35035
|
return {
|
|
34653
35036
|
previousPid: pid,
|
|
34654
35037
|
previousStopped: false,
|
|
@@ -34658,7 +35041,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
34658
35041
|
process.kill(pid, "SIGTERM");
|
|
34659
35042
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
34660
35043
|
if (stopped) {
|
|
34661
|
-
|
|
35044
|
+
fs13.rmSync(pidFile, { force: true });
|
|
34662
35045
|
return { previousPid: pid, previousStopped: true };
|
|
34663
35046
|
}
|
|
34664
35047
|
return {
|
|
@@ -34667,7 +35050,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
34667
35050
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
34668
35051
|
};
|
|
34669
35052
|
} catch (error2) {
|
|
34670
|
-
|
|
35053
|
+
fs13.rmSync(pidFile, { force: true });
|
|
34671
35054
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
34672
35055
|
if (code === "ESRCH") {
|
|
34673
35056
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -34680,7 +35063,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
34680
35063
|
}
|
|
34681
35064
|
}
|
|
34682
35065
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
34683
|
-
const raw =
|
|
35066
|
+
const raw = fs13.readFileSync(pidFile, "utf8").trim();
|
|
34684
35067
|
if (!raw) {
|
|
34685
35068
|
return null;
|
|
34686
35069
|
}
|
|
@@ -34696,7 +35079,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
34696
35079
|
}
|
|
34697
35080
|
}
|
|
34698
35081
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
34699
|
-
|
|
35082
|
+
fs13.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
34700
35083
|
`, "utf8");
|
|
34701
35084
|
}
|
|
34702
35085
|
function getProcessCommand(pid) {
|
|
@@ -34782,10 +35165,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
34782
35165
|
};
|
|
34783
35166
|
}
|
|
34784
35167
|
function resolveMakerCliEntry() {
|
|
34785
|
-
return process.argv[1] ||
|
|
35168
|
+
return process.argv[1] || path14.resolve(process.cwd(), "dist", "maker.js");
|
|
34786
35169
|
}
|
|
34787
35170
|
function getRuntimeLogFilePath(projectRoot) {
|
|
34788
|
-
return
|
|
35171
|
+
return path14.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
34789
35172
|
}
|
|
34790
35173
|
async function refreshMakerPreview(buildResult) {
|
|
34791
35174
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -34918,7 +35301,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
34918
35301
|
if (options.scriptsPath) {
|
|
34919
35302
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
34920
35303
|
}
|
|
34921
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
35304
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs13.existsSync(path14.join(projectRoot, "scripts", "main.lua"))) {
|
|
34922
35305
|
buildArgs.entry = "main.lua";
|
|
34923
35306
|
buildArgs.scriptsPath = "scripts";
|
|
34924
35307
|
}
|
|
@@ -34930,7 +35313,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
34930
35313
|
}
|
|
34931
35314
|
if (options.multiplayer) {
|
|
34932
35315
|
buildArgs.multiplayer = options.multiplayer;
|
|
34933
|
-
} else if (!
|
|
35316
|
+
} else if (!fs13.existsSync(path14.join(projectRoot, ".project", "settings.json"))) {
|
|
34934
35317
|
buildArgs.multiplayer = { enabled: false };
|
|
34935
35318
|
}
|
|
34936
35319
|
return buildArgs;
|
|
@@ -35105,11 +35488,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
35105
35488
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
35106
35489
|
`- watch_command: ${command}`,
|
|
35107
35490
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
35108
|
-
`- local_file: ${
|
|
35491
|
+
`- local_file: ${path14.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
35109
35492
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
35110
35493
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
35111
35494
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
35112
|
-
`- state_file: ${
|
|
35495
|
+
`- state_file: ${path14.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
35113
35496
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
35114
35497
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
35115
35498
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -35286,20 +35669,20 @@ function indent2(value) {
|
|
|
35286
35669
|
|
|
35287
35670
|
// src/maker/cli/commands.ts
|
|
35288
35671
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
35289
|
-
import
|
|
35290
|
-
import
|
|
35672
|
+
import crypto3 from "node:crypto";
|
|
35673
|
+
import fs14 from "node:fs";
|
|
35291
35674
|
import os4 from "node:os";
|
|
35292
|
-
import
|
|
35675
|
+
import path15 from "node:path";
|
|
35293
35676
|
import readline from "node:readline/promises";
|
|
35294
35677
|
import { stdin as input, stdout as output } from "node:process";
|
|
35295
35678
|
|
|
35296
35679
|
// src/maker/auth/cliLogin.ts
|
|
35297
35680
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
35298
|
-
import
|
|
35681
|
+
import crypto2 from "node:crypto";
|
|
35299
35682
|
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
35300
35683
|
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
35301
35684
|
function createCliLoginCode() {
|
|
35302
|
-
return
|
|
35685
|
+
return crypto2.randomBytes(24).toString("base64url");
|
|
35303
35686
|
}
|
|
35304
35687
|
function getMakerCliLoginUrl(code, env) {
|
|
35305
35688
|
const url2 = new URL("/pat-tokens", getMakerWebUrl(env));
|
|
@@ -35437,7 +35820,7 @@ function formatError2(error2) {
|
|
|
35437
35820
|
// src/maker/cli/commands.ts
|
|
35438
35821
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
35439
35822
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
35440
|
-
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp"]);
|
|
35823
|
+
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
35441
35824
|
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
35442
35825
|
"json",
|
|
35443
35826
|
"skip_confirm",
|
|
@@ -35446,6 +35829,7 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
35446
35829
|
"pat_from_stdin",
|
|
35447
35830
|
"reset",
|
|
35448
35831
|
"all",
|
|
35832
|
+
"create",
|
|
35449
35833
|
"h",
|
|
35450
35834
|
"help"
|
|
35451
35835
|
]);
|
|
@@ -35495,6 +35879,14 @@ async function runMakerCli(argv) {
|
|
|
35495
35879
|
await runMcpVerify(parsed, ctx);
|
|
35496
35880
|
return;
|
|
35497
35881
|
}
|
|
35882
|
+
if (command === "agents" && subcommand === "update") {
|
|
35883
|
+
await runAgentsUpdate(parsed, ctx);
|
|
35884
|
+
return;
|
|
35885
|
+
}
|
|
35886
|
+
if (command === "upgrade") {
|
|
35887
|
+
await runUpgrade(parsed, ctx);
|
|
35888
|
+
return;
|
|
35889
|
+
}
|
|
35498
35890
|
if (command === "dev-kit" && subcommand === "update") {
|
|
35499
35891
|
await runDevKitUpdate(parsed, ctx);
|
|
35500
35892
|
return;
|
|
@@ -35560,7 +35952,7 @@ function toOptionKey(value) {
|
|
|
35560
35952
|
}
|
|
35561
35953
|
async function runInit(parsed, ctx) {
|
|
35562
35954
|
rejectPackageOption(parsed);
|
|
35563
|
-
const targetDir =
|
|
35955
|
+
const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
35564
35956
|
const env = makerEnvOption(parsed);
|
|
35565
35957
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
35566
35958
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -35591,6 +35983,7 @@ async function runInit(parsed, ctx) {
|
|
|
35591
35983
|
});
|
|
35592
35984
|
const selected = await resolveProjectSelection(parsed, projects, {
|
|
35593
35985
|
existingProjectConfig,
|
|
35986
|
+
pat,
|
|
35594
35987
|
skipConfirm
|
|
35595
35988
|
});
|
|
35596
35989
|
emit(ctx, "app", "Maker app selected", {
|
|
@@ -35653,7 +36046,7 @@ async function runInit(parsed, ctx) {
|
|
|
35653
36046
|
}
|
|
35654
36047
|
async function runDoctor(parsed, ctx) {
|
|
35655
36048
|
var _a3, _b;
|
|
35656
|
-
const targetDir =
|
|
36049
|
+
const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
35657
36050
|
const env = makerEnvOption(parsed);
|
|
35658
36051
|
const git = checkGitEnvironment();
|
|
35659
36052
|
const python = checkMakerPythonEnvironment();
|
|
@@ -35665,6 +36058,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
35665
36058
|
const projectRoot = identify.projectRoot || targetDir;
|
|
35666
36059
|
const devKit = inspectAiDevKit(projectRoot);
|
|
35667
36060
|
const devKitUpdate = await checkAiDevKitUpdate(projectRoot, { environment: env });
|
|
36061
|
+
const agentsPolicy = isProjectBound ? inspectMakerAgentsPolicy(projectRoot) : void 0;
|
|
35668
36062
|
const orphanProcessCheck = inspectMakerOrphanProcesses();
|
|
35669
36063
|
const mcpToolsAvailability = inspectMakerMcpToolsAvailability({
|
|
35670
36064
|
makerProjectDir: identify.projectRoot
|
|
@@ -35680,6 +36074,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
35680
36074
|
python,
|
|
35681
36075
|
lua_lsp: luaLsp,
|
|
35682
36076
|
project: identify,
|
|
36077
|
+
agents_policy: agentsPolicy,
|
|
35683
36078
|
dev_kit: devKit,
|
|
35684
36079
|
dev_kit_update: devKitUpdate,
|
|
35685
36080
|
mcp_tools_availability: mcpToolsAvailability,
|
|
@@ -35708,6 +36103,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
35708
36103
|
`- target_dir: ${targetDir}`,
|
|
35709
36104
|
`- project_id: ${identify.projectId || "(none)"}`,
|
|
35710
36105
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
36106
|
+
isProjectBound ? formatMakerAgentsPolicyStatus(projectRoot) : "",
|
|
35711
36107
|
"",
|
|
35712
36108
|
"AI dev kit",
|
|
35713
36109
|
`- ready: ${devKit.ready ? "yes" : "no"}`,
|
|
@@ -35727,9 +36123,9 @@ async function runDoctor(parsed, ctx) {
|
|
|
35727
36123
|
);
|
|
35728
36124
|
}
|
|
35729
36125
|
function inspectMakerMcpToolsAvailability(options) {
|
|
35730
|
-
const aiPwd =
|
|
36126
|
+
const aiPwd = path15.resolve(process.cwd());
|
|
35731
36127
|
const aiPwdIdentify = identifyMakerProject({ cwd: aiPwd });
|
|
35732
|
-
const makerProjectDir = options.makerProjectDir ?
|
|
36128
|
+
const makerProjectDir = options.makerProjectDir ? path15.resolve(options.makerProjectDir) : void 0;
|
|
35733
36129
|
if (!makerProjectDir) {
|
|
35734
36130
|
return {
|
|
35735
36131
|
tools_visibility: "refresh_ai_client_if_missing",
|
|
@@ -35771,9 +36167,9 @@ function samePath2(left, right) {
|
|
|
35771
36167
|
return normalizePathForCompare2(left) === normalizePathForCompare2(right);
|
|
35772
36168
|
}
|
|
35773
36169
|
function normalizePathForCompare2(value) {
|
|
35774
|
-
const resolved =
|
|
36170
|
+
const resolved = path15.resolve(value);
|
|
35775
36171
|
try {
|
|
35776
|
-
return
|
|
36172
|
+
return fs14.realpathSync.native(resolved);
|
|
35777
36173
|
} catch {
|
|
35778
36174
|
return resolved;
|
|
35779
36175
|
}
|
|
@@ -36091,7 +36487,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
36091
36487
|
}
|
|
36092
36488
|
async function resolvePatSet(parsed, ctx) {
|
|
36093
36489
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
36094
|
-
const pat =
|
|
36490
|
+
const pat = fs14.readFileSync(0, "utf8").trim();
|
|
36095
36491
|
if (!pat) {
|
|
36096
36492
|
throw new Error("No PAT found on stdin.");
|
|
36097
36493
|
}
|
|
@@ -36121,7 +36517,7 @@ async function runMcpInstall(parsed, ctx) {
|
|
|
36121
36517
|
env: makerEnvOption(parsed),
|
|
36122
36518
|
pkg: MAKER_NPM_PACKAGE,
|
|
36123
36519
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
36124
|
-
cwd: explicitTargetDir ?
|
|
36520
|
+
cwd: explicitTargetDir ? path15.resolve(explicitTargetDir) : void 0
|
|
36125
36521
|
});
|
|
36126
36522
|
if (ctx.json) {
|
|
36127
36523
|
writeJson(results);
|
|
@@ -36179,6 +36575,65 @@ ${indent3(payload.stderr)}` : "",
|
|
|
36179
36575
|
].filter(Boolean).join("\n")
|
|
36180
36576
|
);
|
|
36181
36577
|
}
|
|
36578
|
+
async function runAgentsUpdate(parsed, ctx) {
|
|
36579
|
+
const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36580
|
+
const result = updateMakerAgentsPolicy(targetDir);
|
|
36581
|
+
if (ctx.json) {
|
|
36582
|
+
writeJson(result);
|
|
36583
|
+
return;
|
|
36584
|
+
}
|
|
36585
|
+
process.stdout.write(
|
|
36586
|
+
[
|
|
36587
|
+
result.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
|
|
36588
|
+
`- path: ${result.path}`,
|
|
36589
|
+
`- previous_status: ${result.previousStatus}`,
|
|
36590
|
+
`- expected_hash: sha256:${result.expectedHash}`,
|
|
36591
|
+
""
|
|
36592
|
+
].join("\n")
|
|
36593
|
+
);
|
|
36594
|
+
}
|
|
36595
|
+
async function runUpgrade(parsed, ctx) {
|
|
36596
|
+
rejectPackageOption(parsed);
|
|
36597
|
+
const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36598
|
+
const env = makerEnvOption(parsed);
|
|
36599
|
+
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
36600
|
+
const installResults = installMcpConfigs({
|
|
36601
|
+
ides: ides.length > 0 ? ides : ["codex", "cursor", "claude"],
|
|
36602
|
+
env,
|
|
36603
|
+
pkg: MAKER_NPM_PACKAGE,
|
|
36604
|
+
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
36605
|
+
cwd: targetDir
|
|
36606
|
+
});
|
|
36607
|
+
const identify = identifyMakerProject({ cwd: targetDir });
|
|
36608
|
+
const agentsResult = identify.projectRoot ? updateMakerAgentsPolicy(identify.projectRoot) : void 0;
|
|
36609
|
+
const payload = {
|
|
36610
|
+
target_dir: targetDir,
|
|
36611
|
+
env,
|
|
36612
|
+
mcp_install: installResults,
|
|
36613
|
+
agents_policy: agentsResult,
|
|
36614
|
+
restart_required: true
|
|
36615
|
+
};
|
|
36616
|
+
if (ctx.json) {
|
|
36617
|
+
writeJson(payload);
|
|
36618
|
+
return;
|
|
36619
|
+
}
|
|
36620
|
+
process.stdout.write(
|
|
36621
|
+
[
|
|
36622
|
+
"TapTap Maker upgrade completed",
|
|
36623
|
+
"",
|
|
36624
|
+
...installResults.map((result) => result.message),
|
|
36625
|
+
"",
|
|
36626
|
+
agentsResult ? [
|
|
36627
|
+
agentsResult.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
|
|
36628
|
+
`- path: ${agentsResult.path}`,
|
|
36629
|
+
`- previous_status: ${agentsResult.previousStatus}`
|
|
36630
|
+
].join("\n") : "AGENTS.md managed policy skipped: current directory is not bound to a Maker project.",
|
|
36631
|
+
"",
|
|
36632
|
+
"Restart or reconnect the AI client MCP session so the updated server and AGENTS.md are loaded.",
|
|
36633
|
+
""
|
|
36634
|
+
].join("\n")
|
|
36635
|
+
);
|
|
36636
|
+
}
|
|
36182
36637
|
function classifyMcpVerifyFailure(result) {
|
|
36183
36638
|
if (result.status === 0) {
|
|
36184
36639
|
return void 0;
|
|
@@ -36224,7 +36679,7 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
36224
36679
|
];
|
|
36225
36680
|
}
|
|
36226
36681
|
async function runDevKitUpdate(parsed, ctx) {
|
|
36227
|
-
const targetDir =
|
|
36682
|
+
const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36228
36683
|
const result = await installAiDevKit({
|
|
36229
36684
|
targetDir,
|
|
36230
36685
|
preserveExisting: false,
|
|
@@ -36236,7 +36691,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
36236
36691
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
36237
36692
|
}
|
|
36238
36693
|
async function runLogsWatch(parsed, ctx) {
|
|
36239
|
-
const targetDir =
|
|
36694
|
+
const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36240
36695
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
36241
36696
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
|
|
36242
36697
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -36246,9 +36701,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
36246
36701
|
serverUrl: stringOption(parsed, "server_url"),
|
|
36247
36702
|
env: makerEnvOption(parsed)
|
|
36248
36703
|
});
|
|
36249
|
-
const runtimeDir =
|
|
36250
|
-
const runtimeLog =
|
|
36251
|
-
const pidFile =
|
|
36704
|
+
const runtimeDir = path15.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
36705
|
+
const runtimeLog = path15.join(runtimeDir, "runtime.log");
|
|
36706
|
+
const pidFile = path15.join(runtimeDir, "watcher.pid");
|
|
36252
36707
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
36253
36708
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
36254
36709
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -36293,10 +36748,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
36293
36748
|
}
|
|
36294
36749
|
}
|
|
36295
36750
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
36296
|
-
|
|
36751
|
+
fs14.mkdirSync(path15.dirname(pidFile), { recursive: true });
|
|
36297
36752
|
const existingPid = readPidFile(pidFile);
|
|
36298
36753
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
36299
|
-
|
|
36754
|
+
fs14.writeFileSync(
|
|
36300
36755
|
pidFile,
|
|
36301
36756
|
`${JSON.stringify(
|
|
36302
36757
|
{
|
|
@@ -36314,10 +36769,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
36314
36769
|
return previous;
|
|
36315
36770
|
}
|
|
36316
36771
|
function readPidFile(pidFile) {
|
|
36317
|
-
if (!
|
|
36772
|
+
if (!fs14.existsSync(pidFile)) {
|
|
36318
36773
|
return void 0;
|
|
36319
36774
|
}
|
|
36320
|
-
const raw =
|
|
36775
|
+
const raw = fs14.readFileSync(pidFile, "utf8").trim();
|
|
36321
36776
|
let pid = Number(raw);
|
|
36322
36777
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
36323
36778
|
try {
|
|
@@ -36337,7 +36792,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
36337
36792
|
}
|
|
36338
36793
|
cleaned = true;
|
|
36339
36794
|
if (readPidFile(pidFile) === process.pid) {
|
|
36340
|
-
|
|
36795
|
+
fs14.rmSync(pidFile, { force: true });
|
|
36341
36796
|
}
|
|
36342
36797
|
};
|
|
36343
36798
|
process.once("exit", cleanup);
|
|
@@ -36381,6 +36836,13 @@ async function resolvePat(parsed, ctx) {
|
|
|
36381
36836
|
async function resolveProjectSelection(parsed, projects, options) {
|
|
36382
36837
|
var _a3;
|
|
36383
36838
|
const appId = stringOption(parsed, "app_id") || parsed.positionals[0];
|
|
36839
|
+
const createNewProject = booleanOption(parsed, "create");
|
|
36840
|
+
if (createNewProject && appId) {
|
|
36841
|
+
throw new Error("Cannot use --create together with --app-id or a positional app id.");
|
|
36842
|
+
}
|
|
36843
|
+
if (createNewProject) {
|
|
36844
|
+
return createProjectFromInit(parsed, options);
|
|
36845
|
+
}
|
|
36384
36846
|
if (appId) {
|
|
36385
36847
|
return projects.find((project) => project.id === appId) || { id: appId };
|
|
36386
36848
|
}
|
|
@@ -36393,7 +36855,12 @@ async function resolveProjectSelection(parsed, projects, options) {
|
|
|
36393
36855
|
};
|
|
36394
36856
|
}
|
|
36395
36857
|
if (projects.length === 0) {
|
|
36396
|
-
|
|
36858
|
+
if (options.skipConfirm) {
|
|
36859
|
+
throw new Error("No Maker apps found for this PAT. Use --create --name to create one.");
|
|
36860
|
+
}
|
|
36861
|
+
process.stdout.write(`${formatMakerProjectList(projects)}
|
|
36862
|
+
`);
|
|
36863
|
+
return createProjectFromInit(parsed, options);
|
|
36397
36864
|
}
|
|
36398
36865
|
if (options.skipConfirm) {
|
|
36399
36866
|
throw new Error("Missing --app-id in non-interactive init mode.");
|
|
@@ -36403,7 +36870,9 @@ async function resolveProjectSelection(parsed, projects, options) {
|
|
|
36403
36870
|
for (; ; ) {
|
|
36404
36871
|
process.stdout.write(`${formatMakerProjectList(orderedProjects, { showAll })}
|
|
36405
36872
|
`);
|
|
36406
|
-
const answer = await promptRequired(
|
|
36873
|
+
const answer = await promptRequired(
|
|
36874
|
+
"Choose app by index, app_id, '0'/'new' to 创建新项目 / Create a new Maker project, or 'all' to show all"
|
|
36875
|
+
);
|
|
36407
36876
|
const normalized = answer.trim().toLowerCase();
|
|
36408
36877
|
if (["a", "all"].includes(normalized)) {
|
|
36409
36878
|
if (showAll) {
|
|
@@ -36413,6 +36882,9 @@ async function resolveProjectSelection(parsed, projects, options) {
|
|
|
36413
36882
|
}
|
|
36414
36883
|
continue;
|
|
36415
36884
|
}
|
|
36885
|
+
if (["0", "n", "new", "create"].includes(normalized)) {
|
|
36886
|
+
return createProjectFromInit(parsed, options);
|
|
36887
|
+
}
|
|
36416
36888
|
const visibleCount = showAll ? orderedProjects.length : Math.min(MAKER_PROJECT_DEFAULT_TEXT_LIMIT, orderedProjects.length);
|
|
36417
36889
|
const byIndex = Number(answer);
|
|
36418
36890
|
if (Number.isInteger(byIndex) && byIndex >= 1 && byIndex <= visibleCount) {
|
|
@@ -36425,6 +36897,31 @@ async function resolveProjectSelection(parsed, projects, options) {
|
|
|
36425
36897
|
return selected;
|
|
36426
36898
|
}
|
|
36427
36899
|
}
|
|
36900
|
+
async function createProjectFromInit(parsed, options) {
|
|
36901
|
+
var _a3;
|
|
36902
|
+
const existingProjectId = (_a3 = options.existingProjectConfig) == null ? void 0 : _a3.project_id;
|
|
36903
|
+
if (existingProjectId) {
|
|
36904
|
+
throw new Error(
|
|
36905
|
+
[
|
|
36906
|
+
`Current directory is already bound to Maker project ${existingProjectId}.`,
|
|
36907
|
+
"A Maker workspace directory can only be bound to one project at a time.",
|
|
36908
|
+
"Please create/open a new empty directory before creating a new Maker project."
|
|
36909
|
+
].join("\n")
|
|
36910
|
+
);
|
|
36911
|
+
}
|
|
36912
|
+
const name = stringOption(parsed, "name") || stringOption(parsed, "project_name");
|
|
36913
|
+
if (!name && options.skipConfirm) {
|
|
36914
|
+
throw new Error("Missing --name in non-interactive create mode.");
|
|
36915
|
+
}
|
|
36916
|
+
const projectName = name || await promptRequired("Enter new Maker project name");
|
|
36917
|
+
return createMakerProject({
|
|
36918
|
+
name: projectName,
|
|
36919
|
+
gameType: "sce",
|
|
36920
|
+
pat: options.pat
|
|
36921
|
+
}).catch((error2) => {
|
|
36922
|
+
throw appendPatRecoveryUrl(error2, parsed);
|
|
36923
|
+
});
|
|
36924
|
+
}
|
|
36428
36925
|
function ensureInitTargetCanRecordProject(targetDir, existingProjectId, selectedProjectId) {
|
|
36429
36926
|
if (!existingProjectId || existingProjectId === selectedProjectId) {
|
|
36430
36927
|
return;
|
|
@@ -36446,7 +36943,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
36446
36943
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
36447
36944
|
});
|
|
36448
36945
|
writeDevKitStagedGitignore(
|
|
36449
|
-
|
|
36946
|
+
path15.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
36450
36947
|
listPresentDevKitManagedEntries(targetDir)
|
|
36451
36948
|
);
|
|
36452
36949
|
if (options.finalizeGitignore) {
|
|
@@ -36463,7 +36960,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
36463
36960
|
);
|
|
36464
36961
|
} catch (error2) {
|
|
36465
36962
|
writeDevKitStagedGitignore(
|
|
36466
|
-
|
|
36963
|
+
path15.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
36467
36964
|
listPresentDevKitManagedEntries(targetDir)
|
|
36468
36965
|
);
|
|
36469
36966
|
if (options.finalizeGitignore) {
|
|
@@ -36551,23 +37048,27 @@ function installMcpConfig(ide, options) {
|
|
|
36551
37048
|
}
|
|
36552
37049
|
function installMcpConfigUnsafe(ide, options) {
|
|
36553
37050
|
if (ide === "codex") {
|
|
36554
|
-
const configPath =
|
|
36555
|
-
mergeCodexMcpConfig(configPath, options);
|
|
37051
|
+
const configPath = path15.join(os4.homedir(), ".codex", "config.toml");
|
|
37052
|
+
const write = mergeCodexMcpConfig(configPath, options);
|
|
36556
37053
|
return {
|
|
36557
37054
|
ide,
|
|
36558
37055
|
ok: true,
|
|
36559
37056
|
path: configPath,
|
|
36560
|
-
|
|
37057
|
+
changed: write.changed,
|
|
37058
|
+
backupPath: write.backupPath,
|
|
37059
|
+
message: formatMcpInstallMessage("Codex", configPath, write)
|
|
36561
37060
|
};
|
|
36562
37061
|
}
|
|
36563
37062
|
if (ide === "cursor") {
|
|
36564
|
-
const configPath =
|
|
36565
|
-
mergeJsonMcpConfig(configPath, options);
|
|
37063
|
+
const configPath = path15.join(os4.homedir(), ".cursor", "mcp.json");
|
|
37064
|
+
const write = mergeJsonMcpConfig(configPath, options);
|
|
36566
37065
|
return {
|
|
36567
37066
|
ide,
|
|
36568
37067
|
ok: true,
|
|
36569
37068
|
path: configPath,
|
|
36570
|
-
|
|
37069
|
+
changed: write.changed,
|
|
37070
|
+
backupPath: write.backupPath,
|
|
37071
|
+
message: formatMcpInstallMessage("Cursor", configPath, write)
|
|
36571
37072
|
};
|
|
36572
37073
|
}
|
|
36573
37074
|
if (ide === "claude") {
|
|
@@ -36577,30 +37078,29 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
36577
37078
|
return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
|
|
36578
37079
|
}
|
|
36579
37080
|
}
|
|
36580
|
-
const configPath =
|
|
36581
|
-
mergeJsonMcpConfig(configPath, options);
|
|
37081
|
+
const configPath = path15.join(os4.homedir(), ".claude.json");
|
|
37082
|
+
const write = mergeJsonMcpConfig(configPath, options);
|
|
36582
37083
|
return {
|
|
36583
37084
|
ide,
|
|
36584
37085
|
ok: true,
|
|
36585
37086
|
path: configPath,
|
|
36586
|
-
|
|
37087
|
+
changed: write.changed,
|
|
37088
|
+
backupPath: write.backupPath,
|
|
37089
|
+
message: formatMcpInstallMessage("Claude fallback", configPath, write)
|
|
36587
37090
|
};
|
|
36588
37091
|
}
|
|
36589
37092
|
return { ide, ok: false, message: `Skipped unknown IDE: ${ide}` };
|
|
36590
37093
|
}
|
|
36591
37094
|
function mergeJsonMcpConfig(configPath, options) {
|
|
36592
|
-
backupIfExists(configPath);
|
|
36593
37095
|
const existing = readJsonObject(configPath);
|
|
36594
37096
|
const mcpServers = asObject(existing.mcpServers);
|
|
36595
37097
|
mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
|
|
36596
37098
|
existing.mcpServers = mcpServers;
|
|
36597
|
-
|
|
36598
|
-
|
|
36599
|
-
`, "utf8");
|
|
37099
|
+
return writeConfigWithTapTapBackupIfChanged(configPath, `${JSON.stringify(existing, null, 2)}
|
|
37100
|
+
`);
|
|
36600
37101
|
}
|
|
36601
37102
|
function mergeCodexMcpConfig(configPath, options) {
|
|
36602
|
-
const
|
|
36603
|
-
const existing = fs13.existsSync(configPath) ? fs13.readFileSync(configPath, "utf8") : "";
|
|
37103
|
+
const existing = fs14.existsSync(configPath) ? fs14.readFileSync(configPath, "utf8") : "";
|
|
36604
37104
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
36605
37105
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
36606
37106
|
const launch = getNpxCliCommand(options.pkg);
|
|
@@ -36614,18 +37114,20 @@ function mergeCodexMcpConfig(configPath, options) {
|
|
|
36614
37114
|
`TAPTAP_MCP_ENV = "${options.env}"`,
|
|
36615
37115
|
""
|
|
36616
37116
|
].join("\n");
|
|
36617
|
-
|
|
36618
|
-
|
|
36619
|
-
|
|
36620
|
-
|
|
36621
|
-
|
|
36622
|
-
|
|
36623
|
-
|
|
36624
|
-
|
|
36625
|
-
|
|
36626
|
-
|
|
36627
|
-
|
|
36628
|
-
|
|
37117
|
+
return writeConfigWithTapTapBackupIfChanged(
|
|
37118
|
+
configPath,
|
|
37119
|
+
[withoutOld, section].filter(Boolean).join("\n\n"),
|
|
37120
|
+
(updated) => {
|
|
37121
|
+
const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
|
|
37122
|
+
if (duplicates.length > 0) {
|
|
37123
|
+
throw new Error(
|
|
37124
|
+
`Codex MCP config update would create duplicate table(s): ${duplicates.join(
|
|
37125
|
+
", "
|
|
37126
|
+
)}. Restored previous config.`
|
|
37127
|
+
);
|
|
37128
|
+
}
|
|
37129
|
+
}
|
|
37130
|
+
);
|
|
36629
37131
|
}
|
|
36630
37132
|
function createCodexMcpSectionPattern(mcpName) {
|
|
36631
37133
|
const keyPattern = createCodexMcpKeyPattern(mcpName);
|
|
@@ -36733,10 +37235,10 @@ function rejectPackageOption(parsed) {
|
|
|
36733
37235
|
}
|
|
36734
37236
|
}
|
|
36735
37237
|
function readJsonObject(filePath) {
|
|
36736
|
-
if (!
|
|
37238
|
+
if (!fs14.existsSync(filePath)) {
|
|
36737
37239
|
return {};
|
|
36738
37240
|
}
|
|
36739
|
-
return JSON.parse(
|
|
37241
|
+
return JSON.parse(fs14.readFileSync(filePath, "utf8"));
|
|
36740
37242
|
}
|
|
36741
37243
|
function asObject(value) {
|
|
36742
37244
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -36744,27 +37246,44 @@ function asObject(value) {
|
|
|
36744
37246
|
}
|
|
36745
37247
|
return {};
|
|
36746
37248
|
}
|
|
36747
|
-
function
|
|
36748
|
-
|
|
36749
|
-
|
|
37249
|
+
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
37250
|
+
const existed = fs14.existsSync(filePath);
|
|
37251
|
+
const previousContent = existed ? fs14.readFileSync(filePath, "utf8") : void 0;
|
|
37252
|
+
if (previousContent === nextContent) {
|
|
37253
|
+
return { changed: false };
|
|
37254
|
+
}
|
|
37255
|
+
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
37256
|
+
fs14.mkdirSync(path15.dirname(filePath), { recursive: true });
|
|
37257
|
+
if (previousContent !== void 0 && backupPath) {
|
|
37258
|
+
fs14.writeFileSync(backupPath, previousContent, "utf8");
|
|
37259
|
+
}
|
|
37260
|
+
try {
|
|
37261
|
+
fs14.writeFileSync(filePath, nextContent, "utf8");
|
|
37262
|
+
validate == null ? void 0 : validate(fs14.readFileSync(filePath, "utf8"));
|
|
37263
|
+
return { changed: true, backupPath };
|
|
37264
|
+
} catch (error2) {
|
|
37265
|
+
if (previousContent !== void 0) {
|
|
37266
|
+
fs14.writeFileSync(filePath, previousContent, "utf8");
|
|
37267
|
+
} else {
|
|
37268
|
+
fs14.rmSync(filePath, { force: true });
|
|
37269
|
+
}
|
|
37270
|
+
throw error2;
|
|
36750
37271
|
}
|
|
36751
|
-
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
|
|
36752
|
-
const backupPath = `${filePath}.bak.${stamp}`;
|
|
36753
|
-
fs13.copyFileSync(filePath, backupPath);
|
|
36754
|
-
return backupPath;
|
|
36755
37272
|
}
|
|
36756
|
-
function
|
|
36757
|
-
if (
|
|
36758
|
-
|
|
36759
|
-
return;
|
|
37273
|
+
function formatMcpInstallMessage(label, configPath, write) {
|
|
37274
|
+
if (!write.changed) {
|
|
37275
|
+
return `✓ ${label} MCP config unchanged: ${configPath}`;
|
|
36760
37276
|
}
|
|
36761
|
-
|
|
37277
|
+
return [
|
|
37278
|
+
`✓ ${label} MCP config updated: ${configPath}`,
|
|
37279
|
+
write.backupPath ? ` Backup: ${write.backupPath}` : ""
|
|
37280
|
+
].filter(Boolean).join("\n");
|
|
36762
37281
|
}
|
|
36763
37282
|
function saveInitState(targetDir, state) {
|
|
36764
|
-
|
|
36765
|
-
const key =
|
|
36766
|
-
|
|
36767
|
-
|
|
37283
|
+
fs14.mkdirSync(getMakerHome(), { recursive: true });
|
|
37284
|
+
const key = crypto3.createHash("sha256").update(path15.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
37285
|
+
fs14.writeFileSync(
|
|
37286
|
+
path15.join(getMakerHome(), `init-state-${key}.json`),
|
|
36768
37287
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
36769
37288
|
`,
|
|
36770
37289
|
"utf8"
|
|
@@ -36803,7 +37322,7 @@ function rejectRemovedAppsPaginationOptions(parsed) {
|
|
|
36803
37322
|
}
|
|
36804
37323
|
function formatMakerProjectList(projects, options = {}) {
|
|
36805
37324
|
if (projects.length === 0) {
|
|
36806
|
-
return "No Maker apps found.";
|
|
37325
|
+
return ["No Maker apps found.", "", "0,创建新项目 / 0. Create a new Maker project"].join("\n");
|
|
36807
37326
|
}
|
|
36808
37327
|
const sortedProjects = sortProjectsByRecentActivity(projects);
|
|
36809
37328
|
const showAll = options.showAll === true;
|
|
@@ -36812,8 +37331,11 @@ function formatMakerProjectList(projects, options = {}) {
|
|
|
36812
37331
|
return [
|
|
36813
37332
|
`Maker apps (${projects.length})`,
|
|
36814
37333
|
hiddenCount > 0 ? `Showing ${visibleProjects.length} most recently active apps, sorted by last activity. ${hiddenCount} more hidden. Run \`taptap-maker apps --all\` to show all, or use \`--json\` for the complete machine-readable list.` : `Showing all ${visibleProjects.length} Maker apps, sorted by last activity.`,
|
|
37334
|
+
"0,创建新项目 / 0. Create a new Maker project",
|
|
36815
37335
|
"",
|
|
36816
|
-
...visibleProjects.map((project, index) => formatProjectListItem(project, index))
|
|
37336
|
+
...visibleProjects.map((project, index) => formatProjectListItem(project, index)),
|
|
37337
|
+
"",
|
|
37338
|
+
"0,创建新项目 / 0. Create a new Maker project"
|
|
36817
37339
|
].filter((line) => line !== "").join("\n");
|
|
36818
37340
|
}
|
|
36819
37341
|
function emit(ctx, step, message, data) {
|
|
@@ -36874,7 +37396,7 @@ function formatUnknownCommand(command) {
|
|
|
36874
37396
|
return `${primary} ${isKnownSubcommand(primary, secondary) ? secondary : "<redacted>"}`;
|
|
36875
37397
|
}
|
|
36876
37398
|
function isKnownSubcommand(command, subcommand) {
|
|
36877
|
-
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");
|
|
37399
|
+
return command === "pat" && subcommand === "set" || command === "mcp" && (subcommand === "install" || subcommand === "verify") || command === "agents" && subcommand === "update" || command === "upgrade" || command === "dev-kit" && subcommand === "update" || command === "logs" && subcommand === "watch" || command === "python" && (subcommand === "doctor" || subcommand === "setup" || subcommand === "path") || command === "lua-lsp" && (subcommand === "doctor" || subcommand === "setup");
|
|
36878
37400
|
}
|
|
36879
37401
|
function stringOption(parsed, key) {
|
|
36880
37402
|
const value = parsed.options[key];
|
|
@@ -36909,7 +37431,7 @@ function makerEnvOption(parsed) {
|
|
|
36909
37431
|
return env;
|
|
36910
37432
|
}
|
|
36911
37433
|
const targetDir = stringOption(parsed, "target_dir");
|
|
36912
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
37434
|
+
return getMakerEnvironment(void 0, targetDir ? path15.resolve(targetDir) : process.cwd());
|
|
36913
37435
|
}
|
|
36914
37436
|
function mcpVerifyModeOption(parsed) {
|
|
36915
37437
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -36948,6 +37470,7 @@ function printHelp() {
|
|
|
36948
37470
|
"Usage:",
|
|
36949
37471
|
" taptap-maker Start MCP server mode",
|
|
36950
37472
|
" taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
|
|
37473
|
+
" [--create --name NAME]",
|
|
36951
37474
|
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
36952
37475
|
" [--json]",
|
|
36953
37476
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
@@ -36967,6 +37490,9 @@ function printHelp() {
|
|
|
36967
37490
|
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
36968
37491
|
" [--target-dir DIR] [--json]",
|
|
36969
37492
|
" taptap-maker mcp verify [--mode npx|self] [--json]",
|
|
37493
|
+
" taptap-maker agents update [--target-dir DIR] [--json]",
|
|
37494
|
+
" taptap-maker upgrade [--ide codex,cursor,claude] [--env rnd|production]",
|
|
37495
|
+
" [--target-dir DIR] [--json]",
|
|
36970
37496
|
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
36971
37497
|
" taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
|
|
36972
37498
|
"",
|
|
@@ -37157,13 +37683,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
37157
37683
|
}
|
|
37158
37684
|
|
|
37159
37685
|
// node_modules/pkce-challenge/dist/index.node.js
|
|
37160
|
-
var
|
|
37686
|
+
var crypto4;
|
|
37161
37687
|
var _a2;
|
|
37162
|
-
|
|
37688
|
+
crypto4 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
|
|
37163
37689
|
globalThis.crypto ?? // Node.js >18
|
|
37164
37690
|
import("node:crypto").then((m) => m.webcrypto);
|
|
37165
37691
|
async function getRandomValues(size) {
|
|
37166
|
-
return (await
|
|
37692
|
+
return (await crypto4).getRandomValues(new Uint8Array(size));
|
|
37167
37693
|
}
|
|
37168
37694
|
async function random(size) {
|
|
37169
37695
|
const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
@@ -37179,7 +37705,7 @@ async function generateVerifier(length) {
|
|
|
37179
37705
|
return await random(length);
|
|
37180
37706
|
}
|
|
37181
37707
|
async function generateChallenge(code_verifier) {
|
|
37182
|
-
const buffer = await (await
|
|
37708
|
+
const buffer = await (await crypto4).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
37183
37709
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
37184
37710
|
}
|
|
37185
37711
|
async function pkceChallenge(length) {
|
|
@@ -38534,8 +39060,8 @@ var StreamableHTTPClientTransport = class {
|
|
|
38534
39060
|
};
|
|
38535
39061
|
|
|
38536
39062
|
// src/mcp-proxy/proxy.ts
|
|
38537
|
-
import * as
|
|
38538
|
-
import * as
|
|
39063
|
+
import * as path17 from "node:path";
|
|
39064
|
+
import * as crypto6 from "node:crypto";
|
|
38539
39065
|
|
|
38540
39066
|
// src/mcp-proxy/cookieJar.ts
|
|
38541
39067
|
var CookieJar = class {
|
|
@@ -38716,9 +39242,9 @@ function createCookieFetch(cookieJar) {
|
|
|
38716
39242
|
}
|
|
38717
39243
|
|
|
38718
39244
|
// src/core/utils/logWriter.ts
|
|
38719
|
-
import * as
|
|
38720
|
-
import * as
|
|
38721
|
-
import * as
|
|
39245
|
+
import * as fs15 from "node:fs";
|
|
39246
|
+
import * as path16 from "node:path";
|
|
39247
|
+
import * as crypto5 from "node:crypto";
|
|
38722
39248
|
|
|
38723
39249
|
// src/core/types/log.ts
|
|
38724
39250
|
var LOG_LEVEL_PRIORITY = {
|
|
@@ -38758,7 +39284,7 @@ var LogWriter = class {
|
|
|
38758
39284
|
return;
|
|
38759
39285
|
}
|
|
38760
39286
|
try {
|
|
38761
|
-
await
|
|
39287
|
+
await fs15.promises.mkdir(this.config.logDir, { recursive: true });
|
|
38762
39288
|
await this.cleanupOldLogs();
|
|
38763
39289
|
this.initialized = true;
|
|
38764
39290
|
} catch (error2) {
|
|
@@ -38781,7 +39307,7 @@ var LogWriter = class {
|
|
|
38781
39307
|
*/
|
|
38782
39308
|
getLogFilePath(date5) {
|
|
38783
39309
|
const d = date5 || this.getCurrentDate();
|
|
38784
|
-
return
|
|
39310
|
+
return path16.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
38785
39311
|
}
|
|
38786
39312
|
/**
|
|
38787
39313
|
* 获取或创建写入流
|
|
@@ -38796,7 +39322,7 @@ var LogWriter = class {
|
|
|
38796
39322
|
}
|
|
38797
39323
|
this.currentDate = date5;
|
|
38798
39324
|
try {
|
|
38799
|
-
this.writeStream =
|
|
39325
|
+
this.writeStream = fs15.createWriteStream(this.getLogFilePath(date5), {
|
|
38800
39326
|
flags: "a",
|
|
38801
39327
|
encoding: "utf8"
|
|
38802
39328
|
});
|
|
@@ -38848,11 +39374,11 @@ var LogWriter = class {
|
|
|
38848
39374
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
38849
39375
|
try {
|
|
38850
39376
|
const filePath = this.getLogFilePath();
|
|
38851
|
-
const dir =
|
|
38852
|
-
if (!
|
|
38853
|
-
|
|
39377
|
+
const dir = path16.dirname(filePath);
|
|
39378
|
+
if (!fs15.existsSync(dir)) {
|
|
39379
|
+
fs15.mkdirSync(dir, { recursive: true });
|
|
38854
39380
|
}
|
|
38855
|
-
|
|
39381
|
+
fs15.appendFileSync(filePath, message, "utf8");
|
|
38856
39382
|
} catch {
|
|
38857
39383
|
}
|
|
38858
39384
|
}
|
|
@@ -38863,7 +39389,7 @@ var LogWriter = class {
|
|
|
38863
39389
|
async cleanupOldLogs() {
|
|
38864
39390
|
if (this.config.maxDays <= 0) return;
|
|
38865
39391
|
try {
|
|
38866
|
-
const files = await
|
|
39392
|
+
const files = await fs15.promises.readdir(this.config.logDir);
|
|
38867
39393
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
38868
39394
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
38869
39395
|
const prefix = this.config.prefix;
|
|
@@ -38878,7 +39404,7 @@ var LogWriter = class {
|
|
|
38878
39404
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
38879
39405
|
const fileDate = new Date(year, month - 1, day);
|
|
38880
39406
|
if (fileDate < cutoffDate) {
|
|
38881
|
-
await
|
|
39407
|
+
await fs15.promises.unlink(path16.join(this.config.logDir, file2));
|
|
38882
39408
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
38883
39409
|
`);
|
|
38884
39410
|
}
|
|
@@ -38952,10 +39478,10 @@ var TapTapMCPProxy = class {
|
|
|
38952
39478
|
const { user_id, project_id } = this.config.tenant;
|
|
38953
39479
|
let logDir;
|
|
38954
39480
|
if (user_id && project_id) {
|
|
38955
|
-
logDir =
|
|
39481
|
+
logDir = path17.join(logRoot, "proxy", user_id, project_id);
|
|
38956
39482
|
} else {
|
|
38957
|
-
const kidHash =
|
|
38958
|
-
logDir =
|
|
39483
|
+
const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
39484
|
+
logDir = path17.join(logRoot, "proxy", kidHash);
|
|
38959
39485
|
}
|
|
38960
39486
|
return new LogWriter({
|
|
38961
39487
|
logDir,
|
|
@@ -39612,6 +40138,7 @@ function printHelp2() {
|
|
|
39612
40138
|
"Usage:",
|
|
39613
40139
|
" taptap-maker Start MCP server mode",
|
|
39614
40140
|
" taptap-maker init [--env rnd|production] [--app-id ID] [--target-dir DIR] [--pat PAT]",
|
|
40141
|
+
" [--create --name NAME]",
|
|
39615
40142
|
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
39616
40143
|
" [--json]",
|
|
39617
40144
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
@@ -39626,10 +40153,14 @@ function printHelp2() {
|
|
|
39626
40153
|
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
39627
40154
|
" taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
|
|
39628
40155
|
" taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
40156
|
+
" [--target-dir DIR]",
|
|
39629
40157
|
" [--json] # alias for mcp install",
|
|
39630
40158
|
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
39631
|
-
" [--json]",
|
|
40159
|
+
" [--target-dir DIR] [--json]",
|
|
39632
40160
|
" taptap-maker mcp verify [--mode npx|self] [--json]",
|
|
40161
|
+
" taptap-maker agents update [--target-dir DIR] [--json]",
|
|
40162
|
+
" taptap-maker upgrade [--ide codex,cursor,claude] [--env rnd|production]",
|
|
40163
|
+
" [--target-dir DIR] [--json]",
|
|
39633
40164
|
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
39634
40165
|
" taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
|
|
39635
40166
|
"",
|