@taptap/maker 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/maker.js +1060 -517
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +31 -25
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(path15) {
|
|
3237
|
+
let input2 = path15;
|
|
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 [path15, query] = wsComponent.resourceName.split("?");
|
|
3437
|
+
wsComponent.path = path15 && path15 !== "/" ? path15 : 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, fs13, 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, fs13[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 fs13 = __require("fs");
|
|
12513
|
+
function checkPathExt(path15, 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 && path15.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, path15, options) {
|
|
12531
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12532
12532
|
return false;
|
|
12533
12533
|
}
|
|
12534
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path15, options);
|
|
12535
12535
|
}
|
|
12536
|
-
function isexe(
|
|
12537
|
-
|
|
12538
|
-
cb(er, er ? false : checkStat(stat,
|
|
12536
|
+
function isexe(path15, options, cb) {
|
|
12537
|
+
fs13.stat(path15, function(er, stat) {
|
|
12538
|
+
cb(er, er ? false : checkStat(stat, path15, options));
|
|
12539
12539
|
});
|
|
12540
12540
|
}
|
|
12541
|
-
function sync(
|
|
12542
|
-
return checkStat(
|
|
12541
|
+
function sync(path15, options) {
|
|
12542
|
+
return checkStat(fs13.statSync(path15), path15, 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 fs13 = __require("fs");
|
|
12553
|
+
function isexe(path15, options, cb) {
|
|
12554
|
+
fs13.stat(path15, 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(path15, options) {
|
|
12559
|
+
return checkStat(fs13.statSync(path15), 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 fs13 = __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(path15, 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(path15, 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(path15, 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(path15, options) {
|
|
12622
12622
|
try {
|
|
12623
|
-
return core.sync(
|
|
12623
|
+
return core.sync(path15, 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 path15 = __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 = path15.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 = path15.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 path15 = __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 ? path15.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 = path15.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 [path15, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12834
|
+
const binary = path15.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 fs13 = __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 = fs13.openSync(command, "r");
|
|
12855
|
+
fs13.readSync(fd, buffer, 0, size, 0);
|
|
12856
|
+
fs13.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 path15 = __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 = path15.normalize(parsed.command);
|
|
12895
12895
|
parsed.command = escape2.command(parsed.command);
|
|
12896
12896
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
12897
12897
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -12987,7 +12987,7 @@ var require_cross_spawn = __commonJS({
|
|
|
12987
12987
|
enoent.hookChildProcess(spawned, parsed);
|
|
12988
12988
|
return spawned;
|
|
12989
12989
|
}
|
|
12990
|
-
function
|
|
12990
|
+
function spawnSync7(command, args, options) {
|
|
12991
12991
|
const parsed = parse3(command, args, options);
|
|
12992
12992
|
const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
|
|
12993
12993
|
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
|
|
@@ -12995,16 +12995,16 @@ var require_cross_spawn = __commonJS({
|
|
|
12995
12995
|
}
|
|
12996
12996
|
module.exports = spawn5;
|
|
12997
12997
|
module.exports.spawn = spawn5;
|
|
12998
|
-
module.exports.sync =
|
|
12998
|
+
module.exports.sync = spawnSync7;
|
|
12999
12999
|
module.exports._parse = parse3;
|
|
13000
13000
|
module.exports._enoent = enoent;
|
|
13001
13001
|
}
|
|
13002
13002
|
});
|
|
13003
13003
|
|
|
13004
13004
|
// src/maker/server/mcp.ts
|
|
13005
|
-
import { execFileSync, spawn as spawn4 } from "node:child_process";
|
|
13006
|
-
import
|
|
13007
|
-
import
|
|
13005
|
+
import { execFileSync, spawn as spawn4, spawnSync as spawnSync4 } from "node:child_process";
|
|
13006
|
+
import fs9 from "node:fs";
|
|
13007
|
+
import path10 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: path15, errorMaps, issueData } = params;
|
|
13369
|
+
const fullPath = [...path15, ...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, path15, key) {
|
|
13485
13485
|
this._cachedPath = [];
|
|
13486
13486
|
this.parent = parent;
|
|
13487
13487
|
this.data = value;
|
|
13488
|
-
this._path =
|
|
13488
|
+
this._path = path15;
|
|
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, path15) {
|
|
17138
|
+
if (!path15)
|
|
17139
17139
|
return obj;
|
|
17140
|
-
return
|
|
17140
|
+
return path15.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(path15, 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(path15);
|
|
17530
17530
|
return iss;
|
|
17531
17531
|
});
|
|
17532
17532
|
}
|
|
@@ -28048,7 +28048,7 @@ function isElectron() {
|
|
|
28048
28048
|
|
|
28049
28049
|
// src/maker/server/identify.ts
|
|
28050
28050
|
import fs2 from "node:fs";
|
|
28051
|
-
import
|
|
28051
|
+
import path2 from "node:path";
|
|
28052
28052
|
|
|
28053
28053
|
// src/maker/storage.ts
|
|
28054
28054
|
import fs from "node:fs";
|
|
@@ -28075,13 +28075,13 @@ function getMakerHome() {
|
|
|
28075
28075
|
return process.env[MAKER_HOME_ENV] || path.join(os.homedir(), MAKER_DIR);
|
|
28076
28076
|
}
|
|
28077
28077
|
function getJwtPath() {
|
|
28078
|
-
return
|
|
28078
|
+
return getMakerCredentialPath("jwt.json");
|
|
28079
28079
|
}
|
|
28080
28080
|
function getPatPath() {
|
|
28081
|
-
return
|
|
28081
|
+
return getMakerCredentialPath("pat.json");
|
|
28082
28082
|
}
|
|
28083
28083
|
function getTapAuthPath() {
|
|
28084
|
-
return
|
|
28084
|
+
return getMakerCredentialPath("tap-auth.json");
|
|
28085
28085
|
}
|
|
28086
28086
|
function getLegacyPatPath() {
|
|
28087
28087
|
return path.join(os.homedir(), ".maker-pat");
|
|
@@ -28109,8 +28109,6 @@ function savePat(pat) {
|
|
|
28109
28109
|
...pat,
|
|
28110
28110
|
saved_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
28111
28111
|
});
|
|
28112
|
-
fs.writeFileSync(getLegacyPatPath(), `${pat.token}
|
|
28113
|
-
`, "utf8");
|
|
28114
28112
|
}
|
|
28115
28113
|
function loadTapAuth() {
|
|
28116
28114
|
const auth2 = readJsonFile(getTapAuthPath());
|
|
@@ -28147,9 +28145,177 @@ function saveProjectConfig(projectRoot, config2) {
|
|
|
28147
28145
|
function getProjectMarkerDirName() {
|
|
28148
28146
|
return PROJECT_DIR;
|
|
28149
28147
|
}
|
|
28148
|
+
function getMakerCredentialPath(fileName) {
|
|
28149
|
+
return path.join(getMakerHome(), fileName);
|
|
28150
|
+
}
|
|
28151
|
+
|
|
28152
|
+
// src/maker/server/identify.ts
|
|
28153
|
+
function parseConfig(configPath) {
|
|
28154
|
+
try {
|
|
28155
|
+
const parsed = JSON.parse(fs2.readFileSync(configPath, "utf8"));
|
|
28156
|
+
return (parsed == null ? void 0 : parsed.project_id) ? parsed : null;
|
|
28157
|
+
} catch {
|
|
28158
|
+
return null;
|
|
28159
|
+
}
|
|
28160
|
+
}
|
|
28161
|
+
function findProjectConfig(startDir = process.cwd()) {
|
|
28162
|
+
let current = path2.resolve(startDir);
|
|
28163
|
+
while (current.length > 0) {
|
|
28164
|
+
const configPath = getProjectConfigPath(current);
|
|
28165
|
+
if (fs2.existsSync(configPath)) {
|
|
28166
|
+
const config2 = parseConfig(configPath);
|
|
28167
|
+
if (config2) {
|
|
28168
|
+
return {
|
|
28169
|
+
projectId: config2.project_id,
|
|
28170
|
+
configPath,
|
|
28171
|
+
projectRoot: current,
|
|
28172
|
+
config: config2,
|
|
28173
|
+
source: "cwd"
|
|
28174
|
+
};
|
|
28175
|
+
}
|
|
28176
|
+
}
|
|
28177
|
+
const parent = path2.dirname(current);
|
|
28178
|
+
if (parent === current) {
|
|
28179
|
+
return { source: "none" };
|
|
28180
|
+
}
|
|
28181
|
+
current = parent;
|
|
28182
|
+
}
|
|
28183
|
+
return { source: "none" };
|
|
28184
|
+
}
|
|
28185
|
+
function identifyMakerProject(options) {
|
|
28186
|
+
if (options == null ? void 0 : options.projectId) {
|
|
28187
|
+
return {
|
|
28188
|
+
projectId: options.projectId,
|
|
28189
|
+
source: "argv"
|
|
28190
|
+
};
|
|
28191
|
+
}
|
|
28192
|
+
if (process.env.MAKER_PROJECT_ID) {
|
|
28193
|
+
return {
|
|
28194
|
+
projectId: process.env.MAKER_PROJECT_ID,
|
|
28195
|
+
source: "env"
|
|
28196
|
+
};
|
|
28197
|
+
}
|
|
28198
|
+
return findProjectConfig((options == null ? void 0 : options.cwd) || process.cwd());
|
|
28199
|
+
}
|
|
28200
|
+
function formatIdentifyHint() {
|
|
28201
|
+
return [
|
|
28202
|
+
"当前目录尚未绑定 Maker 项目。",
|
|
28203
|
+
"",
|
|
28204
|
+
"初始化流程请运行 `taptap-maker init`;缺少本地鉴权时 CLI 会自动进入登录授权。",
|
|
28205
|
+
"本地鉴权失效时请运行 `taptap-maker login`。",
|
|
28206
|
+
"",
|
|
28207
|
+
`clone 成功后会在当前目录写入 ${getProjectMarkerDirName()}/config.json。`
|
|
28208
|
+
].join("\n");
|
|
28209
|
+
}
|
|
28210
|
+
|
|
28211
|
+
// src/maker/server/hiddenStdioTransport.ts
|
|
28212
|
+
import { spawn as spawn2 } from "node:child_process";
|
|
28213
|
+
import { PassThrough as PassThrough2 } from "node:stream";
|
|
28214
|
+
var HiddenStdioClientTransport = class {
|
|
28215
|
+
constructor(serverParams) {
|
|
28216
|
+
this.serverParams = serverParams;
|
|
28217
|
+
this.abortController = new AbortController();
|
|
28218
|
+
this.readBuffer = new ReadBuffer();
|
|
28219
|
+
this.stderrStream = serverParams.stderr === "pipe" || serverParams.stderr === "overlapped" ? new PassThrough2() : null;
|
|
28220
|
+
}
|
|
28221
|
+
async start() {
|
|
28222
|
+
if (this.process) {
|
|
28223
|
+
throw new Error("HiddenStdioClientTransport already started.");
|
|
28224
|
+
}
|
|
28225
|
+
await new Promise((resolve, reject) => {
|
|
28226
|
+
var _a3, _b, _c;
|
|
28227
|
+
this.process = spawn2(this.serverParams.command, this.serverParams.args ?? [], {
|
|
28228
|
+
env: this.serverParams.env,
|
|
28229
|
+
stdio: ["pipe", "pipe", this.serverParams.stderr ?? "inherit"],
|
|
28230
|
+
shell: false,
|
|
28231
|
+
signal: this.abortController.signal,
|
|
28232
|
+
windowsHide: true,
|
|
28233
|
+
cwd: this.serverParams.cwd
|
|
28234
|
+
});
|
|
28235
|
+
this.process.on("error", (error2) => {
|
|
28236
|
+
var _a4, _b2;
|
|
28237
|
+
if (error2.name === "AbortError") {
|
|
28238
|
+
(_a4 = this.onclose) == null ? void 0 : _a4.call(this);
|
|
28239
|
+
return;
|
|
28240
|
+
}
|
|
28241
|
+
reject(error2);
|
|
28242
|
+
(_b2 = this.onerror) == null ? void 0 : _b2.call(this, error2);
|
|
28243
|
+
});
|
|
28244
|
+
this.process.on("spawn", () => resolve());
|
|
28245
|
+
this.process.on("close", () => {
|
|
28246
|
+
var _a4;
|
|
28247
|
+
this.process = void 0;
|
|
28248
|
+
(_a4 = this.onclose) == null ? void 0 : _a4.call(this);
|
|
28249
|
+
});
|
|
28250
|
+
(_a3 = this.process.stdin) == null ? void 0 : _a3.on("error", (error2) => {
|
|
28251
|
+
var _a4;
|
|
28252
|
+
return (_a4 = this.onerror) == null ? void 0 : _a4.call(this, error2);
|
|
28253
|
+
});
|
|
28254
|
+
(_b = this.process.stdout) == null ? void 0 : _b.on("data", (chunk) => {
|
|
28255
|
+
this.readBuffer.append(chunk);
|
|
28256
|
+
this.processReadBuffer();
|
|
28257
|
+
});
|
|
28258
|
+
(_c = this.process.stdout) == null ? void 0 : _c.on("error", (error2) => {
|
|
28259
|
+
var _a4;
|
|
28260
|
+
return (_a4 = this.onerror) == null ? void 0 : _a4.call(this, error2);
|
|
28261
|
+
});
|
|
28262
|
+
if (this.stderrStream && this.process.stderr) {
|
|
28263
|
+
this.process.stderr.pipe(this.stderrStream);
|
|
28264
|
+
}
|
|
28265
|
+
});
|
|
28266
|
+
}
|
|
28267
|
+
get stderr() {
|
|
28268
|
+
var _a3;
|
|
28269
|
+
return this.stderrStream || ((_a3 = this.process) == null ? void 0 : _a3.stderr) || null;
|
|
28270
|
+
}
|
|
28271
|
+
get pid() {
|
|
28272
|
+
var _a3;
|
|
28273
|
+
return ((_a3 = this.process) == null ? void 0 : _a3.pid) ?? null;
|
|
28274
|
+
}
|
|
28275
|
+
async close() {
|
|
28276
|
+
this.abortController.abort();
|
|
28277
|
+
this.process = void 0;
|
|
28278
|
+
this.readBuffer.clear();
|
|
28279
|
+
}
|
|
28280
|
+
async send(message) {
|
|
28281
|
+
var _a3;
|
|
28282
|
+
const stdin = (_a3 = this.process) == null ? void 0 : _a3.stdin;
|
|
28283
|
+
if (!stdin) {
|
|
28284
|
+
throw new Error("Not connected");
|
|
28285
|
+
}
|
|
28286
|
+
const json2 = serializeMessage(message);
|
|
28287
|
+
if (stdin.write(json2)) {
|
|
28288
|
+
return;
|
|
28289
|
+
}
|
|
28290
|
+
await new Promise((resolve) => stdin.once("drain", resolve));
|
|
28291
|
+
}
|
|
28292
|
+
processReadBuffer() {
|
|
28293
|
+
var _a3, _b;
|
|
28294
|
+
for (; ; ) {
|
|
28295
|
+
try {
|
|
28296
|
+
const message = this.readBuffer.readMessage();
|
|
28297
|
+
if (message === null) {
|
|
28298
|
+
break;
|
|
28299
|
+
}
|
|
28300
|
+
(_a3 = this.onmessage) == null ? void 0 : _a3.call(this, message);
|
|
28301
|
+
} catch (error2) {
|
|
28302
|
+
(_b = this.onerror) == null ? void 0 : _b.call(this, error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
28303
|
+
}
|
|
28304
|
+
}
|
|
28305
|
+
}
|
|
28306
|
+
};
|
|
28307
|
+
|
|
28308
|
+
// src/maker/cli/projects.ts
|
|
28309
|
+
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
28310
|
+
import fs5 from "node:fs";
|
|
28311
|
+
import path6 from "node:path";
|
|
28312
|
+
|
|
28313
|
+
// src/maker/config.ts
|
|
28314
|
+
import fs3 from "node:fs";
|
|
28315
|
+
import path4 from "node:path";
|
|
28150
28316
|
|
|
28151
28317
|
// src/core/utils/env.ts
|
|
28152
|
-
import * as
|
|
28318
|
+
import * as path3 from "node:path";
|
|
28153
28319
|
import * as os2 from "node:os";
|
|
28154
28320
|
import process5 from "node:process";
|
|
28155
28321
|
var ENVIRONMENT_ENDPOINTS = {
|
|
@@ -28245,11 +28411,11 @@ var EnvConfig = class {
|
|
|
28245
28411
|
// --------------------------------------------------------------------------
|
|
28246
28412
|
/** 缓存目录 */
|
|
28247
28413
|
static get cacheDir() {
|
|
28248
|
-
return getEnv("TAPTAP_MCP_CACHE_DIR",
|
|
28414
|
+
return getEnv("TAPTAP_MCP_CACHE_DIR", path3.join(os2.tmpdir(), "taptap-mcp", "cache"));
|
|
28249
28415
|
}
|
|
28250
28416
|
/** 临时文件目录 */
|
|
28251
28417
|
static get tempDir() {
|
|
28252
|
-
return getEnv("TAPTAP_MCP_TEMP_DIR",
|
|
28418
|
+
return getEnv("TAPTAP_MCP_TEMP_DIR", path3.join(os2.tmpdir(), "taptap-mcp", "temp"));
|
|
28253
28419
|
}
|
|
28254
28420
|
/** 工作区根目录 */
|
|
28255
28421
|
static get workspaceRoot() {
|
|
@@ -28390,6 +28556,8 @@ var MAKER_ENDPOINTS = {
|
|
|
28390
28556
|
remoteMcpServerUrl: "https://fuping.agnt.xd.com/mcp/v1"
|
|
28391
28557
|
}
|
|
28392
28558
|
};
|
|
28559
|
+
var MAKER_PROJECT_ENV_CONFIG_FILE = path4.join(".maker", "taptap-maker.local.json");
|
|
28560
|
+
var makerEnvironmentOverride;
|
|
28393
28561
|
var MAKER_ENV_OVERRIDES = {
|
|
28394
28562
|
apiBase: {
|
|
28395
28563
|
current: "TAPTAP_MAKER_API_BASE",
|
|
@@ -28416,8 +28584,21 @@ var MAKER_ENV_OVERRIDES = {
|
|
|
28416
28584
|
legacy: "MAKER_WEB_URL"
|
|
28417
28585
|
}
|
|
28418
28586
|
};
|
|
28419
|
-
function
|
|
28420
|
-
|
|
28587
|
+
function setMakerEnvironmentOverride(environment) {
|
|
28588
|
+
makerEnvironmentOverride = environment;
|
|
28589
|
+
}
|
|
28590
|
+
function getMakerEnvironment(environment, cwd = process.cwd()) {
|
|
28591
|
+
if (environment) {
|
|
28592
|
+
return environment;
|
|
28593
|
+
}
|
|
28594
|
+
if (makerEnvironmentOverride) {
|
|
28595
|
+
return makerEnvironmentOverride;
|
|
28596
|
+
}
|
|
28597
|
+
const envValue = process.env.TAPTAP_MCP_ENV;
|
|
28598
|
+
if (envValue === "rnd" || envValue === "production") {
|
|
28599
|
+
return envValue;
|
|
28600
|
+
}
|
|
28601
|
+
return getProjectLocalEnvironment(cwd) || EnvConfig.environment;
|
|
28421
28602
|
}
|
|
28422
28603
|
function getMakerEndpoints(environment) {
|
|
28423
28604
|
const env = getMakerEnvironment(environment);
|
|
@@ -28435,8 +28616,23 @@ function getMakerWebUrl(environment) {
|
|
|
28435
28616
|
const endpoints = getMakerEndpoints(environment);
|
|
28436
28617
|
return requireMakerEndpoint("webUrl", endpoints.webUrl, environment).replace(/\/$/, "");
|
|
28437
28618
|
}
|
|
28438
|
-
function
|
|
28439
|
-
|
|
28619
|
+
function getMakerApiBaseUrl(environment) {
|
|
28620
|
+
const endpoints = getMakerEndpoints(environment);
|
|
28621
|
+
return requireMakerEndpoint("apiBase", endpoints.apiBase, environment).replace(/\/$/, "");
|
|
28622
|
+
}
|
|
28623
|
+
function getMakerProjectEnvironmentConfigPath(cwd = process.cwd()) {
|
|
28624
|
+
let current = path4.resolve(cwd);
|
|
28625
|
+
for (; ; ) {
|
|
28626
|
+
const candidate = path4.join(current, MAKER_PROJECT_ENV_CONFIG_FILE);
|
|
28627
|
+
if (fs3.existsSync(candidate)) {
|
|
28628
|
+
return candidate;
|
|
28629
|
+
}
|
|
28630
|
+
const parent = path4.dirname(current);
|
|
28631
|
+
if (parent === current) {
|
|
28632
|
+
return void 0;
|
|
28633
|
+
}
|
|
28634
|
+
current = parent;
|
|
28635
|
+
}
|
|
28440
28636
|
}
|
|
28441
28637
|
function requireMakerEndpoint(name, value, environment) {
|
|
28442
28638
|
if (!value) {
|
|
@@ -28456,168 +28652,21 @@ function requireMakerEndpoint(name, value, environment) {
|
|
|
28456
28652
|
function getOverride(envNames) {
|
|
28457
28653
|
return process.env[envNames.current] || process.env[envNames.legacy];
|
|
28458
28654
|
}
|
|
28459
|
-
|
|
28460
|
-
|
|
28461
|
-
|
|
28655
|
+
function getProjectLocalEnvironment(cwd) {
|
|
28656
|
+
const configPath = getMakerProjectEnvironmentConfigPath(cwd);
|
|
28657
|
+
if (!configPath) {
|
|
28658
|
+
return void 0;
|
|
28659
|
+
}
|
|
28462
28660
|
try {
|
|
28463
|
-
const
|
|
28464
|
-
|
|
28661
|
+
const raw = fs3.readFileSync(configPath, "utf8");
|
|
28662
|
+
const data = JSON.parse(raw);
|
|
28663
|
+
const env = data.env || data.environment;
|
|
28664
|
+
return env === "rnd" || env === "production" ? env : void 0;
|
|
28465
28665
|
} catch {
|
|
28466
|
-
return
|
|
28467
|
-
}
|
|
28468
|
-
}
|
|
28469
|
-
function findProjectConfig(startDir = process.cwd()) {
|
|
28470
|
-
let current = path3.resolve(startDir);
|
|
28471
|
-
while (current.length > 0) {
|
|
28472
|
-
const configPath = getProjectConfigPath(current);
|
|
28473
|
-
if (fs2.existsSync(configPath)) {
|
|
28474
|
-
const config2 = parseConfig(configPath);
|
|
28475
|
-
if (config2) {
|
|
28476
|
-
return {
|
|
28477
|
-
projectId: config2.project_id,
|
|
28478
|
-
configPath,
|
|
28479
|
-
projectRoot: current,
|
|
28480
|
-
config: config2,
|
|
28481
|
-
source: "cwd"
|
|
28482
|
-
};
|
|
28483
|
-
}
|
|
28484
|
-
}
|
|
28485
|
-
const parent = path3.dirname(current);
|
|
28486
|
-
if (parent === current) {
|
|
28487
|
-
return { source: "none" };
|
|
28488
|
-
}
|
|
28489
|
-
current = parent;
|
|
28490
|
-
}
|
|
28491
|
-
return { source: "none" };
|
|
28492
|
-
}
|
|
28493
|
-
function identifyMakerProject(options) {
|
|
28494
|
-
if (options == null ? void 0 : options.projectId) {
|
|
28495
|
-
return {
|
|
28496
|
-
projectId: options.projectId,
|
|
28497
|
-
source: "argv"
|
|
28498
|
-
};
|
|
28499
|
-
}
|
|
28500
|
-
if (process.env.MAKER_PROJECT_ID) {
|
|
28501
|
-
return {
|
|
28502
|
-
projectId: process.env.MAKER_PROJECT_ID,
|
|
28503
|
-
source: "env"
|
|
28504
|
-
};
|
|
28666
|
+
return void 0;
|
|
28505
28667
|
}
|
|
28506
|
-
return findProjectConfig((options == null ? void 0 : options.cwd) || process.cwd());
|
|
28507
|
-
}
|
|
28508
|
-
function formatIdentifyHint() {
|
|
28509
|
-
return [
|
|
28510
|
-
"当前目录尚未绑定 Maker 项目。",
|
|
28511
|
-
"",
|
|
28512
|
-
"初始化流程请参考 taptap-maker-local skill。",
|
|
28513
|
-
`Maker PAT 页面:${getMakerPatTokensUrl()}`,
|
|
28514
|
-
"",
|
|
28515
|
-
`clone 成功后会在当前目录写入 ${getProjectMarkerDirName()}/config.json。`
|
|
28516
|
-
].join("\n");
|
|
28517
28668
|
}
|
|
28518
28669
|
|
|
28519
|
-
// src/maker/server/hiddenStdioTransport.ts
|
|
28520
|
-
import { spawn as spawn2 } from "node:child_process";
|
|
28521
|
-
import { PassThrough as PassThrough2 } from "node:stream";
|
|
28522
|
-
var HiddenStdioClientTransport = class {
|
|
28523
|
-
constructor(serverParams) {
|
|
28524
|
-
this.serverParams = serverParams;
|
|
28525
|
-
this.abortController = new AbortController();
|
|
28526
|
-
this.readBuffer = new ReadBuffer();
|
|
28527
|
-
this.stderrStream = serverParams.stderr === "pipe" || serverParams.stderr === "overlapped" ? new PassThrough2() : null;
|
|
28528
|
-
}
|
|
28529
|
-
async start() {
|
|
28530
|
-
if (this.process) {
|
|
28531
|
-
throw new Error("HiddenStdioClientTransport already started.");
|
|
28532
|
-
}
|
|
28533
|
-
await new Promise((resolve, reject) => {
|
|
28534
|
-
var _a3, _b, _c;
|
|
28535
|
-
this.process = spawn2(this.serverParams.command, this.serverParams.args ?? [], {
|
|
28536
|
-
env: this.serverParams.env,
|
|
28537
|
-
stdio: ["pipe", "pipe", this.serverParams.stderr ?? "inherit"],
|
|
28538
|
-
shell: false,
|
|
28539
|
-
signal: this.abortController.signal,
|
|
28540
|
-
windowsHide: true,
|
|
28541
|
-
cwd: this.serverParams.cwd
|
|
28542
|
-
});
|
|
28543
|
-
this.process.on("error", (error2) => {
|
|
28544
|
-
var _a4, _b2;
|
|
28545
|
-
if (error2.name === "AbortError") {
|
|
28546
|
-
(_a4 = this.onclose) == null ? void 0 : _a4.call(this);
|
|
28547
|
-
return;
|
|
28548
|
-
}
|
|
28549
|
-
reject(error2);
|
|
28550
|
-
(_b2 = this.onerror) == null ? void 0 : _b2.call(this, error2);
|
|
28551
|
-
});
|
|
28552
|
-
this.process.on("spawn", () => resolve());
|
|
28553
|
-
this.process.on("close", () => {
|
|
28554
|
-
var _a4;
|
|
28555
|
-
this.process = void 0;
|
|
28556
|
-
(_a4 = this.onclose) == null ? void 0 : _a4.call(this);
|
|
28557
|
-
});
|
|
28558
|
-
(_a3 = this.process.stdin) == null ? void 0 : _a3.on("error", (error2) => {
|
|
28559
|
-
var _a4;
|
|
28560
|
-
return (_a4 = this.onerror) == null ? void 0 : _a4.call(this, error2);
|
|
28561
|
-
});
|
|
28562
|
-
(_b = this.process.stdout) == null ? void 0 : _b.on("data", (chunk) => {
|
|
28563
|
-
this.readBuffer.append(chunk);
|
|
28564
|
-
this.processReadBuffer();
|
|
28565
|
-
});
|
|
28566
|
-
(_c = this.process.stdout) == null ? void 0 : _c.on("error", (error2) => {
|
|
28567
|
-
var _a4;
|
|
28568
|
-
return (_a4 = this.onerror) == null ? void 0 : _a4.call(this, error2);
|
|
28569
|
-
});
|
|
28570
|
-
if (this.stderrStream && this.process.stderr) {
|
|
28571
|
-
this.process.stderr.pipe(this.stderrStream);
|
|
28572
|
-
}
|
|
28573
|
-
});
|
|
28574
|
-
}
|
|
28575
|
-
get stderr() {
|
|
28576
|
-
var _a3;
|
|
28577
|
-
return this.stderrStream || ((_a3 = this.process) == null ? void 0 : _a3.stderr) || null;
|
|
28578
|
-
}
|
|
28579
|
-
get pid() {
|
|
28580
|
-
var _a3;
|
|
28581
|
-
return ((_a3 = this.process) == null ? void 0 : _a3.pid) ?? null;
|
|
28582
|
-
}
|
|
28583
|
-
async close() {
|
|
28584
|
-
this.abortController.abort();
|
|
28585
|
-
this.process = void 0;
|
|
28586
|
-
this.readBuffer.clear();
|
|
28587
|
-
}
|
|
28588
|
-
async send(message) {
|
|
28589
|
-
var _a3;
|
|
28590
|
-
const stdin = (_a3 = this.process) == null ? void 0 : _a3.stdin;
|
|
28591
|
-
if (!stdin) {
|
|
28592
|
-
throw new Error("Not connected");
|
|
28593
|
-
}
|
|
28594
|
-
const json2 = serializeMessage(message);
|
|
28595
|
-
if (stdin.write(json2)) {
|
|
28596
|
-
return;
|
|
28597
|
-
}
|
|
28598
|
-
await new Promise((resolve) => stdin.once("drain", resolve));
|
|
28599
|
-
}
|
|
28600
|
-
processReadBuffer() {
|
|
28601
|
-
var _a3, _b;
|
|
28602
|
-
for (; ; ) {
|
|
28603
|
-
try {
|
|
28604
|
-
const message = this.readBuffer.readMessage();
|
|
28605
|
-
if (message === null) {
|
|
28606
|
-
break;
|
|
28607
|
-
}
|
|
28608
|
-
(_a3 = this.onmessage) == null ? void 0 : _a3.call(this, message);
|
|
28609
|
-
} catch (error2) {
|
|
28610
|
-
(_b = this.onerror) == null ? void 0 : _b.call(this, error2 instanceof Error ? error2 : new Error(String(error2)));
|
|
28611
|
-
}
|
|
28612
|
-
}
|
|
28613
|
-
}
|
|
28614
|
-
};
|
|
28615
|
-
|
|
28616
|
-
// src/maker/cli/projects.ts
|
|
28617
|
-
import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
|
|
28618
|
-
import fs4 from "node:fs";
|
|
28619
|
-
import path5 from "node:path";
|
|
28620
|
-
|
|
28621
28670
|
// src/maker/auth/jwt.ts
|
|
28622
28671
|
var MAKER_JWT_ENV = "MAKER_JWT";
|
|
28623
28672
|
var SHORT_JWT_ENV = "JWT";
|
|
@@ -28720,8 +28769,8 @@ function requireMakerPat(manualPat) {
|
|
|
28720
28769
|
throw new Error(
|
|
28721
28770
|
[
|
|
28722
28771
|
"Maker PAT not found.",
|
|
28723
|
-
"
|
|
28724
|
-
"or
|
|
28772
|
+
"Run `taptap-maker login` to complete Maker CLI login,",
|
|
28773
|
+
"or provide MAKER_PAT/PAT only for CI/emergency fallback."
|
|
28725
28774
|
].join(" ")
|
|
28726
28775
|
);
|
|
28727
28776
|
}
|
|
@@ -28756,9 +28805,8 @@ async function requestMakerPat(options) {
|
|
|
28756
28805
|
throw new Error(
|
|
28757
28806
|
[
|
|
28758
28807
|
"Maker PAT not found.",
|
|
28759
|
-
"
|
|
28760
|
-
"or
|
|
28761
|
-
"Creating a new PAT still requires a legacy Maker JWT."
|
|
28808
|
+
"Run `taptap-maker login` to complete Maker CLI login,",
|
|
28809
|
+
"or provide MAKER_PAT/PAT only for CI/emergency fallback."
|
|
28762
28810
|
].join(" ")
|
|
28763
28811
|
);
|
|
28764
28812
|
}
|
|
@@ -28876,14 +28924,45 @@ function formatGitMissingMessage(environment) {
|
|
|
28876
28924
|
|
|
28877
28925
|
// src/maker/cli/devKit.ts
|
|
28878
28926
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
28879
|
-
import
|
|
28927
|
+
import fs4 from "node:fs";
|
|
28880
28928
|
import os3 from "node:os";
|
|
28881
|
-
import
|
|
28929
|
+
import path5 from "node:path";
|
|
28930
|
+
|
|
28931
|
+
// src/maker/fetchTimeout.ts
|
|
28932
|
+
var DEFAULT_SHORT_FETCH_TIMEOUT_MS = 10 * 1e3;
|
|
28933
|
+
var DEFAULT_DOWNLOAD_FETCH_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
28934
|
+
async function fetchWithTimeout(fetchImpl, url2, init, timeoutMs, label) {
|
|
28935
|
+
const controller = new AbortController();
|
|
28936
|
+
const timer = setTimeout(() => {
|
|
28937
|
+
controller.abort();
|
|
28938
|
+
}, timeoutMs);
|
|
28939
|
+
try {
|
|
28940
|
+
return await fetchImpl(url2, {
|
|
28941
|
+
...init,
|
|
28942
|
+
signal: controller.signal
|
|
28943
|
+
});
|
|
28944
|
+
} catch (error2) {
|
|
28945
|
+
if (controller.signal.aborted) {
|
|
28946
|
+
throw new Error(`${label} timed out after ${timeoutMs}ms`);
|
|
28947
|
+
}
|
|
28948
|
+
throw error2;
|
|
28949
|
+
} finally {
|
|
28950
|
+
clearTimeout(timer);
|
|
28951
|
+
}
|
|
28952
|
+
}
|
|
28953
|
+
|
|
28954
|
+
// src/maker/cli/devKit.ts
|
|
28882
28955
|
var AI_DEV_KIT_URLS = {
|
|
28883
28956
|
production: "https://urhox-demo-platform.spark.xd.com/ai-dev-kit/pd/stable/ai-dev-kit.zip",
|
|
28884
28957
|
rnd: "https://urhox-demo-platform.spark.xd.com/ai-dev-kit/rnd/latest/ai-dev-kit.zip"
|
|
28885
28958
|
};
|
|
28886
28959
|
var DEFAULT_AI_DEV_KIT_URL = AI_DEV_KIT_URLS.production;
|
|
28960
|
+
var AI_DEV_KIT_VERSION_METADATA_FILE = path5.join(".maker", "ai-dev-kit-version.json");
|
|
28961
|
+
var AI_DEV_KIT_DOWNLOAD_ENV = {
|
|
28962
|
+
production: "pd",
|
|
28963
|
+
rnd: "rnd"
|
|
28964
|
+
};
|
|
28965
|
+
var AI_DEV_KIT_VERSION_PATTERN = /^[A-Za-z0-9._-]{1,128}$/;
|
|
28887
28966
|
function resolveDefaultAiDevKitUrl(environment = EnvConfig.environment) {
|
|
28888
28967
|
return AI_DEV_KIT_URLS[environment] || AI_DEV_KIT_URLS.production;
|
|
28889
28968
|
}
|
|
@@ -28916,9 +28995,9 @@ var DEV_KIT_MANAGED_ENTRY_CANDIDATES = [
|
|
|
28916
28995
|
var SKIPPED_TOP_LEVEL_ENTRIES = /* @__PURE__ */ new Set(["scripts", ".DS_Store", "ai-dev-kit.zip"]);
|
|
28917
28996
|
var SKILL_INSTALLER_OUTPUT_ENTRIES = [".claude", ".codex", ".cursor", ".gemini"];
|
|
28918
28997
|
function inspectAiDevKit(targetDir) {
|
|
28919
|
-
const resolvedTargetDir =
|
|
28998
|
+
const resolvedTargetDir = path5.resolve(targetDir);
|
|
28920
28999
|
const presentEntries = DEV_KIT_REQUIRED_ENTRIES.filter(
|
|
28921
|
-
(entry) =>
|
|
29000
|
+
(entry) => fs4.existsSync(path5.join(resolvedTargetDir, entry))
|
|
28922
29001
|
);
|
|
28923
29002
|
const missingEntries = DEV_KIT_REQUIRED_ENTRIES.filter(
|
|
28924
29003
|
(entry) => !presentEntries.includes(entry)
|
|
@@ -28928,29 +29007,138 @@ function inspectAiDevKit(targetDir) {
|
|
|
28928
29007
|
requiredEntries: [...DEV_KIT_REQUIRED_ENTRIES],
|
|
28929
29008
|
presentEntries,
|
|
28930
29009
|
missingEntries,
|
|
28931
|
-
ready: missingEntries.length === 0
|
|
29010
|
+
ready: missingEntries.length === 0,
|
|
29011
|
+
installedVersion: readAiDevKitVersionMetadata(resolvedTargetDir)
|
|
29012
|
+
};
|
|
29013
|
+
}
|
|
29014
|
+
function getAiDevKitVersionMetadataPath(targetDir) {
|
|
29015
|
+
return path5.join(path5.resolve(targetDir), AI_DEV_KIT_VERSION_METADATA_FILE);
|
|
29016
|
+
}
|
|
29017
|
+
function readAiDevKitVersionMetadata(targetDir) {
|
|
29018
|
+
const metadataPath = getAiDevKitVersionMetadataPath(targetDir);
|
|
29019
|
+
if (!fs4.existsSync(metadataPath)) {
|
|
29020
|
+
return void 0;
|
|
29021
|
+
}
|
|
29022
|
+
try {
|
|
29023
|
+
const data = JSON.parse(
|
|
29024
|
+
fs4.readFileSync(metadataPath, "utf8")
|
|
29025
|
+
);
|
|
29026
|
+
if (data.env !== "production" && data.env !== "rnd" || !isValidDevKitVersion(data.version) || typeof data.source_url !== "string" || typeof data.installed_at !== "string") {
|
|
29027
|
+
return void 0;
|
|
29028
|
+
}
|
|
29029
|
+
return data;
|
|
29030
|
+
} catch {
|
|
29031
|
+
return void 0;
|
|
29032
|
+
}
|
|
29033
|
+
}
|
|
29034
|
+
function writeAiDevKitVersionMetadata(targetDir, metadata) {
|
|
29035
|
+
const metadataPath = getAiDevKitVersionMetadataPath(targetDir);
|
|
29036
|
+
fs4.mkdirSync(path5.dirname(metadataPath), { recursive: true });
|
|
29037
|
+
fs4.writeFileSync(metadataPath, `${JSON.stringify(metadata, null, 2)}
|
|
29038
|
+
`, "utf8");
|
|
29039
|
+
}
|
|
29040
|
+
async function fetchAiDevKitVersions(options = {}) {
|
|
29041
|
+
const env = getMakerEnvironment(options.environment);
|
|
29042
|
+
const versionsUrl = getAiDevKitVersionsUrl(env);
|
|
29043
|
+
const fetchFn = options.fetchImpl || fetch;
|
|
29044
|
+
const response = await fetchWithTimeout(
|
|
29045
|
+
fetchFn,
|
|
29046
|
+
versionsUrl,
|
|
29047
|
+
{
|
|
29048
|
+
headers: {
|
|
29049
|
+
Accept: "application/json"
|
|
29050
|
+
}
|
|
29051
|
+
},
|
|
29052
|
+
options.timeoutMs ?? DEFAULT_SHORT_FETCH_TIMEOUT_MS,
|
|
29053
|
+
"AI dev kit version check"
|
|
29054
|
+
);
|
|
29055
|
+
if (!response.ok) {
|
|
29056
|
+
throw new Error(
|
|
29057
|
+
`AI dev kit version check failed: HTTP ${response.status} ${response.statusText}`
|
|
29058
|
+
);
|
|
29059
|
+
}
|
|
29060
|
+
const payload = await response.json();
|
|
29061
|
+
if (!payload.current || !isValidDevKitVersion(payload.current.version)) {
|
|
29062
|
+
throw new Error("AI dev kit version check failed: missing current.version");
|
|
29063
|
+
}
|
|
29064
|
+
return payload;
|
|
29065
|
+
}
|
|
29066
|
+
async function resolveAiDevKitDownload(options = {}) {
|
|
29067
|
+
const env = getMakerEnvironment(options.environment);
|
|
29068
|
+
const versionsUrl = getAiDevKitVersionsUrl(env);
|
|
29069
|
+
try {
|
|
29070
|
+
const version2 = await fetchAiDevKitVersions({
|
|
29071
|
+
environment: env,
|
|
29072
|
+
fetchImpl: options.fetchImpl,
|
|
29073
|
+
timeoutMs: options.versionCheckTimeoutMs
|
|
29074
|
+
});
|
|
29075
|
+
return {
|
|
29076
|
+
environment: env,
|
|
29077
|
+
url: getAiDevKitDownloadUrl(env, version2.current.version),
|
|
29078
|
+
versionsUrl,
|
|
29079
|
+
version: version2
|
|
29080
|
+
};
|
|
29081
|
+
} catch (error2) {
|
|
29082
|
+
return {
|
|
29083
|
+
environment: env,
|
|
29084
|
+
url: resolveDefaultAiDevKitUrl(env),
|
|
29085
|
+
versionsUrl,
|
|
29086
|
+
versionCheckError: error2 instanceof Error ? error2.message : String(error2)
|
|
29087
|
+
};
|
|
29088
|
+
}
|
|
29089
|
+
}
|
|
29090
|
+
async function checkAiDevKitUpdate(targetDir, options = {}) {
|
|
29091
|
+
var _a3;
|
|
29092
|
+
const resolvedTargetDir = path5.resolve(targetDir);
|
|
29093
|
+
const installed = readAiDevKitVersionMetadata(resolvedTargetDir);
|
|
29094
|
+
const download = await resolveAiDevKitDownload({
|
|
29095
|
+
environment: options.environment,
|
|
29096
|
+
fetchImpl: options.fetchImpl,
|
|
29097
|
+
versionCheckTimeoutMs: options.versionCheckTimeoutMs
|
|
29098
|
+
});
|
|
29099
|
+
const latest = (_a3 = download.version) == null ? void 0 : _a3.current;
|
|
29100
|
+
return {
|
|
29101
|
+
targetDir: resolvedTargetDir,
|
|
29102
|
+
installed,
|
|
29103
|
+
latest,
|
|
29104
|
+
latestDownloadUrl: download.url,
|
|
29105
|
+
updateAvailable: Boolean(latest && (!installed || installed.version !== latest.version)),
|
|
29106
|
+
versionCheckError: download.versionCheckError
|
|
28932
29107
|
};
|
|
28933
29108
|
}
|
|
28934
29109
|
function listPresentDevKitManagedEntries(targetDir) {
|
|
28935
|
-
const resolvedTargetDir =
|
|
29110
|
+
const resolvedTargetDir = path5.resolve(targetDir);
|
|
28936
29111
|
return DEV_KIT_MANAGED_ENTRY_CANDIDATES.filter(
|
|
28937
|
-
(entry) =>
|
|
29112
|
+
(entry) => fs4.existsSync(path5.join(resolvedTargetDir, entry))
|
|
28938
29113
|
);
|
|
28939
29114
|
}
|
|
28940
29115
|
async function installAiDevKit(options = {}) {
|
|
28941
|
-
|
|
28942
|
-
|
|
28943
|
-
|
|
29116
|
+
var _a3;
|
|
29117
|
+
const targetDir = path5.resolve(options.targetDir || ".");
|
|
29118
|
+
fs4.mkdirSync(targetDir, { recursive: true });
|
|
29119
|
+
const download = options.sourceDir ? void 0 : options.url ? void 0 : await resolveAiDevKitDownload({
|
|
29120
|
+
environment: options.environment,
|
|
29121
|
+
fetchImpl: options.fetchImpl,
|
|
29122
|
+
versionCheckTimeoutMs: options.versionCheckTimeoutMs
|
|
29123
|
+
});
|
|
29124
|
+
const downloadUrl = options.url || (download == null ? void 0 : download.url) || resolveDefaultAiDevKitUrl(options.environment);
|
|
29125
|
+
const preparedSource = options.sourceDir ? path5.resolve(options.sourceDir) : await downloadAndExtractDevKit(downloadUrl, options.fetchImpl, options.downloadTimeoutMs);
|
|
28944
29126
|
const sourceDir = resolveDevKitRoot(preparedSource);
|
|
28945
|
-
const entries =
|
|
29127
|
+
const entries = fs4.readdirSync(sourceDir, { withFileTypes: true });
|
|
28946
29128
|
const installedEntries = [];
|
|
28947
29129
|
const skippedEntries = [];
|
|
29130
|
+
if (options.replaceManagedEntries) {
|
|
29131
|
+
replaceDevKitManagedEntries(
|
|
29132
|
+
targetDir,
|
|
29133
|
+
entries.map((entry) => entry.name)
|
|
29134
|
+
);
|
|
29135
|
+
}
|
|
28948
29136
|
for (const entry of entries) {
|
|
28949
29137
|
if (SKIPPED_TOP_LEVEL_ENTRIES.has(entry.name)) {
|
|
28950
29138
|
skippedEntries.push(entry.name);
|
|
28951
29139
|
continue;
|
|
28952
29140
|
}
|
|
28953
|
-
copyEntry(
|
|
29141
|
+
copyEntry(path5.join(sourceDir, entry.name), path5.join(targetDir, entry.name), {
|
|
28954
29142
|
preserveExisting: options.preserveExisting
|
|
28955
29143
|
});
|
|
28956
29144
|
installedEntries.push(entry.name);
|
|
@@ -28964,27 +29152,35 @@ async function installAiDevKit(options = {}) {
|
|
|
28964
29152
|
installedEntries.push(entry);
|
|
28965
29153
|
}
|
|
28966
29154
|
}
|
|
28967
|
-
const stagedGitignorePath =
|
|
29155
|
+
const stagedGitignorePath = path5.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
28968
29156
|
writeDevKitStagedGitignore(stagedGitignorePath, [
|
|
28969
29157
|
...installedEntries,
|
|
28970
29158
|
...listPresentSkillInstallerOutputEntries(targetDir)
|
|
28971
29159
|
]);
|
|
29160
|
+
const versionMetadata = ((_a3 = download == null ? void 0 : download.version) == null ? void 0 : _a3.current) && writeResolvedDevKitVersionMetadata(
|
|
29161
|
+
targetDir,
|
|
29162
|
+
download.environment,
|
|
29163
|
+
download.url,
|
|
29164
|
+
download.version.current
|
|
29165
|
+
);
|
|
28972
29166
|
return {
|
|
28973
29167
|
targetDir,
|
|
28974
29168
|
sourceDir,
|
|
28975
29169
|
installedEntries: installedEntries.sort(),
|
|
28976
29170
|
skippedEntries: skippedEntries.sort(),
|
|
28977
|
-
gitignorePath:
|
|
29171
|
+
gitignorePath: path5.join(targetDir, ".gitignore"),
|
|
28978
29172
|
stagedGitignorePath,
|
|
28979
|
-
skillInstaller
|
|
29173
|
+
skillInstaller,
|
|
29174
|
+
download,
|
|
29175
|
+
versionMetadata
|
|
28980
29176
|
};
|
|
28981
29177
|
}
|
|
28982
29178
|
function inspectAiDevKitSkillInstallStatus(targetDir) {
|
|
28983
|
-
const resolvedTargetDir =
|
|
29179
|
+
const resolvedTargetDir = path5.resolve(targetDir);
|
|
28984
29180
|
const targets = SKILL_INSTALLER_OUTPUT_ENTRIES.map((entry) => {
|
|
28985
|
-
const skillsDir =
|
|
28986
|
-
const present =
|
|
28987
|
-
const skillCount = present ?
|
|
29181
|
+
const skillsDir = path5.join(resolvedTargetDir, entry, "skills");
|
|
29182
|
+
const present = fs4.existsSync(skillsDir) && fs4.statSync(skillsDir).isDirectory();
|
|
29183
|
+
const skillCount = present ? fs4.readdirSync(skillsDir, { withFileTypes: true }).filter((item) => item.isDirectory() || item.isSymbolicLink()).length : 0;
|
|
28988
29184
|
return {
|
|
28989
29185
|
name: entry.replace(/^\./, ""),
|
|
28990
29186
|
path: skillsDir,
|
|
@@ -29007,15 +29203,15 @@ function createDevKitGitignoreBlock(entries) {
|
|
|
29007
29203
|
return [DEV_KIT_IGNORE_BEGIN, ...ignoreEntries, DEV_KIT_IGNORE_END].join("\n");
|
|
29008
29204
|
}
|
|
29009
29205
|
function writeDevKitStagedGitignore(stagedGitignorePath, entries) {
|
|
29010
|
-
|
|
29206
|
+
fs4.writeFileSync(stagedGitignorePath, `${createDevKitGitignoreBlock(entries)}
|
|
29011
29207
|
`, "utf8");
|
|
29012
29208
|
}
|
|
29013
29209
|
function ensureMakerAssetPolicyInstructionFiles(targetDir) {
|
|
29014
|
-
const resolvedTargetDir =
|
|
29015
|
-
|
|
29016
|
-
const agentsPath =
|
|
29017
|
-
const existingAgents =
|
|
29018
|
-
|
|
29210
|
+
const resolvedTargetDir = path5.resolve(targetDir);
|
|
29211
|
+
fs4.mkdirSync(resolvedTargetDir, { recursive: true });
|
|
29212
|
+
const agentsPath = path5.join(resolvedTargetDir, AGENTS_INSTRUCTION_FILE);
|
|
29213
|
+
const existingAgents = fs4.existsSync(agentsPath) ? fs4.readFileSync(agentsPath, "utf8") : "";
|
|
29214
|
+
fs4.writeFileSync(agentsPath, prependMakerAssetPolicyBlock(existingAgents), "utf8");
|
|
29019
29215
|
return [AGENTS_INSTRUCTION_FILE];
|
|
29020
29216
|
}
|
|
29021
29217
|
function prependMakerAssetPolicyBlock(existing) {
|
|
@@ -29070,7 +29266,7 @@ function createMakerAssetPolicyBlock() {
|
|
|
29070
29266
|
].join("\n");
|
|
29071
29267
|
}
|
|
29072
29268
|
function mergeDevKitGitignoreBlock(gitignorePath, block) {
|
|
29073
|
-
const existing =
|
|
29269
|
+
const existing = fs4.existsSync(gitignorePath) ? fs4.readFileSync(gitignorePath, "utf8") : "";
|
|
29074
29270
|
const withoutOldBlock = existing.replace(
|
|
29075
29271
|
new RegExp(
|
|
29076
29272
|
`${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}[\\s\\S]*?${escapeRegExp(DEV_KIT_IGNORE_END)}\\n?`,
|
|
@@ -29079,44 +29275,90 @@ function mergeDevKitGitignoreBlock(gitignorePath, block) {
|
|
|
29079
29275
|
""
|
|
29080
29276
|
).trimEnd();
|
|
29081
29277
|
const next = [withoutOldBlock, block, ""].filter((part) => part.length > 0).join("\n\n");
|
|
29082
|
-
|
|
29278
|
+
fs4.writeFileSync(gitignorePath, next, "utf8");
|
|
29083
29279
|
}
|
|
29084
29280
|
function finalizeStagedDevKitGitignore(targetDir) {
|
|
29085
|
-
const stagedGitignorePath =
|
|
29086
|
-
if (!
|
|
29281
|
+
const stagedGitignorePath = path5.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
29282
|
+
if (!fs4.existsSync(stagedGitignorePath)) {
|
|
29087
29283
|
return false;
|
|
29088
29284
|
}
|
|
29089
|
-
const block =
|
|
29285
|
+
const block = fs4.readFileSync(stagedGitignorePath, "utf8").trim();
|
|
29090
29286
|
if (block.length > 0) {
|
|
29091
|
-
mergeDevKitGitignoreBlock(
|
|
29287
|
+
mergeDevKitGitignoreBlock(path5.join(targetDir, ".gitignore"), block);
|
|
29092
29288
|
}
|
|
29093
|
-
|
|
29289
|
+
fs4.rmSync(stagedGitignorePath, { force: true });
|
|
29094
29290
|
return true;
|
|
29095
29291
|
}
|
|
29096
29292
|
function copyEntry(source, target, options = {}) {
|
|
29097
|
-
const stat =
|
|
29293
|
+
const stat = fs4.statSync(source);
|
|
29098
29294
|
if (stat.isDirectory()) {
|
|
29099
|
-
|
|
29100
|
-
for (const child of
|
|
29295
|
+
fs4.mkdirSync(target, { recursive: true });
|
|
29296
|
+
for (const child of fs4.readdirSync(source)) {
|
|
29101
29297
|
if (child === ".DS_Store") {
|
|
29102
29298
|
continue;
|
|
29103
29299
|
}
|
|
29104
|
-
copyEntry(
|
|
29300
|
+
copyEntry(path5.join(source, child), path5.join(target, child), options);
|
|
29105
29301
|
}
|
|
29106
29302
|
return;
|
|
29107
29303
|
}
|
|
29108
29304
|
if (stat.isFile()) {
|
|
29109
|
-
if (options.preserveExisting &&
|
|
29305
|
+
if (options.preserveExisting && fs4.existsSync(target)) {
|
|
29110
29306
|
return;
|
|
29111
29307
|
}
|
|
29112
|
-
|
|
29113
|
-
|
|
29308
|
+
fs4.mkdirSync(path5.dirname(target), { recursive: true });
|
|
29309
|
+
fs4.copyFileSync(source, target);
|
|
29114
29310
|
}
|
|
29115
29311
|
}
|
|
29312
|
+
function replaceDevKitManagedEntries(targetDir, sourceEntryNames) {
|
|
29313
|
+
const candidates = /* @__PURE__ */ new Set();
|
|
29314
|
+
for (const entry of sourceEntryNames) {
|
|
29315
|
+
if (!SKIPPED_TOP_LEVEL_ENTRIES.has(entry)) {
|
|
29316
|
+
candidates.add(entry);
|
|
29317
|
+
}
|
|
29318
|
+
}
|
|
29319
|
+
for (const entry of readManagedGitignoreEntries(path5.join(targetDir, ".gitignore"))) {
|
|
29320
|
+
candidates.add(entry);
|
|
29321
|
+
}
|
|
29322
|
+
for (const entry of readManagedGitignoreEntries(
|
|
29323
|
+
path5.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE)
|
|
29324
|
+
)) {
|
|
29325
|
+
candidates.add(entry);
|
|
29326
|
+
}
|
|
29327
|
+
for (const entry of candidates) {
|
|
29328
|
+
if (!entry || ALWAYS_IGNORED_LOCAL_ENTRIES.includes(entry)) {
|
|
29329
|
+
continue;
|
|
29330
|
+
}
|
|
29331
|
+
if (!DEV_KIT_MANAGED_ENTRY_CANDIDATES.includes(entry)) {
|
|
29332
|
+
continue;
|
|
29333
|
+
}
|
|
29334
|
+
fs4.rmSync(path5.join(targetDir, entry), { recursive: true, force: true });
|
|
29335
|
+
}
|
|
29336
|
+
}
|
|
29337
|
+
function readManagedGitignoreEntries(gitignorePath) {
|
|
29338
|
+
if (!fs4.existsSync(gitignorePath)) {
|
|
29339
|
+
return [];
|
|
29340
|
+
}
|
|
29341
|
+
const content = fs4.readFileSync(gitignorePath, "utf8");
|
|
29342
|
+
const blockPattern = new RegExp(
|
|
29343
|
+
`${escapeRegExp(DEV_KIT_IGNORE_BEGIN)}\\n([\\s\\S]*?)\\n${escapeRegExp(DEV_KIT_IGNORE_END)}`,
|
|
29344
|
+
"g"
|
|
29345
|
+
);
|
|
29346
|
+
const entries = [];
|
|
29347
|
+
for (const match of content.matchAll(blockPattern)) {
|
|
29348
|
+
const block = match[1] || "";
|
|
29349
|
+
for (const line of block.split(/\r?\n/)) {
|
|
29350
|
+
const entry = line.trim().replace(/\/$/, "");
|
|
29351
|
+
if (entry && !entry.startsWith("#")) {
|
|
29352
|
+
entries.push(entry);
|
|
29353
|
+
}
|
|
29354
|
+
}
|
|
29355
|
+
}
|
|
29356
|
+
return entries;
|
|
29357
|
+
}
|
|
29116
29358
|
function installAiDevKitSkills(targetDir, options = {}) {
|
|
29117
29359
|
var _a3;
|
|
29118
|
-
const toolsDir =
|
|
29119
|
-
if (!
|
|
29360
|
+
const toolsDir = path5.join(targetDir, "tools");
|
|
29361
|
+
if (!fs4.existsSync(toolsDir) || !fs4.statSync(toolsDir).isDirectory()) {
|
|
29120
29362
|
return {
|
|
29121
29363
|
ok: false,
|
|
29122
29364
|
status: "skipped",
|
|
@@ -29128,8 +29370,8 @@ function installAiDevKitSkills(targetDir, options = {}) {
|
|
|
29128
29370
|
}
|
|
29129
29371
|
const isWindows = process.platform === "win32";
|
|
29130
29372
|
const scriptName = isWindows ? "install-skills.ps1" : "install-skills.sh";
|
|
29131
|
-
const scriptPath =
|
|
29132
|
-
if (!
|
|
29373
|
+
const scriptPath = path5.join(toolsDir, scriptName);
|
|
29374
|
+
if (!fs4.existsSync(scriptPath)) {
|
|
29133
29375
|
return {
|
|
29134
29376
|
ok: false,
|
|
29135
29377
|
status: "skipped",
|
|
@@ -29191,20 +29433,48 @@ function runDevKitSkillInstallerForInstall(targetDir, options = {}) {
|
|
|
29191
29433
|
}
|
|
29192
29434
|
function listPresentSkillInstallerOutputEntries(targetDir) {
|
|
29193
29435
|
return SKILL_INSTALLER_OUTPUT_ENTRIES.filter(
|
|
29194
|
-
(entry) =>
|
|
29436
|
+
(entry) => fs4.existsSync(path5.join(targetDir, entry))
|
|
29195
29437
|
);
|
|
29196
29438
|
}
|
|
29197
|
-
|
|
29198
|
-
const
|
|
29199
|
-
const
|
|
29200
|
-
|
|
29439
|
+
function getAiDevKitVersionsUrl(environment) {
|
|
29440
|
+
const endpoints = getMakerEndpoints(environment);
|
|
29441
|
+
const remoteMcpServerUrl = requireMakerEndpoint(
|
|
29442
|
+
"remoteMcpServerUrl",
|
|
29443
|
+
endpoints.remoteMcpServerUrl,
|
|
29444
|
+
environment
|
|
29445
|
+
).replace(/\/$/, "");
|
|
29446
|
+
return `${remoteMcpServerUrl}/ai-dev-kit/versions`;
|
|
29447
|
+
}
|
|
29448
|
+
function getAiDevKitDownloadUrl(environment, version2) {
|
|
29449
|
+
return `https://urhox-demo-platform.spark.xd.com/ai-dev-kit/${AI_DEV_KIT_DOWNLOAD_ENV[environment]}/${version2}/ai-dev-kit.zip`;
|
|
29450
|
+
}
|
|
29451
|
+
function isValidDevKitVersion(version2) {
|
|
29452
|
+
return typeof version2 === "string" && AI_DEV_KIT_VERSION_PATTERN.test(version2);
|
|
29453
|
+
}
|
|
29454
|
+
function writeResolvedDevKitVersionMetadata(targetDir, environment, sourceUrl, current) {
|
|
29455
|
+
const metadata = {
|
|
29456
|
+
env: environment,
|
|
29457
|
+
version: current.version,
|
|
29458
|
+
md5: current.md5,
|
|
29459
|
+
size: current.size,
|
|
29460
|
+
uploaded_at: current.uploaded_at,
|
|
29461
|
+
source_url: sourceUrl,
|
|
29462
|
+
installed_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
29463
|
+
};
|
|
29464
|
+
writeAiDevKitVersionMetadata(targetDir, metadata);
|
|
29465
|
+
return metadata;
|
|
29466
|
+
}
|
|
29467
|
+
async function downloadAndExtractDevKit(url2, fetchImpl = fetch, timeoutMs = DEFAULT_DOWNLOAD_FETCH_TIMEOUT_MS) {
|
|
29468
|
+
const tempDir = fs4.mkdtempSync(path5.join(os3.tmpdir(), "taptap-maker-ai-dev-kit-"));
|
|
29469
|
+
const zipPath = path5.join(tempDir, "ai-dev-kit.zip");
|
|
29470
|
+
const response = await fetchWithTimeout(fetchImpl, url2, {}, timeoutMs, "AI dev kit download");
|
|
29201
29471
|
if (!response.ok) {
|
|
29202
29472
|
throw new Error(`AI dev kit download failed: HTTP ${response.status} ${response.statusText}`);
|
|
29203
29473
|
}
|
|
29204
29474
|
const payload = Buffer.from(await response.arrayBuffer());
|
|
29205
|
-
|
|
29475
|
+
fs4.writeFileSync(zipPath, payload);
|
|
29206
29476
|
extractZip(zipPath, tempDir);
|
|
29207
|
-
|
|
29477
|
+
fs4.rmSync(zipPath, { force: true });
|
|
29208
29478
|
return tempDir;
|
|
29209
29479
|
}
|
|
29210
29480
|
function extractZip(zipPath, targetDir) {
|
|
@@ -29332,11 +29602,11 @@ function shellQuote(value) {
|
|
|
29332
29602
|
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
29333
29603
|
}
|
|
29334
29604
|
function resolveDevKitRoot(sourceDir) {
|
|
29335
|
-
const directEntries =
|
|
29605
|
+
const directEntries = fs4.existsSync(sourceDir) ? fs4.readdirSync(sourceDir) : [];
|
|
29336
29606
|
if (looksLikeDevKitRoot(sourceDir)) {
|
|
29337
29607
|
return sourceDir;
|
|
29338
29608
|
}
|
|
29339
|
-
const childDirs = directEntries.map((entry) =>
|
|
29609
|
+
const childDirs = directEntries.map((entry) => path5.join(sourceDir, entry)).filter((entryPath) => fs4.existsSync(entryPath) && fs4.statSync(entryPath).isDirectory());
|
|
29340
29610
|
for (const childDir of childDirs) {
|
|
29341
29611
|
if (looksLikeDevKitRoot(childDir)) {
|
|
29342
29612
|
return childDir;
|
|
@@ -29345,7 +29615,7 @@ function resolveDevKitRoot(sourceDir) {
|
|
|
29345
29615
|
throw new Error(`AI dev kit root not found under ${sourceDir}`);
|
|
29346
29616
|
}
|
|
29347
29617
|
function looksLikeDevKitRoot(dir) {
|
|
29348
|
-
return
|
|
29618
|
+
return fs4.existsSync(path5.join(dir, "engine-docs")) || fs4.existsSync(path5.join(dir, ".emmylua")) || fs4.existsSync(path5.join(dir, "urhox-libs"));
|
|
29349
29619
|
}
|
|
29350
29620
|
function formatIgnoreEntry(entry) {
|
|
29351
29621
|
if (entry === ".DS_Store") {
|
|
@@ -29463,7 +29733,7 @@ async function listMakerProjects(options) {
|
|
|
29463
29733
|
}
|
|
29464
29734
|
async function cloneMakerProject(options) {
|
|
29465
29735
|
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
29466
|
-
const target =
|
|
29736
|
+
const target = path6.resolve(options.targetDir);
|
|
29467
29737
|
ensureTargetCanBindApp(target, options.appId);
|
|
29468
29738
|
const warnings = createPreCloneWarnings(target);
|
|
29469
29739
|
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
@@ -29629,7 +29899,7 @@ async function pushMakerProject(options) {
|
|
|
29629
29899
|
phase: "prepare",
|
|
29630
29900
|
message: "Preparing Maker project push"
|
|
29631
29901
|
});
|
|
29632
|
-
const requestedCwd =
|
|
29902
|
+
const requestedCwd = path6.resolve(options.cwd);
|
|
29633
29903
|
const workspace = resolveUsableMakerGitWorkspace(requestedCwd);
|
|
29634
29904
|
const cwd = workspace.projectRoot;
|
|
29635
29905
|
const project = loadProjectConfig(cwd);
|
|
@@ -29935,7 +30205,7 @@ async function inspectMakerRemoteSyncStatus(cwd) {
|
|
|
29935
30205
|
}
|
|
29936
30206
|
function getMakerRemoteSyncFailureNextAction(failure) {
|
|
29937
30207
|
if (failure.classification === "auth") {
|
|
29938
|
-
return
|
|
30208
|
+
return "暂时无法检查 Maker 远端是否有新提交:Git 鉴权失败。请运行 `taptap-maker login` 重新完成 Maker 登录授权后,再重新读取 maker://status。";
|
|
29939
30209
|
}
|
|
29940
30210
|
return "暂时无法检查 Maker 远端是否有新提交。请把 failure 信息反馈给用户;如果只是 503、5xx、超时或网络中断,可稍后重新读取 maker://status。";
|
|
29941
30211
|
}
|
|
@@ -30156,7 +30426,7 @@ function nextActionForFailure(classification) {
|
|
|
30156
30426
|
case "git_missing":
|
|
30157
30427
|
return "本机未检测到可用的 Git。请用户自行安装 Git,并在 `git --version` 可用后重启 MCP 客户端再重试;安装前不要执行 clone、fetch、commit 或 push。";
|
|
30158
30428
|
case "auth":
|
|
30159
|
-
return
|
|
30429
|
+
return "Maker Git 鉴权失败。请运行 `taptap-maker login` 重新完成 Maker 登录授权后重试。";
|
|
30160
30430
|
case "remote_transient":
|
|
30161
30431
|
return "远端 Maker git 服务临时不可用。本地 commit 会保留;不要手动执行通用 git push,稍后直接重试 maker_build_current_directory。";
|
|
30162
30432
|
case "branch_not_allowed":
|
|
@@ -30260,7 +30530,7 @@ function makeAuthenticatedGitUrl(gitUrl, pat) {
|
|
|
30260
30530
|
return gitUrl.replace(/^https:\/\//, `https://git:${encodeURIComponent(pat)}@`);
|
|
30261
30531
|
}
|
|
30262
30532
|
async function fetchAndCheckoutTarget(target, authUrl, pat, onProgress) {
|
|
30263
|
-
if (
|
|
30533
|
+
if (fs5.existsSync(target) && hasDirectoryEntries(target)) {
|
|
30264
30534
|
onProgress == null ? void 0 : onProgress({
|
|
30265
30535
|
progress: 10,
|
|
30266
30536
|
total: 100,
|
|
@@ -30307,23 +30577,23 @@ function emitFirstCloneWaitNotice(onProgress, phase) {
|
|
|
30307
30577
|
});
|
|
30308
30578
|
}
|
|
30309
30579
|
function hasDirectoryEntries(target) {
|
|
30310
|
-
if (!
|
|
30580
|
+
if (!fs5.existsSync(target)) {
|
|
30311
30581
|
return false;
|
|
30312
30582
|
}
|
|
30313
|
-
return
|
|
30583
|
+
return fs5.readdirSync(target).length > 0;
|
|
30314
30584
|
}
|
|
30315
30585
|
function listLocalFiles(root) {
|
|
30316
|
-
if (!
|
|
30586
|
+
if (!fs5.existsSync(root)) {
|
|
30317
30587
|
return [];
|
|
30318
30588
|
}
|
|
30319
30589
|
const files = [];
|
|
30320
30590
|
const visit = (dir, relativeDir) => {
|
|
30321
|
-
for (const entry of
|
|
30591
|
+
for (const entry of fs5.readdirSync(dir, { withFileTypes: true })) {
|
|
30322
30592
|
const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
|
|
30323
30593
|
if (entry.name === ".git" || relativePath === ".maker-mcp" || relativePath.startsWith(".maker-mcp/") || entry.name === ".DS_Store") {
|
|
30324
30594
|
continue;
|
|
30325
30595
|
}
|
|
30326
|
-
const fullPath =
|
|
30596
|
+
const fullPath = path6.join(dir, entry.name);
|
|
30327
30597
|
if (entry.isDirectory()) {
|
|
30328
30598
|
visit(fullPath, relativePath);
|
|
30329
30599
|
continue;
|
|
@@ -30337,10 +30607,10 @@ function listLocalFiles(root) {
|
|
|
30337
30607
|
return files;
|
|
30338
30608
|
}
|
|
30339
30609
|
function listPreCloneNoticeFiles(root) {
|
|
30340
|
-
if (!
|
|
30610
|
+
if (!fs5.existsSync(root)) {
|
|
30341
30611
|
return [];
|
|
30342
30612
|
}
|
|
30343
|
-
return
|
|
30613
|
+
return fs5.readdirSync(root, { withFileTypes: true }).filter((entry) => !isIgnorablePreCloneEntry(entry.name)).map((entry) => entry.name).sort();
|
|
30344
30614
|
}
|
|
30345
30615
|
function createPreCloneWarnings(target) {
|
|
30346
30616
|
const preCloneLocalFiles = listPreCloneNoticeFiles(target);
|
|
@@ -30463,7 +30733,7 @@ function ensureOwnGitRoot(repoDir) {
|
|
|
30463
30733
|
);
|
|
30464
30734
|
}
|
|
30465
30735
|
function inspectMakerDirectoryGitStatus(cwd) {
|
|
30466
|
-
const targetDir =
|
|
30736
|
+
const targetDir = path6.resolve(cwd);
|
|
30467
30737
|
const gitRoot = resolveGitRoot(targetDir);
|
|
30468
30738
|
const gitDir = resolveGitDir(targetDir);
|
|
30469
30739
|
const makerBinding = findMakerProjectBinding(targetDir);
|
|
@@ -30536,16 +30806,16 @@ function formatMakerGitRootMismatch(status) {
|
|
|
30536
30806
|
}
|
|
30537
30807
|
function findMakerProjectBinding(startDir) {
|
|
30538
30808
|
var _a3;
|
|
30539
|
-
let current =
|
|
30809
|
+
let current = path6.resolve(startDir);
|
|
30540
30810
|
while (current.length > 0) {
|
|
30541
30811
|
const configPath = getProjectConfigPath(current);
|
|
30542
|
-
if (
|
|
30812
|
+
if (fs5.existsSync(configPath) && ((_a3 = loadProjectConfig(current)) == null ? void 0 : _a3.project_id)) {
|
|
30543
30813
|
return {
|
|
30544
30814
|
projectRoot: current,
|
|
30545
30815
|
configPath
|
|
30546
30816
|
};
|
|
30547
30817
|
}
|
|
30548
|
-
const parent =
|
|
30818
|
+
const parent = path6.dirname(current);
|
|
30549
30819
|
if (parent === current) {
|
|
30550
30820
|
return null;
|
|
30551
30821
|
}
|
|
@@ -30555,7 +30825,7 @@ function findMakerProjectBinding(startDir) {
|
|
|
30555
30825
|
}
|
|
30556
30826
|
function resolveGitRoot(cwd) {
|
|
30557
30827
|
try {
|
|
30558
|
-
return
|
|
30828
|
+
return path6.resolve(readGitSync(["-C", cwd, "rev-parse", "--show-toplevel"]).trim());
|
|
30559
30829
|
} catch {
|
|
30560
30830
|
return void 0;
|
|
30561
30831
|
}
|
|
@@ -30563,7 +30833,7 @@ function resolveGitRoot(cwd) {
|
|
|
30563
30833
|
function resolveGitDir(cwd) {
|
|
30564
30834
|
try {
|
|
30565
30835
|
const gitDir = readGitSync(["-C", cwd, "rev-parse", "--git-dir"]).trim();
|
|
30566
|
-
return
|
|
30836
|
+
return path6.isAbsolute(gitDir) ? path6.resolve(gitDir) : path6.resolve(cwd, gitDir);
|
|
30567
30837
|
} catch {
|
|
30568
30838
|
return void 0;
|
|
30569
30839
|
}
|
|
@@ -30572,9 +30842,9 @@ function samePath(left, right) {
|
|
|
30572
30842
|
return normalizePathForCompare(left) === normalizePathForCompare(right);
|
|
30573
30843
|
}
|
|
30574
30844
|
function normalizePathForCompare(value) {
|
|
30575
|
-
const resolved =
|
|
30845
|
+
const resolved = path6.resolve(value);
|
|
30576
30846
|
try {
|
|
30577
|
-
return
|
|
30847
|
+
return fs5.realpathSync.native(resolved);
|
|
30578
30848
|
} catch {
|
|
30579
30849
|
return resolved;
|
|
30580
30850
|
}
|
|
@@ -30903,18 +31173,24 @@ function normalizeTapAuthResponse(data) {
|
|
|
30903
31173
|
raw: data
|
|
30904
31174
|
};
|
|
30905
31175
|
}
|
|
30906
|
-
function getMakerTapTokenUrl() {
|
|
30907
|
-
const tapTokenUrl = getMakerEndpoints().tapTokenUrl;
|
|
30908
|
-
return requireMakerEndpoint("tapTokenUrl", tapTokenUrl);
|
|
31176
|
+
function getMakerTapTokenUrl(environment) {
|
|
31177
|
+
const tapTokenUrl = getMakerEndpoints(environment).tapTokenUrl;
|
|
31178
|
+
return requireMakerEndpoint("tapTokenUrl", tapTokenUrl, environment);
|
|
30909
31179
|
}
|
|
30910
|
-
async function requestTapAuthWithPat(manualPat) {
|
|
31180
|
+
async function requestTapAuthWithPat(manualPat, environment, options = {}) {
|
|
30911
31181
|
const pat = requireMakerPat(manualPat);
|
|
30912
|
-
const response = await
|
|
30913
|
-
|
|
30914
|
-
|
|
30915
|
-
|
|
30916
|
-
|
|
30917
|
-
|
|
31182
|
+
const response = await fetchWithTimeout(
|
|
31183
|
+
options.fetchImpl || fetch,
|
|
31184
|
+
getMakerTapTokenUrl(environment),
|
|
31185
|
+
{
|
|
31186
|
+
headers: {
|
|
31187
|
+
Authorization: `Bearer ${pat.token}`,
|
|
31188
|
+
Accept: "application/json"
|
|
31189
|
+
}
|
|
31190
|
+
},
|
|
31191
|
+
options.timeoutMs ?? DEFAULT_SHORT_FETCH_TIMEOUT_MS,
|
|
31192
|
+
"TapTap token request"
|
|
31193
|
+
);
|
|
30918
31194
|
const text = await response.text();
|
|
30919
31195
|
let json2 = {};
|
|
30920
31196
|
if (text) {
|
|
@@ -30933,8 +31209,8 @@ async function requestTapAuthWithPat(manualPat) {
|
|
|
30933
31209
|
}
|
|
30934
31210
|
|
|
30935
31211
|
// src/maker/cli/skill.ts
|
|
30936
|
-
import
|
|
30937
|
-
import
|
|
31212
|
+
import fs6 from "node:fs";
|
|
31213
|
+
import path7 from "node:path";
|
|
30938
31214
|
import { fileURLToPath } from "node:url";
|
|
30939
31215
|
var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
|
|
30940
31216
|
var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
|
|
@@ -30953,7 +31229,7 @@ var BUNDLED_SKILLS = [
|
|
|
30953
31229
|
function formatMakerSkillStatus(_options = {}) {
|
|
30954
31230
|
const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
|
|
30955
31231
|
name: skill.name,
|
|
30956
|
-
path:
|
|
31232
|
+
path: path7.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
|
|
30957
31233
|
}));
|
|
30958
31234
|
return [
|
|
30959
31235
|
"TapTap Maker workflow guide documents",
|
|
@@ -30986,11 +31262,11 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
30986
31262
|
}
|
|
30987
31263
|
function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
|
|
30988
31264
|
const candidates = [
|
|
30989
|
-
|
|
31265
|
+
path7.join(process.cwd(), "skills", skillName),
|
|
30990
31266
|
getBundledSkillSourceDir(skillName)
|
|
30991
31267
|
].filter(Boolean);
|
|
30992
31268
|
for (const candidate of candidates) {
|
|
30993
|
-
if (
|
|
31269
|
+
if (fs6.existsSync(path7.join(candidate, "SKILL.md"))) {
|
|
30994
31270
|
return candidate;
|
|
30995
31271
|
}
|
|
30996
31272
|
}
|
|
@@ -31003,13 +31279,13 @@ function getBundledSkillSourceDir(skillName) {
|
|
|
31003
31279
|
return null;
|
|
31004
31280
|
}
|
|
31005
31281
|
const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
|
|
31006
|
-
const packageRoot =
|
|
31007
|
-
return
|
|
31282
|
+
const packageRoot = path7.dirname(path7.dirname(bundlePath));
|
|
31283
|
+
return path7.join(packageRoot, "skills", skillName);
|
|
31008
31284
|
}
|
|
31009
31285
|
|
|
31010
31286
|
// src/maker/server/runtimeLogs.ts
|
|
31011
|
-
import
|
|
31012
|
-
import
|
|
31287
|
+
import fs7 from "node:fs";
|
|
31288
|
+
import path8 from "node:path";
|
|
31013
31289
|
var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
|
|
31014
31290
|
var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
31015
31291
|
var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
|
|
@@ -31150,19 +31426,19 @@ async function pullRuntimeLogs(options) {
|
|
|
31150
31426
|
}
|
|
31151
31427
|
function resetRuntimeLogs(projectRoot) {
|
|
31152
31428
|
const runtimeDir = getRuntimeLogDir(projectRoot);
|
|
31153
|
-
|
|
31429
|
+
fs7.mkdirSync(runtimeDir, { recursive: true });
|
|
31154
31430
|
for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
|
|
31155
|
-
|
|
31431
|
+
fs7.rmSync(path8.join(runtimeDir, file2), { force: true });
|
|
31156
31432
|
}
|
|
31157
31433
|
return runtimeDir;
|
|
31158
31434
|
}
|
|
31159
31435
|
function readRuntimeLogState(projectRoot) {
|
|
31160
31436
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31161
|
-
if (!
|
|
31437
|
+
if (!fs7.existsSync(statePath)) {
|
|
31162
31438
|
return null;
|
|
31163
31439
|
}
|
|
31164
31440
|
try {
|
|
31165
|
-
const state = JSON.parse(
|
|
31441
|
+
const state = JSON.parse(fs7.readFileSync(statePath, "utf8"));
|
|
31166
31442
|
return isRuntimeLogState(state) ? state : null;
|
|
31167
31443
|
} catch {
|
|
31168
31444
|
return null;
|
|
@@ -31190,9 +31466,9 @@ function normalizeRuntimeLogQueryResult(result) {
|
|
|
31190
31466
|
};
|
|
31191
31467
|
}
|
|
31192
31468
|
function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
31193
|
-
const rawPath =
|
|
31194
|
-
|
|
31195
|
-
|
|
31469
|
+
const rawPath = path8.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
|
|
31470
|
+
fs7.mkdirSync(path8.dirname(rawPath), { recursive: true });
|
|
31471
|
+
fs7.writeFileSync(
|
|
31196
31472
|
rawPath,
|
|
31197
31473
|
`${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
|
|
31198
31474
|
`,
|
|
@@ -31201,7 +31477,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
|
31201
31477
|
return rawPath;
|
|
31202
31478
|
}
|
|
31203
31479
|
function appendRuntimeLogs(projectRoot, logs) {
|
|
31204
|
-
|
|
31480
|
+
fs7.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
|
|
31205
31481
|
if (logs.length === 0) {
|
|
31206
31482
|
return { files: [], written: 0 };
|
|
31207
31483
|
}
|
|
@@ -31209,7 +31485,7 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31209
31485
|
let written = 0;
|
|
31210
31486
|
for (const log of logs) {
|
|
31211
31487
|
const line = JSON.stringify(compactRuntimeLogEntry(log));
|
|
31212
|
-
|
|
31488
|
+
fs7.appendFileSync(filePath, `${line}
|
|
31213
31489
|
`, "utf8");
|
|
31214
31490
|
written += 1;
|
|
31215
31491
|
}
|
|
@@ -31217,11 +31493,11 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31217
31493
|
}
|
|
31218
31494
|
function writeRuntimeLogState(projectRoot, state) {
|
|
31219
31495
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31220
|
-
|
|
31496
|
+
fs7.mkdirSync(path8.dirname(statePath), { recursive: true });
|
|
31221
31497
|
const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
|
|
31222
|
-
|
|
31498
|
+
fs7.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
31223
31499
|
`, "utf8");
|
|
31224
|
-
|
|
31500
|
+
fs7.renameSync(tempPath, statePath);
|
|
31225
31501
|
}
|
|
31226
31502
|
function writeRuntimeLogFailureState(projectRoot, options) {
|
|
31227
31503
|
const nowIso = new Date(options.nowMs()).toISOString();
|
|
@@ -31253,13 +31529,13 @@ function isNonRetryableRuntimeLogError(error2) {
|
|
|
31253
31529
|
);
|
|
31254
31530
|
}
|
|
31255
31531
|
function getRuntimeLogDir(projectRoot) {
|
|
31256
|
-
return
|
|
31532
|
+
return path8.join(projectRoot, ".maker", "logs", "runtime");
|
|
31257
31533
|
}
|
|
31258
31534
|
function getRuntimeLogStatePath(projectRoot) {
|
|
31259
|
-
return
|
|
31535
|
+
return path8.join(getRuntimeLogDir(projectRoot), "state.json");
|
|
31260
31536
|
}
|
|
31261
31537
|
function getRuntimeLogPath(projectRoot) {
|
|
31262
|
-
return
|
|
31538
|
+
return path8.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
|
|
31263
31539
|
}
|
|
31264
31540
|
function resolveNextRuntimeLogCursor(result) {
|
|
31265
31541
|
const maxLogTime = result.logs.reduce((max, log) => {
|
|
@@ -31384,8 +31660,8 @@ function compactRuntimeLogEntry(entry) {
|
|
|
31384
31660
|
}
|
|
31385
31661
|
|
|
31386
31662
|
// src/maker/server/proxyAssets.ts
|
|
31387
|
-
import
|
|
31388
|
-
import
|
|
31663
|
+
import fs8 from "node:fs";
|
|
31664
|
+
import path9 from "node:path";
|
|
31389
31665
|
var IMAGE_ASSET_DIRS = ["assets/image"];
|
|
31390
31666
|
var VIDEO_ASSET_DIRS = ["assets/video"];
|
|
31391
31667
|
var AUDIO_ASSET_DIRS = ["assets/audio"];
|
|
@@ -31629,8 +31905,8 @@ async function materializeAsset(options) {
|
|
|
31629
31905
|
};
|
|
31630
31906
|
}
|
|
31631
31907
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
31632
|
-
|
|
31633
|
-
|
|
31908
|
+
fs8.mkdirSync(path9.dirname(absolutePath), { recursive: true });
|
|
31909
|
+
fs8.writeFileSync(absolutePath, bytes);
|
|
31634
31910
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
31635
31911
|
} catch (error2) {
|
|
31636
31912
|
return {
|
|
@@ -31644,12 +31920,12 @@ async function materializeAsset(options) {
|
|
|
31644
31920
|
function createUniqueAssetPath(options) {
|
|
31645
31921
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
31646
31922
|
for (let index = 1; index <= 9999; index += 1) {
|
|
31647
|
-
const relativePath =
|
|
31923
|
+
const relativePath = path9.posix.join(
|
|
31648
31924
|
options.relativeDir,
|
|
31649
31925
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
31650
31926
|
);
|
|
31651
|
-
const absolutePath =
|
|
31652
|
-
if (!
|
|
31927
|
+
const absolutePath = path9.join(options.targetDir, ...relativePath.split("/"));
|
|
31928
|
+
if (!fs8.existsSync(absolutePath)) {
|
|
31653
31929
|
return { relativePath, absolutePath };
|
|
31654
31930
|
}
|
|
31655
31931
|
}
|
|
@@ -31732,7 +32008,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
31732
32008
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
31733
32009
|
return false;
|
|
31734
32010
|
}
|
|
31735
|
-
const basename =
|
|
32011
|
+
const basename = path9.posix.basename(localPath);
|
|
31736
32012
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
31737
32013
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
31738
32014
|
});
|
|
@@ -31745,13 +32021,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
31745
32021
|
}
|
|
31746
32022
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
31747
32023
|
var _a3;
|
|
31748
|
-
const hasExtension = Boolean(
|
|
32024
|
+
const hasExtension = Boolean(path9.extname(value));
|
|
31749
32025
|
const candidates = [];
|
|
31750
32026
|
for (const assetDir of assetDirs) {
|
|
31751
|
-
const absoluteDir =
|
|
32027
|
+
const absoluteDir = path9.join(targetDir, ...assetDir.split("/"));
|
|
31752
32028
|
let entries;
|
|
31753
32029
|
try {
|
|
31754
|
-
entries =
|
|
32030
|
+
entries = fs8.readdirSync(absoluteDir);
|
|
31755
32031
|
} catch {
|
|
31756
32032
|
continue;
|
|
31757
32033
|
}
|
|
@@ -31760,11 +32036,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
31760
32036
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
31761
32037
|
continue;
|
|
31762
32038
|
}
|
|
31763
|
-
const absolutePath =
|
|
32039
|
+
const absolutePath = path9.join(absoluteDir, entry);
|
|
31764
32040
|
try {
|
|
31765
32041
|
candidates.push({
|
|
31766
|
-
localPath:
|
|
31767
|
-
mtimeMs:
|
|
32042
|
+
localPath: path9.posix.join(assetDir, entry),
|
|
32043
|
+
mtimeMs: fs8.statSync(absolutePath).mtimeMs
|
|
31768
32044
|
});
|
|
31769
32045
|
} catch {
|
|
31770
32046
|
}
|
|
@@ -31774,7 +32050,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
31774
32050
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
31775
32051
|
}
|
|
31776
32052
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
31777
|
-
if (relativePath.startsWith("../") ||
|
|
32053
|
+
if (relativePath.startsWith("../") || path9.isAbsolute(relativePath)) {
|
|
31778
32054
|
return false;
|
|
31779
32055
|
}
|
|
31780
32056
|
return assetDirs.some(
|
|
@@ -31788,31 +32064,31 @@ function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
|
31788
32064
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
31789
32065
|
registry2[localPath] = record2;
|
|
31790
32066
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
31791
|
-
|
|
31792
|
-
|
|
32067
|
+
fs8.mkdirSync(path9.dirname(registryPath), { recursive: true });
|
|
32068
|
+
fs8.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
31793
32069
|
`, "utf8");
|
|
31794
32070
|
}
|
|
31795
32071
|
function readGeneratedAssetRegistry(targetDir) {
|
|
31796
32072
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
31797
|
-
if (!
|
|
32073
|
+
if (!fs8.existsSync(registryPath)) {
|
|
31798
32074
|
return {};
|
|
31799
32075
|
}
|
|
31800
32076
|
try {
|
|
31801
|
-
const parsed = JSON.parse(
|
|
32077
|
+
const parsed = JSON.parse(fs8.readFileSync(registryPath, "utf8"));
|
|
31802
32078
|
return isRecord(parsed) ? parsed : {};
|
|
31803
32079
|
} catch {
|
|
31804
32080
|
return {};
|
|
31805
32081
|
}
|
|
31806
32082
|
}
|
|
31807
32083
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
31808
|
-
return
|
|
32084
|
+
return path9.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
31809
32085
|
}
|
|
31810
32086
|
function normalizeAssetRegistryKey(targetDir, value) {
|
|
31811
32087
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
31812
32088
|
return void 0;
|
|
31813
32089
|
}
|
|
31814
|
-
const relative =
|
|
31815
|
-
return relative.split(
|
|
32090
|
+
const relative = path9.isAbsolute(value) ? path9.relative(targetDir, value) : value;
|
|
32091
|
+
return relative.split(path9.sep).join("/");
|
|
31816
32092
|
}
|
|
31817
32093
|
function isRecord(value) {
|
|
31818
32094
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -31841,7 +32117,7 @@ function extensionFromUrl(url2) {
|
|
|
31841
32117
|
}
|
|
31842
32118
|
try {
|
|
31843
32119
|
const pathname = new URL(url2).pathname;
|
|
31844
|
-
const extension =
|
|
32120
|
+
const extension = path9.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
31845
32121
|
return extension || void 0;
|
|
31846
32122
|
} catch {
|
|
31847
32123
|
return void 0;
|
|
@@ -31849,7 +32125,7 @@ function extensionFromUrl(url2) {
|
|
|
31849
32125
|
}
|
|
31850
32126
|
|
|
31851
32127
|
// src/maker/server/mcp.ts
|
|
31852
|
-
var VERSION = true ? "0.0.
|
|
32128
|
+
var VERSION = true ? "0.0.13" : "dev";
|
|
31853
32129
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
31854
32130
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
31855
32131
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -31893,7 +32169,7 @@ var tools = [
|
|
|
31893
32169
|
},
|
|
31894
32170
|
{
|
|
31895
32171
|
name: "maker_build_current_directory",
|
|
31896
|
-
description: 'Sync and build the current Maker game. Use this single tool for user requests like "构建", "build", "跑一下", "预览", "验证一下", "提交", "提交代码", "推送", or "push" in a Maker project. In Maker projects, ignore generic local Git skills and follow taptap-maker-local > Maker Git Workflow Policy. Do not create branches, do not use generic git commit/push, and do not create PR/MR for Maker project submit/build requests. Before creating a commit, this tool checks Maker remote sync; if local main is behind/diverged, not on main, or remote sync cannot be verified, it stops before commit/push and returns recovery details.
|
|
32172
|
+
description: 'Sync and build the current Maker game. Use this single tool for user requests like "构建", "build", "跑一下", "预览", "验证一下", "提交", "提交代码", "推送", or "push" in a Maker project. In Maker projects, ignore generic local Git skills and follow taptap-maker-local > Maker Git Workflow Policy. Do not create branches, do not use generic git commit/push, and do not create PR/MR for Maker project submit/build requests. Before creating a commit, this tool checks Maker remote sync; if local main is behind/diverged, not on main, or remote sync cannot be verified, it stops before commit/push and returns recovery details. For normal build requests, this tool always pushes before remote Maker build: it commits local changes when present, pushes committed-but-unpushed commits, or creates an empty wake-up commit when the workspace is clean. Maker generated .gitignore changes are required project files and are submitted even if files selects a smaller change set. If push fails, build is not started and the result includes recovery details for the local Agent to handle merge/conflict resolution. If push succeeds but remote build fails, report that code is already on Maker remote and include build failure details. After a successful build, a local runtime log watcher is started; for gameplay/runtime diagnostics, read runtime_logs.local_file, and for watcher health read runtime_logs.state_file. Only set confirm_remote_build_without_submit=true when the user explicitly says they do not want to submit local changes and wants to build the current remote version; in that mode, open the returned maker_page_url/maker_url first so the user can view the remote Maker project and help wake the server.',
|
|
31897
32173
|
inputSchema: {
|
|
31898
32174
|
type: "object",
|
|
31899
32175
|
properties: {
|
|
@@ -31936,7 +32212,7 @@ var tools = [
|
|
|
31936
32212
|
},
|
|
31937
32213
|
message: {
|
|
31938
32214
|
type: "string",
|
|
31939
|
-
description: "Optional commit message used when local
|
|
32215
|
+
description: "Optional commit message used when local changes or the empty wake-up commit need to be committed before build."
|
|
31940
32216
|
},
|
|
31941
32217
|
files: {
|
|
31942
32218
|
type: "array",
|
|
@@ -31945,7 +32221,7 @@ var tools = [
|
|
|
31945
32221
|
},
|
|
31946
32222
|
confirm_remote_build_without_submit: {
|
|
31947
32223
|
type: "boolean",
|
|
31948
|
-
description: "Set true only after the user explicitly confirms they do not want to submit local changes and want to build the current Maker remote committed version."
|
|
32224
|
+
description: "Set true only after the user explicitly confirms they do not want to submit local changes and want to build the current Maker remote committed version. This mode opens and returns the Maker app page URL before remote build."
|
|
31949
32225
|
}
|
|
31950
32226
|
}
|
|
31951
32227
|
}
|
|
@@ -32204,16 +32480,16 @@ async function startMakerMcpServer() {
|
|
|
32204
32480
|
async function formatStatus(options = {}) {
|
|
32205
32481
|
var _a3;
|
|
32206
32482
|
const targetDir = resolveMakerToolTargetDir(options.targetDir);
|
|
32483
|
+
const env = getMakerEnvironment(void 0, targetDir);
|
|
32207
32484
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
32208
32485
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
32209
32486
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
32210
32487
|
const pat = loadPat();
|
|
32211
32488
|
let tapAuth = loadTapAuth();
|
|
32212
|
-
const makerPatTokensUrl = getMakerPatTokensUrl();
|
|
32213
32489
|
let tapAuthRefreshText = "";
|
|
32214
32490
|
if (pat && !tapAuth) {
|
|
32215
32491
|
try {
|
|
32216
|
-
tapAuth = await requestTapAuthWithPat(pat.token);
|
|
32492
|
+
tapAuth = await requestTapAuthWithPat(pat.token, env);
|
|
32217
32493
|
tapAuthRefreshText = [
|
|
32218
32494
|
"TapTap token",
|
|
32219
32495
|
"",
|
|
@@ -32238,6 +32514,7 @@ async function formatStatus(options = {}) {
|
|
|
32238
32514
|
"TapTap Maker MCP status",
|
|
32239
32515
|
"",
|
|
32240
32516
|
`- version: ${VERSION}`,
|
|
32517
|
+
`- env: ${env}`,
|
|
32241
32518
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
32242
32519
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
32243
32520
|
`- target_dir: ${targetDir}`,
|
|
@@ -32256,17 +32533,38 @@ async function formatStatus(options = {}) {
|
|
|
32256
32533
|
"",
|
|
32257
32534
|
identify.projectRoot ? await formatMakerProxyToolsStatusSafely({ targetDir: identify.projectRoot }) : "",
|
|
32258
32535
|
"",
|
|
32259
|
-
|
|
32536
|
+
formatAuthNextStep({ hasPat: Boolean(pat), isProjectBound: Boolean(identify.projectRoot) }),
|
|
32260
32537
|
"",
|
|
32261
32538
|
tapAuthRefreshText,
|
|
32262
32539
|
"",
|
|
32263
|
-
identify.projectRoot ? await formatAiDevKitStatus(identify.projectRoot
|
|
32540
|
+
identify.projectRoot ? await formatAiDevKitStatus(identify.projectRoot, {
|
|
32541
|
+
environment: env,
|
|
32542
|
+
skipVersionCheck: options.skipRemoteSync
|
|
32543
|
+
}) : "",
|
|
32264
32544
|
"",
|
|
32265
32545
|
formatMakerSkillStatus({ projectRoot: identify.projectRoot || targetDir }),
|
|
32266
32546
|
"",
|
|
32267
32547
|
projectSection
|
|
32268
32548
|
].filter(Boolean).join("\n");
|
|
32269
32549
|
}
|
|
32550
|
+
function formatAuthNextStep(options) {
|
|
32551
|
+
if (options.hasPat) {
|
|
32552
|
+
return "";
|
|
32553
|
+
}
|
|
32554
|
+
if (options.isProjectBound) {
|
|
32555
|
+
return [
|
|
32556
|
+
"Auth next step",
|
|
32557
|
+
"",
|
|
32558
|
+
"Maker PAT 缺失。请运行 `taptap-maker login` 刷新登录授权。"
|
|
32559
|
+
].join("\n");
|
|
32560
|
+
}
|
|
32561
|
+
return [
|
|
32562
|
+
"Initialization next step",
|
|
32563
|
+
"",
|
|
32564
|
+
"当前目录尚未绑定 Maker 项目。请运行 `taptap-maker init`。",
|
|
32565
|
+
"如果缺少 Maker PAT,CLI 会在 init 流程内自动打开登录授权页面并完成本地保存。"
|
|
32566
|
+
].join("\n");
|
|
32567
|
+
}
|
|
32270
32568
|
function formatMakerRemoteSyncSkipped() {
|
|
32271
32569
|
return [
|
|
32272
32570
|
"Maker remote sync",
|
|
@@ -32432,22 +32730,31 @@ function formatAiDialogueDirectoryHint(targetDir) {
|
|
|
32432
32730
|
}
|
|
32433
32731
|
function resolveMakerToolTargetDir(targetDir) {
|
|
32434
32732
|
if (targetDir) {
|
|
32435
|
-
return
|
|
32733
|
+
return path10.resolve(targetDir);
|
|
32436
32734
|
}
|
|
32437
32735
|
return process.cwd();
|
|
32438
32736
|
}
|
|
32439
|
-
async function formatAiDevKitStatus(projectRoot) {
|
|
32737
|
+
async function formatAiDevKitStatus(projectRoot, options = {}) {
|
|
32440
32738
|
const devKitStatus = inspectAiDevKit(projectRoot);
|
|
32739
|
+
const updateStatus = options.skipVersionCheck ? void 0 : await checkAiDevKitUpdate(projectRoot, { environment: options.environment });
|
|
32441
32740
|
if (devKitStatus.ready) {
|
|
32442
|
-
return formatAiDevKitStatusLines("ready", devKitStatus).join("\n");
|
|
32741
|
+
return formatAiDevKitStatusLines("ready", devKitStatus, updateStatus).join("\n");
|
|
32443
32742
|
}
|
|
32444
32743
|
return [
|
|
32445
|
-
...formatAiDevKitStatusLines("missing", devKitStatus),
|
|
32744
|
+
...formatAiDevKitStatusLines("missing", devKitStatus, updateStatus),
|
|
32446
32745
|
"- next_step: 请运行 taptap-maker dev-kit update,或重新执行 taptap-maker init。"
|
|
32447
32746
|
].join("\n");
|
|
32448
32747
|
}
|
|
32449
|
-
function formatAiDevKitStatusLines(status, devKitStatus) {
|
|
32748
|
+
function formatAiDevKitStatusLines(status, devKitStatus, updateStatus) {
|
|
32749
|
+
var _a3, _b;
|
|
32450
32750
|
const skillStatus = inspectAiDevKitSkillInstallStatus(devKitStatus.targetDir);
|
|
32751
|
+
const versionLines = updateStatus ? [
|
|
32752
|
+
`- installed_version: ${((_a3 = updateStatus.installed) == null ? void 0 : _a3.version) || "(unknown)"}`,
|
|
32753
|
+
`- latest_version: ${((_b = updateStatus.latest) == null ? void 0 : _b.version) || "(unknown)"}`,
|
|
32754
|
+
`- update_available: ${updateStatus.updateAvailable ? "yes" : "no"}`,
|
|
32755
|
+
updateStatus.versionCheckError ? `- version_check: ${updateStatus.versionCheckError}` : "",
|
|
32756
|
+
updateStatus.updateAvailable ? "- next_step: 请运行 taptap-maker dev-kit update。" : ""
|
|
32757
|
+
].filter(Boolean) : ["- version_check: skipped"];
|
|
32451
32758
|
return [
|
|
32452
32759
|
"AI dev kit",
|
|
32453
32760
|
"",
|
|
@@ -32455,6 +32762,7 @@ function formatAiDevKitStatusLines(status, devKitStatus) {
|
|
|
32455
32762
|
`- required_entries: ${devKitStatus.requiredEntries.join(", ")}`,
|
|
32456
32763
|
`- present_entries: ${devKitStatus.presentEntries.join(", ") || "(none)"}`,
|
|
32457
32764
|
`- missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
32765
|
+
...versionLines,
|
|
32458
32766
|
`- skill_install_status: ${skillStatus.status}`,
|
|
32459
32767
|
`- skill_install_summary: ${skillStatus.summary}`
|
|
32460
32768
|
];
|
|
@@ -32473,7 +32781,7 @@ async function formatAutoProjectListFromPat() {
|
|
|
32473
32781
|
return [
|
|
32474
32782
|
"本地已有 Maker PAT,但自动列出 Maker Apps 失败。",
|
|
32475
32783
|
`原因:${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
32476
|
-
|
|
32784
|
+
"如果本地鉴权已失效,请运行 `taptap-maker login` 重新完成 Maker 登录授权。"
|
|
32477
32785
|
].join("\n");
|
|
32478
32786
|
}
|
|
32479
32787
|
}
|
|
@@ -32522,14 +32830,14 @@ function formatStatusProjectList(projects) {
|
|
|
32522
32830
|
].filter((line) => line !== void 0).join("\n");
|
|
32523
32831
|
}
|
|
32524
32832
|
function formatClonePartialStateLines(targetDir) {
|
|
32525
|
-
const resolvedTargetDir =
|
|
32833
|
+
const resolvedTargetDir = path10.resolve(targetDir);
|
|
32526
32834
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
32527
32835
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
32528
32836
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
32529
|
-
const stagedDevKitGitignorePath =
|
|
32837
|
+
const stagedDevKitGitignorePath = path10.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
32530
32838
|
const projectBound = Boolean(identify.projectId);
|
|
32531
32839
|
const gitInitialized = Boolean(
|
|
32532
|
-
gitStatus.isOwnGitRoot ||
|
|
32840
|
+
gitStatus.isOwnGitRoot || fs9.existsSync(path10.join(resolvedTargetDir, ".git"))
|
|
32533
32841
|
);
|
|
32534
32842
|
const safeToRetry = !projectBound;
|
|
32535
32843
|
return [
|
|
@@ -32543,7 +32851,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
32543
32851
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
32544
32852
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
32545
32853
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
32546
|
-
`- staged_dev_kit_gitignore: ${
|
|
32854
|
+
`- staged_dev_kit_gitignore: ${fs9.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
32547
32855
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
32548
32856
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
32549
32857
|
].filter(Boolean);
|
|
@@ -32557,9 +32865,10 @@ function createRemoteProxyContext(options) {
|
|
|
32557
32865
|
}
|
|
32558
32866
|
const projectConfig = loadProjectConfig(identify.projectRoot);
|
|
32559
32867
|
const projectId = (projectConfig == null ? void 0 : projectConfig.project_id) || identify.projectId;
|
|
32868
|
+
const env = getMakerEnvironment(options.env, identify.projectRoot);
|
|
32560
32869
|
const tapAuth = loadTapAuth();
|
|
32561
32870
|
if (!tapAuth) {
|
|
32562
|
-
throw new Error("Tap auth not found. Run taptap-maker
|
|
32871
|
+
throw new Error("Tap auth not found. Run `taptap-maker login` first.");
|
|
32563
32872
|
}
|
|
32564
32873
|
let userId = projectConfig == null ? void 0 : projectConfig.user_id;
|
|
32565
32874
|
if (!userId) {
|
|
@@ -32571,7 +32880,6 @@ function createRemoteProxyContext(options) {
|
|
|
32571
32880
|
"Cannot resolve user_id. Re-run taptap-maker init with PAT so the project config can cache user_id."
|
|
32572
32881
|
);
|
|
32573
32882
|
}
|
|
32574
|
-
const env = getMakerEnvironment(options.env);
|
|
32575
32883
|
const serverUrl = options.serverUrl || requireMakerEndpoint("remoteMcpServerUrl", getMakerEndpoints(env).remoteMcpServerUrl, env);
|
|
32576
32884
|
const projectPath = `${projectId}/workspace`;
|
|
32577
32885
|
const proxyCfg = {
|
|
@@ -32616,7 +32924,7 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
32616
32924
|
}
|
|
32617
32925
|
return {
|
|
32618
32926
|
command: process.execPath,
|
|
32619
|
-
args: [
|
|
32927
|
+
args: [path10.resolve(makerEntry), "__maker-proxy"]
|
|
32620
32928
|
};
|
|
32621
32929
|
}
|
|
32622
32930
|
function createToolProgressReporter(progressToken, extra, operationName) {
|
|
@@ -32701,6 +33009,37 @@ function formatMakerAppWebUrl(projectId, env) {
|
|
|
32701
33009
|
const makerEnv = env === "rnd" || env === "production" ? env : void 0;
|
|
32702
33010
|
return `${getMakerWebUrl(makerEnv)}/app/${encodeURIComponent(projectId)}`;
|
|
32703
33011
|
}
|
|
33012
|
+
function openRemoteBuildMakerPage(options) {
|
|
33013
|
+
const identify = identifyMakerProject({ cwd: options.targetDir });
|
|
33014
|
+
if (!identify.projectRoot || !identify.projectId) {
|
|
33015
|
+
throw new Error(
|
|
33016
|
+
`${options.targetDir} is not bound to a Maker project. Run taptap-maker init first.`
|
|
33017
|
+
);
|
|
33018
|
+
}
|
|
33019
|
+
const projectConfig = loadProjectConfig(identify.projectRoot);
|
|
33020
|
+
const projectId = (projectConfig == null ? void 0 : projectConfig.project_id) || identify.projectId;
|
|
33021
|
+
const env = getMakerEnvironment(options.env, identify.projectRoot);
|
|
33022
|
+
const url2 = formatMakerAppWebUrl(projectId, env);
|
|
33023
|
+
return (options.openMakerPage || openMakerPageInBrowser)(url2);
|
|
33024
|
+
}
|
|
33025
|
+
function openMakerPageInBrowser(url2) {
|
|
33026
|
+
var _a3;
|
|
33027
|
+
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
33028
|
+
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
33029
|
+
const result = spawnSync4(command, args, {
|
|
33030
|
+
stdio: "ignore",
|
|
33031
|
+
windowsHide: true,
|
|
33032
|
+
timeout: 5e3
|
|
33033
|
+
});
|
|
33034
|
+
if (result.error || result.status !== 0) {
|
|
33035
|
+
return {
|
|
33036
|
+
ok: false,
|
|
33037
|
+
url: url2,
|
|
33038
|
+
error: ((_a3 = result.error) == null ? void 0 : _a3.message) || `open command exited with status ${result.status ?? "unknown"}`
|
|
33039
|
+
};
|
|
33040
|
+
}
|
|
33041
|
+
return { ok: true, url: url2 };
|
|
33042
|
+
}
|
|
32704
33043
|
var RemoteBuildFailedError = class extends Error {
|
|
32705
33044
|
constructor(buildResult) {
|
|
32706
33045
|
super(buildResult.resultText);
|
|
@@ -32711,18 +33050,19 @@ var RemoteBuildFailedError = class extends Error {
|
|
|
32711
33050
|
async function buildCurrentDirectory(options) {
|
|
32712
33051
|
var _a3;
|
|
32713
33052
|
const localChanges = await readMakerProjectLocalChanges(options.targetDir);
|
|
32714
|
-
if (
|
|
33053
|
+
if (!options.confirmRemoteBuildWithoutSubmit) {
|
|
32715
33054
|
const config2 = loadProjectConfig(localChanges.projectRoot);
|
|
32716
33055
|
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
32717
33056
|
progress: 0,
|
|
32718
33057
|
total: 100,
|
|
32719
33058
|
phase: "sync",
|
|
32720
|
-
message: "Syncing local Maker changes before remote build"
|
|
33059
|
+
message: localChanges.hasChanges ? "Syncing local Maker changes before remote build" : "Waking Maker build server before remote build"
|
|
32721
33060
|
});
|
|
32722
33061
|
const submitResult = await (options.submitLocalChanges || pushMakerProject)({
|
|
32723
33062
|
cwd: localChanges.projectRoot,
|
|
32724
|
-
message: options.message,
|
|
33063
|
+
message: options.message || (!localChanges.hasChanges ? "chore: wake maker build server" : void 0),
|
|
32725
33064
|
files: options.files,
|
|
33065
|
+
allowEmpty: !localChanges.hasChanges,
|
|
32726
33066
|
onProgress: options.onProgress
|
|
32727
33067
|
});
|
|
32728
33068
|
if (submitResult.failure || !submitResult.pushed && submitResult.status !== "clean") {
|
|
@@ -32750,8 +33090,12 @@ async function buildCurrentDirectory(options) {
|
|
|
32750
33090
|
submitResult
|
|
32751
33091
|
};
|
|
32752
33092
|
}
|
|
33093
|
+
const makerPageOpen = openRemoteBuildMakerPage(options);
|
|
32753
33094
|
try {
|
|
32754
|
-
return
|
|
33095
|
+
return {
|
|
33096
|
+
...await runRemoteBuildCurrentDirectory(options, options.targetDir),
|
|
33097
|
+
makerPageOpen
|
|
33098
|
+
};
|
|
32755
33099
|
} catch (error2) {
|
|
32756
33100
|
if (error2 instanceof RemoteBuildFailedError) {
|
|
32757
33101
|
return {
|
|
@@ -32759,7 +33103,8 @@ async function buildCurrentDirectory(options) {
|
|
|
32759
33103
|
projectRoot: error2.buildResult.projectRoot,
|
|
32760
33104
|
projectId: error2.buildResult.projectId,
|
|
32761
33105
|
buildResult: error2.buildResult,
|
|
32762
|
-
buildFailure: toMakerBuildFailure(error2)
|
|
33106
|
+
buildFailure: toMakerBuildFailure(error2),
|
|
33107
|
+
makerPageOpen
|
|
32763
33108
|
};
|
|
32764
33109
|
}
|
|
32765
33110
|
throw error2;
|
|
@@ -32918,18 +33263,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
32918
33263
|
}
|
|
32919
33264
|
}
|
|
32920
33265
|
async function startRuntimeLogWatch(buildResult) {
|
|
32921
|
-
const runtimeDir =
|
|
32922
|
-
|
|
32923
|
-
const stdoutLog =
|
|
32924
|
-
const stderrLog =
|
|
32925
|
-
const pidFile =
|
|
33266
|
+
const runtimeDir = path10.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
33267
|
+
fs9.mkdirSync(runtimeDir, { recursive: true });
|
|
33268
|
+
const stdoutLog = path10.join(runtimeDir, "watcher.out.log");
|
|
33269
|
+
const stderrLog = path10.join(runtimeDir, "watcher.err.log");
|
|
33270
|
+
const pidFile = path10.join(runtimeDir, "watcher.pid");
|
|
32926
33271
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
32927
|
-
const outFd =
|
|
32928
|
-
const errFd =
|
|
33272
|
+
const outFd = fs9.openSync(stdoutLog, "a");
|
|
33273
|
+
const errFd = fs9.openSync(stderrLog, "a");
|
|
32929
33274
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
32930
33275
|
if (previous.previousStopError) {
|
|
32931
|
-
|
|
32932
|
-
|
|
33276
|
+
fs9.closeSync(outFd);
|
|
33277
|
+
fs9.closeSync(errFd);
|
|
32933
33278
|
return {
|
|
32934
33279
|
started: false,
|
|
32935
33280
|
command: command.text,
|
|
@@ -32992,18 +33337,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
32992
33337
|
...previous
|
|
32993
33338
|
};
|
|
32994
33339
|
} finally {
|
|
32995
|
-
|
|
32996
|
-
|
|
33340
|
+
fs9.closeSync(outFd);
|
|
33341
|
+
fs9.closeSync(errFd);
|
|
32997
33342
|
}
|
|
32998
33343
|
}
|
|
32999
33344
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
33000
|
-
if (!
|
|
33345
|
+
if (!fs9.existsSync(pidFile)) {
|
|
33001
33346
|
return {};
|
|
33002
33347
|
}
|
|
33003
33348
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
33004
33349
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
33005
33350
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
33006
|
-
|
|
33351
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33007
33352
|
return {};
|
|
33008
33353
|
}
|
|
33009
33354
|
try {
|
|
@@ -33011,7 +33356,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33011
33356
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
33012
33357
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
33013
33358
|
if (!verifiedCommand) {
|
|
33014
|
-
|
|
33359
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33015
33360
|
return {
|
|
33016
33361
|
previousPid: pid,
|
|
33017
33362
|
previousStopped: false,
|
|
@@ -33021,7 +33366,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33021
33366
|
process.kill(pid, "SIGTERM");
|
|
33022
33367
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
33023
33368
|
if (stopped) {
|
|
33024
|
-
|
|
33369
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33025
33370
|
return { previousPid: pid, previousStopped: true };
|
|
33026
33371
|
}
|
|
33027
33372
|
return {
|
|
@@ -33030,7 +33375,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33030
33375
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
33031
33376
|
};
|
|
33032
33377
|
} catch (error2) {
|
|
33033
|
-
|
|
33378
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33034
33379
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
33035
33380
|
if (code === "ESRCH") {
|
|
33036
33381
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -33043,7 +33388,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33043
33388
|
}
|
|
33044
33389
|
}
|
|
33045
33390
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
33046
|
-
const raw =
|
|
33391
|
+
const raw = fs9.readFileSync(pidFile, "utf8").trim();
|
|
33047
33392
|
if (!raw) {
|
|
33048
33393
|
return null;
|
|
33049
33394
|
}
|
|
@@ -33059,7 +33404,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
33059
33404
|
}
|
|
33060
33405
|
}
|
|
33061
33406
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
33062
|
-
|
|
33407
|
+
fs9.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
33063
33408
|
`, "utf8");
|
|
33064
33409
|
}
|
|
33065
33410
|
function getProcessCommand(pid) {
|
|
@@ -33145,10 +33490,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
33145
33490
|
};
|
|
33146
33491
|
}
|
|
33147
33492
|
function resolveMakerCliEntry() {
|
|
33148
|
-
return process.argv[1] ||
|
|
33493
|
+
return process.argv[1] || path10.resolve(process.cwd(), "dist", "maker.js");
|
|
33149
33494
|
}
|
|
33150
33495
|
function getRuntimeLogFilePath(projectRoot) {
|
|
33151
|
-
return
|
|
33496
|
+
return path10.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
33152
33497
|
}
|
|
33153
33498
|
async function refreshMakerPreview(buildResult) {
|
|
33154
33499
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -33162,7 +33507,7 @@ async function refreshMakerPreview(buildResult) {
|
|
|
33162
33507
|
ok: false,
|
|
33163
33508
|
status: 0,
|
|
33164
33509
|
url: url2,
|
|
33165
|
-
error: "Maker PAT not found. Run taptap-maker
|
|
33510
|
+
error: "Maker PAT not found. Run `taptap-maker login` first."
|
|
33166
33511
|
};
|
|
33167
33512
|
}
|
|
33168
33513
|
const controller = new AbortController();
|
|
@@ -33279,7 +33624,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
33279
33624
|
if (options.scriptsPath) {
|
|
33280
33625
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
33281
33626
|
}
|
|
33282
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
33627
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs9.existsSync(path10.join(projectRoot, "scripts", "main.lua"))) {
|
|
33283
33628
|
buildArgs.entry = "main.lua";
|
|
33284
33629
|
buildArgs.scriptsPath = "scripts";
|
|
33285
33630
|
}
|
|
@@ -33291,7 +33636,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
33291
33636
|
}
|
|
33292
33637
|
if (options.multiplayer) {
|
|
33293
33638
|
buildArgs.multiplayer = options.multiplayer;
|
|
33294
|
-
} else if (!
|
|
33639
|
+
} else if (!fs9.existsSync(path10.join(projectRoot, ".project", "settings.json"))) {
|
|
33295
33640
|
buildArgs.multiplayer = { enabled: false };
|
|
33296
33641
|
}
|
|
33297
33642
|
return buildArgs;
|
|
@@ -33332,6 +33677,7 @@ function formatBuildResult(result, progressSummary) {
|
|
|
33332
33677
|
"",
|
|
33333
33678
|
`- project_root: ${result.projectRoot}`,
|
|
33334
33679
|
`- project_id: ${result.projectId}`,
|
|
33680
|
+
...formatMakerPageOpenLines(result.makerPageOpen),
|
|
33335
33681
|
`- maker_url: ${result.buildResult.makerUrl || formatMakerAppWebUrl(result.buildResult.projectId, result.buildResult.env)}`,
|
|
33336
33682
|
`- project_path: ${result.buildResult.projectPath}`,
|
|
33337
33683
|
`- server_url: ${result.buildResult.serverUrl}`,
|
|
@@ -33405,6 +33751,7 @@ function formatBuildResult(result, progressSummary) {
|
|
|
33405
33751
|
`- project_root: ${result.projectRoot}`,
|
|
33406
33752
|
`- project_id: ${result.projectId}`,
|
|
33407
33753
|
`- maker_url: ${result.makerUrl || formatMakerAppWebUrl(result.projectId, result.env)}`,
|
|
33754
|
+
...formatMakerPageOpenLines(result.makerPageOpen),
|
|
33408
33755
|
`- project_path: ${result.projectPath}`,
|
|
33409
33756
|
`- server_url: ${result.serverUrl}`,
|
|
33410
33757
|
`- env: ${result.env}`
|
|
@@ -33435,6 +33782,17 @@ function formatPreviewRefreshLines(result) {
|
|
|
33435
33782
|
result.error ? `- preview_refresh_error: ${result.error}` : ""
|
|
33436
33783
|
].filter(Boolean);
|
|
33437
33784
|
}
|
|
33785
|
+
function formatMakerPageOpenLines(result) {
|
|
33786
|
+
if (!result) {
|
|
33787
|
+
return [];
|
|
33788
|
+
}
|
|
33789
|
+
return [
|
|
33790
|
+
`- maker_page_open: ${result.ok ? "ok" : "failed"}`,
|
|
33791
|
+
`- maker_page_url: ${result.url}`,
|
|
33792
|
+
result.error ? `- maker_page_error: ${result.error}` : "",
|
|
33793
|
+
"- next_action: 已按“不提交,只构建云端版本”打开 Maker 远端页面;如果没有自动弹出,请手动打开 maker_page_url 后再查看构建结果。"
|
|
33794
|
+
].filter(Boolean);
|
|
33795
|
+
}
|
|
33438
33796
|
function formatRuntimeLogWatchNextActionLines(result) {
|
|
33439
33797
|
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
33440
33798
|
const command = formatLocalShellCommand([
|
|
@@ -33453,11 +33811,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
33453
33811
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
33454
33812
|
`- watch_command: ${command}`,
|
|
33455
33813
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
33456
|
-
`- local_file: ${
|
|
33814
|
+
`- local_file: ${path10.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
33457
33815
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
33458
33816
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
33459
33817
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
33460
|
-
`- state_file: ${
|
|
33818
|
+
`- state_file: ${path10.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
33461
33819
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
33462
33820
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
33463
33821
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -33572,13 +33930,156 @@ function indent(value) {
|
|
|
33572
33930
|
}
|
|
33573
33931
|
|
|
33574
33932
|
// src/maker/cli/commands.ts
|
|
33575
|
-
import { spawnSync as
|
|
33576
|
-
import
|
|
33577
|
-
import
|
|
33933
|
+
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
33934
|
+
import crypto2 from "node:crypto";
|
|
33935
|
+
import fs10 from "node:fs";
|
|
33578
33936
|
import os4 from "node:os";
|
|
33579
|
-
import
|
|
33937
|
+
import path11 from "node:path";
|
|
33580
33938
|
import readline from "node:readline/promises";
|
|
33581
33939
|
import { stdin as input, stdout as output } from "node:process";
|
|
33940
|
+
|
|
33941
|
+
// src/maker/auth/cliLogin.ts
|
|
33942
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
33943
|
+
import crypto from "node:crypto";
|
|
33944
|
+
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
33945
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
33946
|
+
function createCliLoginCode() {
|
|
33947
|
+
return crypto.randomBytes(24).toString("base64url");
|
|
33948
|
+
}
|
|
33949
|
+
function getMakerCliLoginUrl(code, env) {
|
|
33950
|
+
const url2 = new URL("/pat-tokens", getMakerWebUrl(env));
|
|
33951
|
+
url2.searchParams.set("code", code);
|
|
33952
|
+
return url2.toString();
|
|
33953
|
+
}
|
|
33954
|
+
function getMakerCliLoginResultUrl(code, env) {
|
|
33955
|
+
const url2 = new URL("cli-auth/result", `${getMakerApiBaseUrl(env)}/`);
|
|
33956
|
+
url2.searchParams.set("code", code);
|
|
33957
|
+
return url2.toString();
|
|
33958
|
+
}
|
|
33959
|
+
async function loginWithCliAuthCode(options = {}) {
|
|
33960
|
+
var _a3;
|
|
33961
|
+
const env = options.env || getMakerEnvironment();
|
|
33962
|
+
const code = createCliLoginCode();
|
|
33963
|
+
const authUrl = getMakerCliLoginUrl(code, env);
|
|
33964
|
+
(_a3 = options.onStatus) == null ? void 0 : _a3.call(
|
|
33965
|
+
options,
|
|
33966
|
+
`Opening Maker PAT page: ${authUrl}
|
|
33967
|
+
请在页面登录并点击“创建 token”,CLI 会继续等待授权结果。`
|
|
33968
|
+
);
|
|
33969
|
+
if (options.openBrowser !== false) {
|
|
33970
|
+
openBrowser(authUrl);
|
|
33971
|
+
}
|
|
33972
|
+
const pat = await pollCliLoginResult(code, {
|
|
33973
|
+
...options,
|
|
33974
|
+
env
|
|
33975
|
+
});
|
|
33976
|
+
return {
|
|
33977
|
+
...pat,
|
|
33978
|
+
code,
|
|
33979
|
+
auth_url: authUrl
|
|
33980
|
+
};
|
|
33981
|
+
}
|
|
33982
|
+
async function pollCliLoginResult(code, options) {
|
|
33983
|
+
const fetchImpl = options.fetchImpl || fetch;
|
|
33984
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
33985
|
+
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
33986
|
+
const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_SHORT_FETCH_TIMEOUT_MS;
|
|
33987
|
+
const deadline = Date.now() + timeoutMs;
|
|
33988
|
+
const resultUrl = getMakerCliLoginResultUrl(code, options.env);
|
|
33989
|
+
let lastPollError;
|
|
33990
|
+
for (; ; ) {
|
|
33991
|
+
if (Date.now() >= deadline) {
|
|
33992
|
+
const suffix = lastPollError ? ` Last polling error: ${formatError2(lastPollError)}` : "";
|
|
33993
|
+
throw new Error(
|
|
33994
|
+
`Maker CLI login timed out. Run \`taptap-maker login\` and try again.${suffix}`
|
|
33995
|
+
);
|
|
33996
|
+
}
|
|
33997
|
+
let response;
|
|
33998
|
+
try {
|
|
33999
|
+
response = await fetchWithTimeout(
|
|
34000
|
+
fetchImpl,
|
|
34001
|
+
resultUrl,
|
|
34002
|
+
{
|
|
34003
|
+
headers: {
|
|
34004
|
+
Accept: "application/json"
|
|
34005
|
+
}
|
|
34006
|
+
},
|
|
34007
|
+
Math.min(requestTimeoutMs, Math.max(1, deadline - Date.now())),
|
|
34008
|
+
"Maker CLI login poll"
|
|
34009
|
+
);
|
|
34010
|
+
} catch (error2) {
|
|
34011
|
+
lastPollError = error2;
|
|
34012
|
+
await delay(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
|
|
34013
|
+
continue;
|
|
34014
|
+
}
|
|
34015
|
+
const json2 = await readJsonResponse(response);
|
|
34016
|
+
if (!response.ok) {
|
|
34017
|
+
throw new Error(
|
|
34018
|
+
`Maker CLI login poll failed: HTTP ${response.status} ${JSON.stringify(json2)}`
|
|
34019
|
+
);
|
|
34020
|
+
}
|
|
34021
|
+
const normalized = normalizePollResponse(json2);
|
|
34022
|
+
if (normalized.status === "authorized") {
|
|
34023
|
+
if (!normalized.token) {
|
|
34024
|
+
throw new Error("Maker CLI login result does not contain PAT token.");
|
|
34025
|
+
}
|
|
34026
|
+
return {
|
|
34027
|
+
token: normalized.token,
|
|
34028
|
+
expires_at: normalized.expires_at,
|
|
34029
|
+
raw: json2
|
|
34030
|
+
};
|
|
34031
|
+
}
|
|
34032
|
+
if (normalized.status === "expired" || normalized.status === "consumed") {
|
|
34033
|
+
throw new Error(`Maker CLI login ${normalized.status}. Run \`taptap-maker login\` again.`);
|
|
34034
|
+
}
|
|
34035
|
+
await delay(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
|
|
34036
|
+
}
|
|
34037
|
+
}
|
|
34038
|
+
function normalizePollResponse(data) {
|
|
34039
|
+
const source = data.data || data;
|
|
34040
|
+
const token = source.pat || source.token || source.access_token;
|
|
34041
|
+
return {
|
|
34042
|
+
status: source.status || data.status || (token ? "authorized" : "pending"),
|
|
34043
|
+
token,
|
|
34044
|
+
expires_at: source.expires_at
|
|
34045
|
+
};
|
|
34046
|
+
}
|
|
34047
|
+
async function readJsonResponse(response) {
|
|
34048
|
+
const text = await response.text();
|
|
34049
|
+
if (!text) {
|
|
34050
|
+
return {};
|
|
34051
|
+
}
|
|
34052
|
+
try {
|
|
34053
|
+
return JSON.parse(text);
|
|
34054
|
+
} catch {
|
|
34055
|
+
return { error: text };
|
|
34056
|
+
}
|
|
34057
|
+
}
|
|
34058
|
+
function openBrowser(url2) {
|
|
34059
|
+
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
34060
|
+
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
34061
|
+
const result = spawnSync5(command, args, {
|
|
34062
|
+
stdio: "ignore",
|
|
34063
|
+
windowsHide: true
|
|
34064
|
+
});
|
|
34065
|
+
if (result.error || result.status !== 0) {
|
|
34066
|
+
process.stderr.write(
|
|
34067
|
+
`Open this Maker PAT URL in your browser, then log in and click "创建 token":
|
|
34068
|
+
${url2}
|
|
34069
|
+
`
|
|
34070
|
+
);
|
|
34071
|
+
}
|
|
34072
|
+
}
|
|
34073
|
+
function delay(ms) {
|
|
34074
|
+
return new Promise((resolve) => {
|
|
34075
|
+
setTimeout(resolve, ms);
|
|
34076
|
+
});
|
|
34077
|
+
}
|
|
34078
|
+
function formatError2(error2) {
|
|
34079
|
+
return error2 instanceof Error ? error2.message : String(error2);
|
|
34080
|
+
}
|
|
34081
|
+
|
|
34082
|
+
// src/maker/cli/commands.ts
|
|
33582
34083
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
33583
34084
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
33584
34085
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs"]);
|
|
@@ -33596,6 +34097,7 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
33596
34097
|
var PAT_ARG_WARNING = "Warning: passing Maker PAT via command-line arguments exposes it via ps/shell history; prefer the interactive prompt or --pat-stdin.\n";
|
|
33597
34098
|
async function runMakerCli(argv) {
|
|
33598
34099
|
const parsed = parseArgs(argv);
|
|
34100
|
+
setMakerEnvironmentOverride(makerEnvOption(parsed));
|
|
33599
34101
|
const ctx = { json: Boolean(parsed.options.json) };
|
|
33600
34102
|
const [command, subcommand] = parsed.command;
|
|
33601
34103
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
@@ -33614,6 +34116,10 @@ async function runMakerCli(argv) {
|
|
|
33614
34116
|
await runApps(parsed, ctx);
|
|
33615
34117
|
return;
|
|
33616
34118
|
}
|
|
34119
|
+
if (command === "login") {
|
|
34120
|
+
await runLogin(parsed, ctx);
|
|
34121
|
+
return;
|
|
34122
|
+
}
|
|
33617
34123
|
if (command === "pat" && subcommand === "set") {
|
|
33618
34124
|
await runPatSet(parsed, ctx);
|
|
33619
34125
|
return;
|
|
@@ -33687,7 +34193,7 @@ function toOptionKey(value) {
|
|
|
33687
34193
|
}
|
|
33688
34194
|
async function runInit(parsed, ctx) {
|
|
33689
34195
|
rejectPackageOption(parsed);
|
|
33690
|
-
const targetDir =
|
|
34196
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
33691
34197
|
const env = makerEnvOption(parsed);
|
|
33692
34198
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
33693
34199
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -33704,7 +34210,7 @@ async function runInit(parsed, ctx) {
|
|
|
33704
34210
|
emit(ctx, "doctor", "Git is available", { version: git.version });
|
|
33705
34211
|
const pat = await resolvePat(parsed, ctx);
|
|
33706
34212
|
emit(ctx, "pat", "Maker PAT ready", { saved: getPatPath() });
|
|
33707
|
-
const tapAuth = await requestTapAuthWithPat(pat).catch((error2) => {
|
|
34213
|
+
const tapAuth = await requestTapAuthWithPat(pat, env).catch((error2) => {
|
|
33708
34214
|
throw appendPatRecoveryUrl(error2, parsed);
|
|
33709
34215
|
});
|
|
33710
34216
|
emit(ctx, "tap_auth", "TapTap token exchanged and saved", {
|
|
@@ -33749,7 +34255,8 @@ async function runInit(parsed, ctx) {
|
|
|
33749
34255
|
emit(ctx, "clone", "Maker project cloned or fetched", cloneResult);
|
|
33750
34256
|
await prepareDevKit(targetDir, ctx, {
|
|
33751
34257
|
finalizeGitignore: true,
|
|
33752
|
-
forceInstall: true
|
|
34258
|
+
forceInstall: true,
|
|
34259
|
+
environment: env
|
|
33753
34260
|
});
|
|
33754
34261
|
if (!skipMcpInstall) {
|
|
33755
34262
|
const ides = parseIdeList(stringOption(parsed, "register_mcp") || "codex,cursor,claude");
|
|
@@ -33776,27 +34283,35 @@ async function runInit(parsed, ctx) {
|
|
|
33776
34283
|
});
|
|
33777
34284
|
}
|
|
33778
34285
|
async function runDoctor(parsed, ctx) {
|
|
33779
|
-
|
|
34286
|
+
var _a3, _b;
|
|
34287
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34288
|
+
const env = makerEnvOption(parsed);
|
|
33780
34289
|
const git = checkGitEnvironment();
|
|
33781
34290
|
const pat = loadPat();
|
|
33782
34291
|
const tapAuth = loadTapAuth();
|
|
33783
34292
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
33784
|
-
const
|
|
34293
|
+
const isProjectBound = Boolean(identify.projectRoot);
|
|
34294
|
+
const projectRoot = identify.projectRoot || targetDir;
|
|
34295
|
+
const devKit = inspectAiDevKit(projectRoot);
|
|
34296
|
+
const devKitUpdate = await checkAiDevKitUpdate(projectRoot, { environment: env });
|
|
33785
34297
|
if (ctx.json) {
|
|
33786
34298
|
writeJson({
|
|
34299
|
+
env,
|
|
33787
34300
|
git,
|
|
33788
34301
|
auth: {
|
|
33789
34302
|
pat: Boolean(pat),
|
|
33790
34303
|
tap_auth: Boolean(tapAuth)
|
|
33791
34304
|
},
|
|
33792
34305
|
project: identify,
|
|
33793
|
-
dev_kit: devKit
|
|
34306
|
+
dev_kit: devKit,
|
|
34307
|
+
dev_kit_update: devKitUpdate
|
|
33794
34308
|
});
|
|
33795
34309
|
return;
|
|
33796
34310
|
}
|
|
33797
34311
|
process.stdout.write(
|
|
33798
34312
|
[
|
|
33799
34313
|
"TapTap Maker doctor",
|
|
34314
|
+
`env: ${env}`,
|
|
33800
34315
|
"",
|
|
33801
34316
|
"Git",
|
|
33802
34317
|
formatGitEnvironmentStatus(git),
|
|
@@ -33804,7 +34319,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
33804
34319
|
"Auth",
|
|
33805
34320
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
33806
34321
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
33807
|
-
pat ? "" :
|
|
34322
|
+
pat ? "" : isProjectBound ? "- next_auth_step: taptap-maker login" : "- next_step: taptap-maker init",
|
|
33808
34323
|
"",
|
|
33809
34324
|
"Project",
|
|
33810
34325
|
`- target_dir: ${targetDir}`,
|
|
@@ -33814,8 +34329,12 @@ async function runDoctor(parsed, ctx) {
|
|
|
33814
34329
|
"AI dev kit",
|
|
33815
34330
|
`- ready: ${devKit.ready ? "yes" : "no"}`,
|
|
33816
34331
|
`- missing_entries: ${devKit.missingEntries.join(", ") || "(none)"}`,
|
|
34332
|
+
`- installed_version: ${((_a3 = devKitUpdate.installed) == null ? void 0 : _a3.version) || "(unknown)"}`,
|
|
34333
|
+
`- latest_version: ${((_b = devKitUpdate.latest) == null ? void 0 : _b.version) || "(unknown)"}`,
|
|
34334
|
+
`- update_available: ${devKitUpdate.updateAvailable ? "yes" : "no"}`,
|
|
34335
|
+
devKitUpdate.versionCheckError ? `- version_check: ${devKitUpdate.versionCheckError}` : "",
|
|
33817
34336
|
"",
|
|
33818
|
-
formatMakerSkillStatus({ projectRoot
|
|
34337
|
+
formatMakerSkillStatus({ projectRoot }),
|
|
33819
34338
|
""
|
|
33820
34339
|
].filter(Boolean).join("\n")
|
|
33821
34340
|
);
|
|
@@ -33837,10 +34356,29 @@ async function runApps(parsed, ctx) {
|
|
|
33837
34356
|
process.stdout.write(`${formatMakerProjectList(projects, { showAll })}
|
|
33838
34357
|
`);
|
|
33839
34358
|
}
|
|
34359
|
+
async function runLogin(parsed, ctx) {
|
|
34360
|
+
const env = makerEnvOption(parsed);
|
|
34361
|
+
const pat = await loginWithCliAuthCode({
|
|
34362
|
+
env,
|
|
34363
|
+
onStatus: (message) => emit(ctx, "login", message)
|
|
34364
|
+
});
|
|
34365
|
+
saveManualMakerPat(pat.token);
|
|
34366
|
+
const tapAuth = await requestTapAuthWithPat(pat.token, env).catch((error2) => {
|
|
34367
|
+
throw appendPatRecoveryUrl(error2, parsed);
|
|
34368
|
+
});
|
|
34369
|
+
emit(ctx, "login", "Maker CLI login completed", {
|
|
34370
|
+
env,
|
|
34371
|
+
code: pat.code,
|
|
34372
|
+
pat_path: getPatPath(),
|
|
34373
|
+
tap_auth_path: getTapAuthPath(),
|
|
34374
|
+
kid: mask(tapAuth.kid)
|
|
34375
|
+
});
|
|
34376
|
+
}
|
|
33840
34377
|
async function runPatSet(parsed, ctx) {
|
|
33841
34378
|
const pat = await resolvePatSet(parsed, ctx);
|
|
33842
34379
|
saveManualMakerPat(pat);
|
|
33843
|
-
const
|
|
34380
|
+
const env = makerEnvOption(parsed);
|
|
34381
|
+
const tapAuth = await requestTapAuthWithPat(pat, env).catch((error2) => {
|
|
33844
34382
|
throw appendPatRecoveryUrl(error2, parsed);
|
|
33845
34383
|
});
|
|
33846
34384
|
emit(ctx, "pat", "Maker PAT and TapTap token saved", {
|
|
@@ -33851,7 +34389,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
33851
34389
|
}
|
|
33852
34390
|
async function resolvePatSet(parsed, ctx) {
|
|
33853
34391
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
33854
|
-
const pat =
|
|
34392
|
+
const pat = fs10.readFileSync(0, "utf8").trim();
|
|
33855
34393
|
if (!pat) {
|
|
33856
34394
|
throw new Error("No PAT found on stdin.");
|
|
33857
34395
|
}
|
|
@@ -33864,10 +34402,13 @@ async function resolvePatSet(parsed, ctx) {
|
|
|
33864
34402
|
return fromPositional || fromOption;
|
|
33865
34403
|
}
|
|
33866
34404
|
if (!ctx.json) {
|
|
33867
|
-
process.stdout.write(
|
|
33868
|
-
`);
|
|
34405
|
+
process.stdout.write("Starting Maker CLI login...\n");
|
|
33869
34406
|
}
|
|
33870
|
-
|
|
34407
|
+
const result = await loginWithCliAuthCode({
|
|
34408
|
+
env: makerEnvOption(parsed),
|
|
34409
|
+
onStatus: (message) => emit(ctx, "login", message)
|
|
34410
|
+
});
|
|
34411
|
+
return result.token;
|
|
33871
34412
|
}
|
|
33872
34413
|
async function runMcpInstall(parsed, ctx) {
|
|
33873
34414
|
rejectPackageOption(parsed);
|
|
@@ -33890,7 +34431,7 @@ async function runMcpVerify(parsed, ctx) {
|
|
|
33890
34431
|
rejectPackageOption(parsed);
|
|
33891
34432
|
const mode = mcpVerifyModeOption(parsed);
|
|
33892
34433
|
const command = mode === "npx" ? getNpxCliCommand(MAKER_NPM_PACKAGE) : getCurrentCliCommand();
|
|
33893
|
-
const result =
|
|
34434
|
+
const result = spawnSync6(command.command, [...command.args, "help"], {
|
|
33894
34435
|
encoding: "utf8"
|
|
33895
34436
|
});
|
|
33896
34437
|
const failureType = classifyMcpVerifyFailure(result);
|
|
@@ -33979,17 +34520,19 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
33979
34520
|
];
|
|
33980
34521
|
}
|
|
33981
34522
|
async function runDevKitUpdate(parsed, ctx) {
|
|
33982
|
-
const targetDir =
|
|
34523
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
33983
34524
|
const result = await installAiDevKit({
|
|
33984
34525
|
targetDir,
|
|
33985
|
-
preserveExisting:
|
|
34526
|
+
preserveExisting: false,
|
|
34527
|
+
replaceManagedEntries: true,
|
|
34528
|
+
environment: makerEnvOption(parsed)
|
|
33986
34529
|
});
|
|
33987
34530
|
finalizeStagedDevKitGitignore(targetDir);
|
|
33988
34531
|
emit(ctx, "dev_kit", formatDevKitInstallMessage("AI dev kit updated", result), result);
|
|
33989
34532
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
33990
34533
|
}
|
|
33991
34534
|
async function runLogsWatch(parsed, ctx) {
|
|
33992
|
-
const targetDir =
|
|
34535
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
33993
34536
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
33994
34537
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
|
|
33995
34538
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -33999,9 +34542,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
33999
34542
|
serverUrl: stringOption(parsed, "server_url"),
|
|
34000
34543
|
env: makerEnvOption(parsed)
|
|
34001
34544
|
});
|
|
34002
|
-
const runtimeDir =
|
|
34003
|
-
const runtimeLog =
|
|
34004
|
-
const pidFile =
|
|
34545
|
+
const runtimeDir = path11.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
34546
|
+
const runtimeLog = path11.join(runtimeDir, "runtime.log");
|
|
34547
|
+
const pidFile = path11.join(runtimeDir, "watcher.pid");
|
|
34005
34548
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
34006
34549
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
34007
34550
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -34046,10 +34589,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
34046
34589
|
}
|
|
34047
34590
|
}
|
|
34048
34591
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
34049
|
-
|
|
34592
|
+
fs10.mkdirSync(path11.dirname(pidFile), { recursive: true });
|
|
34050
34593
|
const existingPid = readPidFile(pidFile);
|
|
34051
34594
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
34052
|
-
|
|
34595
|
+
fs10.writeFileSync(
|
|
34053
34596
|
pidFile,
|
|
34054
34597
|
`${JSON.stringify(
|
|
34055
34598
|
{
|
|
@@ -34067,10 +34610,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
34067
34610
|
return previous;
|
|
34068
34611
|
}
|
|
34069
34612
|
function readPidFile(pidFile) {
|
|
34070
|
-
if (!
|
|
34613
|
+
if (!fs10.existsSync(pidFile)) {
|
|
34071
34614
|
return void 0;
|
|
34072
34615
|
}
|
|
34073
|
-
const raw =
|
|
34616
|
+
const raw = fs10.readFileSync(pidFile, "utf8").trim();
|
|
34074
34617
|
let pid = Number(raw);
|
|
34075
34618
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
34076
34619
|
try {
|
|
@@ -34090,7 +34633,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
34090
34633
|
}
|
|
34091
34634
|
cleaned = true;
|
|
34092
34635
|
if (readPidFile(pidFile) === process.pid) {
|
|
34093
|
-
|
|
34636
|
+
fs10.rmSync(pidFile, { force: true });
|
|
34094
34637
|
}
|
|
34095
34638
|
};
|
|
34096
34639
|
process.once("exit", cleanup);
|
|
@@ -34114,18 +34657,20 @@ async function resolvePat(parsed, ctx) {
|
|
|
34114
34657
|
}
|
|
34115
34658
|
if (booleanOption(parsed, "skip_confirm")) {
|
|
34116
34659
|
throw new Error(
|
|
34117
|
-
|
|
34660
|
+
"Maker PAT missing. Run `taptap-maker login` or provide --pat/MAKER_PAT for non-interactive init."
|
|
34118
34661
|
);
|
|
34119
34662
|
}
|
|
34120
|
-
|
|
34121
|
-
|
|
34122
|
-
pat_page: patPage
|
|
34663
|
+
emit(ctx, "pat_required", "Maker login is required", {
|
|
34664
|
+
next_step: "taptap-maker login"
|
|
34123
34665
|
});
|
|
34124
34666
|
if (!ctx.json) {
|
|
34125
|
-
process.stdout.write(
|
|
34126
|
-
`);
|
|
34667
|
+
process.stdout.write("Starting Maker CLI login...\n");
|
|
34127
34668
|
}
|
|
34128
|
-
const
|
|
34669
|
+
const loginResult = await loginWithCliAuthCode({
|
|
34670
|
+
env: makerEnvOption(parsed),
|
|
34671
|
+
onStatus: (message) => emit(ctx, "login", message)
|
|
34672
|
+
});
|
|
34673
|
+
const pat = loginResult.token;
|
|
34129
34674
|
saveManualMakerPat(pat);
|
|
34130
34675
|
return pat;
|
|
34131
34676
|
}
|
|
@@ -34197,7 +34742,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
34197
34742
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
34198
34743
|
});
|
|
34199
34744
|
writeDevKitStagedGitignore(
|
|
34200
|
-
|
|
34745
|
+
path11.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
34201
34746
|
listPresentDevKitManagedEntries(targetDir)
|
|
34202
34747
|
);
|
|
34203
34748
|
if (options.finalizeGitignore) {
|
|
@@ -34214,7 +34759,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
34214
34759
|
);
|
|
34215
34760
|
} catch (error2) {
|
|
34216
34761
|
writeDevKitStagedGitignore(
|
|
34217
|
-
|
|
34762
|
+
path11.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
34218
34763
|
listPresentDevKitManagedEntries(targetDir)
|
|
34219
34764
|
);
|
|
34220
34765
|
if (options.finalizeGitignore) {
|
|
@@ -34232,6 +34777,7 @@ ${detail}`, {
|
|
|
34232
34777
|
const result = await installAiDevKit({
|
|
34233
34778
|
targetDir,
|
|
34234
34779
|
preserveExisting: options.preserveExisting,
|
|
34780
|
+
environment: options.environment,
|
|
34235
34781
|
onSkillInstallerStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
34236
34782
|
});
|
|
34237
34783
|
if (options.finalizeGitignore) {
|
|
@@ -34271,19 +34817,13 @@ ${detail}`, {
|
|
|
34271
34817
|
error: detail
|
|
34272
34818
|
});
|
|
34273
34819
|
}
|
|
34274
|
-
function appendPatRecoveryUrl(error2,
|
|
34820
|
+
function appendPatRecoveryUrl(error2, _parsed) {
|
|
34275
34821
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
34276
|
-
if (!isPatValidationFailure(message)
|
|
34822
|
+
if (!isPatValidationFailure(message)) {
|
|
34277
34823
|
return error2 instanceof Error ? error2 : new Error(message);
|
|
34278
34824
|
}
|
|
34279
|
-
const patPage = getMakerPatTokensUrl(makerEnvOption(parsed));
|
|
34280
34825
|
return new Error(
|
|
34281
|
-
[
|
|
34282
|
-
message,
|
|
34283
|
-
"",
|
|
34284
|
-
`PAT 页面:${patPage}`,
|
|
34285
|
-
"请在该页面创建新的 Maker PAT,然后运行 `taptap-maker pat set` 并粘贴 PAT。"
|
|
34286
|
-
].join("\n")
|
|
34826
|
+
[message, "", "请运行 `taptap-maker login` 重新完成 Maker CLI 登录授权。"].join("\n")
|
|
34287
34827
|
);
|
|
34288
34828
|
}
|
|
34289
34829
|
function isPatValidationFailure(message) {
|
|
@@ -34307,7 +34847,7 @@ function installMcpConfig(ide, options) {
|
|
|
34307
34847
|
}
|
|
34308
34848
|
function installMcpConfigUnsafe(ide, options) {
|
|
34309
34849
|
if (ide === "codex") {
|
|
34310
|
-
const configPath =
|
|
34850
|
+
const configPath = path11.join(os4.homedir(), ".codex", "config.toml");
|
|
34311
34851
|
mergeCodexMcpConfig(configPath, options);
|
|
34312
34852
|
return {
|
|
34313
34853
|
ide,
|
|
@@ -34317,7 +34857,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
34317
34857
|
};
|
|
34318
34858
|
}
|
|
34319
34859
|
if (ide === "cursor") {
|
|
34320
|
-
const configPath =
|
|
34860
|
+
const configPath = path11.join(os4.homedir(), ".cursor", "mcp.json");
|
|
34321
34861
|
mergeJsonMcpConfig(configPath, options);
|
|
34322
34862
|
return {
|
|
34323
34863
|
ide,
|
|
@@ -34331,7 +34871,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
34331
34871
|
if (claudeResult.ok) {
|
|
34332
34872
|
return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
|
|
34333
34873
|
}
|
|
34334
|
-
const configPath =
|
|
34874
|
+
const configPath = path11.join(os4.homedir(), ".claude.json");
|
|
34335
34875
|
mergeJsonMcpConfig(configPath, options);
|
|
34336
34876
|
return {
|
|
34337
34877
|
ide,
|
|
@@ -34348,13 +34888,13 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
34348
34888
|
const mcpServers = asObject(existing.mcpServers);
|
|
34349
34889
|
mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
|
|
34350
34890
|
existing.mcpServers = mcpServers;
|
|
34351
|
-
|
|
34352
|
-
|
|
34891
|
+
fs10.mkdirSync(path11.dirname(configPath), { recursive: true });
|
|
34892
|
+
fs10.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
|
|
34353
34893
|
`, "utf8");
|
|
34354
34894
|
}
|
|
34355
34895
|
function mergeCodexMcpConfig(configPath, options) {
|
|
34356
34896
|
const backupPath = backupIfExists(configPath);
|
|
34357
|
-
const existing =
|
|
34897
|
+
const existing = fs10.existsSync(configPath) ? fs10.readFileSync(configPath, "utf8") : "";
|
|
34358
34898
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
34359
34899
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
34360
34900
|
const command = getNpxCommand();
|
|
@@ -34367,9 +34907,9 @@ function mergeCodexMcpConfig(configPath, options) {
|
|
|
34367
34907
|
`TAPTAP_MCP_ENV = "${options.env}"`,
|
|
34368
34908
|
""
|
|
34369
34909
|
].join("\n");
|
|
34370
|
-
|
|
34371
|
-
|
|
34372
|
-
const updated =
|
|
34910
|
+
fs10.mkdirSync(path11.dirname(configPath), { recursive: true });
|
|
34911
|
+
fs10.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
|
|
34912
|
+
const updated = fs10.readFileSync(configPath, "utf8");
|
|
34373
34913
|
const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
|
|
34374
34914
|
if (duplicates.length > 0) {
|
|
34375
34915
|
restoreBackup(configPath, backupPath);
|
|
@@ -34422,7 +34962,7 @@ function normalizeCodexMcpTablePath(tablePath, mcpName) {
|
|
|
34422
34962
|
}
|
|
34423
34963
|
function tryClaudeMcpAdd(options) {
|
|
34424
34964
|
const command = process.platform === "win32" ? "claude.cmd" : "claude";
|
|
34425
|
-
const result =
|
|
34965
|
+
const result = spawnSync6(
|
|
34426
34966
|
command,
|
|
34427
34967
|
[
|
|
34428
34968
|
"mcp",
|
|
@@ -34474,10 +35014,10 @@ function rejectPackageOption(parsed) {
|
|
|
34474
35014
|
}
|
|
34475
35015
|
}
|
|
34476
35016
|
function readJsonObject(filePath) {
|
|
34477
|
-
if (!
|
|
35017
|
+
if (!fs10.existsSync(filePath)) {
|
|
34478
35018
|
return {};
|
|
34479
35019
|
}
|
|
34480
|
-
return JSON.parse(
|
|
35020
|
+
return JSON.parse(fs10.readFileSync(filePath, "utf8"));
|
|
34481
35021
|
}
|
|
34482
35022
|
function asObject(value) {
|
|
34483
35023
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -34486,26 +35026,26 @@ function asObject(value) {
|
|
|
34486
35026
|
return {};
|
|
34487
35027
|
}
|
|
34488
35028
|
function backupIfExists(filePath) {
|
|
34489
|
-
if (!
|
|
35029
|
+
if (!fs10.existsSync(filePath)) {
|
|
34490
35030
|
return void 0;
|
|
34491
35031
|
}
|
|
34492
35032
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
|
|
34493
35033
|
const backupPath = `${filePath}.bak.${stamp}`;
|
|
34494
|
-
|
|
35034
|
+
fs10.copyFileSync(filePath, backupPath);
|
|
34495
35035
|
return backupPath;
|
|
34496
35036
|
}
|
|
34497
35037
|
function restoreBackup(filePath, backupPath) {
|
|
34498
35038
|
if (backupPath) {
|
|
34499
|
-
|
|
35039
|
+
fs10.copyFileSync(backupPath, filePath);
|
|
34500
35040
|
return;
|
|
34501
35041
|
}
|
|
34502
|
-
|
|
35042
|
+
fs10.rmSync(filePath, { force: true });
|
|
34503
35043
|
}
|
|
34504
35044
|
function saveInitState(targetDir, state) {
|
|
34505
|
-
|
|
34506
|
-
const key =
|
|
34507
|
-
|
|
34508
|
-
|
|
35045
|
+
fs10.mkdirSync(getMakerHome(), { recursive: true });
|
|
35046
|
+
const key = crypto2.createHash("sha256").update(path11.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
35047
|
+
fs10.writeFileSync(
|
|
35048
|
+
path11.join(getMakerHome(), `init-state-${key}.json`),
|
|
34509
35049
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
34510
35050
|
`,
|
|
34511
35051
|
"utf8"
|
|
@@ -34640,7 +35180,8 @@ function makerEnvOption(parsed) {
|
|
|
34640
35180
|
if (env === "rnd" || env === "production") {
|
|
34641
35181
|
return env;
|
|
34642
35182
|
}
|
|
34643
|
-
|
|
35183
|
+
const targetDir = stringOption(parsed, "target_dir");
|
|
35184
|
+
return getMakerEnvironment(void 0, targetDir ? path11.resolve(targetDir) : process.cwd());
|
|
34644
35185
|
}
|
|
34645
35186
|
function mcpVerifyModeOption(parsed) {
|
|
34646
35187
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -34684,8 +35225,9 @@ function printHelp() {
|
|
|
34684
35225
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
34685
35226
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
34686
35227
|
" # --pat warns: PAT appears in ps/history",
|
|
35228
|
+
" taptap-maker login [--env rnd|production] [--json]",
|
|
34687
35229
|
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
34688
|
-
" taptap-maker pat set [PAT|--pat PAT] [--json] # warns: PAT appears in ps/history",
|
|
35230
|
+
" taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
|
|
34689
35231
|
" taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
34690
35232
|
" [--json] # alias for mcp install",
|
|
34691
35233
|
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
@@ -34711,14 +35253,14 @@ function formatCliError(error2) {
|
|
|
34711
35253
|
}
|
|
34712
35254
|
|
|
34713
35255
|
// src/maker/crashLog.ts
|
|
34714
|
-
import
|
|
34715
|
-
import
|
|
35256
|
+
import fs11 from "node:fs";
|
|
35257
|
+
import path12 from "node:path";
|
|
34716
35258
|
var DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
34717
35259
|
var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
|
|
34718
35260
|
function appendMakerCrashLog(source, error2, options = {}) {
|
|
34719
35261
|
const makerHome = getMakerHome();
|
|
34720
|
-
|
|
34721
|
-
const logPath =
|
|
35262
|
+
fs11.mkdirSync(makerHome, { recursive: true });
|
|
35263
|
+
const logPath = path12.join(makerHome, "mcp-crash.log");
|
|
34722
35264
|
const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
|
|
34723
35265
|
const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
|
|
34724
35266
|
const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
|
|
@@ -34728,31 +35270,31 @@ function appendMakerCrashLog(source, error2, options = {}) {
|
|
|
34728
35270
|
);
|
|
34729
35271
|
const entryBytes = Buffer.byteLength(entry, "utf8");
|
|
34730
35272
|
rotateIfNeeded(logPath, maxBytes, entryBytes);
|
|
34731
|
-
|
|
35273
|
+
fs11.appendFileSync(logPath, entry, "utf8");
|
|
34732
35274
|
}
|
|
34733
35275
|
function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
|
|
34734
|
-
if (!
|
|
35276
|
+
if (!fs11.existsSync(logPath)) {
|
|
34735
35277
|
return;
|
|
34736
35278
|
}
|
|
34737
|
-
const currentBytes =
|
|
35279
|
+
const currentBytes = fs11.statSync(logPath).size;
|
|
34738
35280
|
if (currentBytes + incomingBytes <= maxBytes) {
|
|
34739
35281
|
return;
|
|
34740
35282
|
}
|
|
34741
35283
|
const rotatedPath = `${logPath}.1`;
|
|
34742
35284
|
writeFileTail(logPath, rotatedPath, maxBytes);
|
|
34743
|
-
|
|
35285
|
+
fs11.writeFileSync(logPath, "", "utf8");
|
|
34744
35286
|
}
|
|
34745
35287
|
function writeFileTail(sourcePath, targetPath, maxBytes) {
|
|
34746
|
-
const size =
|
|
35288
|
+
const size = fs11.statSync(sourcePath).size;
|
|
34747
35289
|
const bytesToRead = Math.min(size, maxBytes);
|
|
34748
35290
|
const start = Math.max(0, size - bytesToRead);
|
|
34749
|
-
const fd =
|
|
35291
|
+
const fd = fs11.openSync(sourcePath, "r");
|
|
34750
35292
|
try {
|
|
34751
35293
|
const buffer = Buffer.alloc(bytesToRead);
|
|
34752
|
-
|
|
34753
|
-
|
|
35294
|
+
fs11.readSync(fd, buffer, 0, bytesToRead, start);
|
|
35295
|
+
fs11.writeFileSync(targetPath, buffer);
|
|
34754
35296
|
} finally {
|
|
34755
|
-
|
|
35297
|
+
fs11.closeSync(fd);
|
|
34756
35298
|
}
|
|
34757
35299
|
}
|
|
34758
35300
|
function truncateUtf8(value, maxBytes) {
|
|
@@ -34944,13 +35486,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
34944
35486
|
}
|
|
34945
35487
|
|
|
34946
35488
|
// node_modules/pkce-challenge/dist/index.node.js
|
|
34947
|
-
var
|
|
35489
|
+
var crypto3;
|
|
34948
35490
|
var _a2;
|
|
34949
|
-
|
|
35491
|
+
crypto3 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
|
|
34950
35492
|
globalThis.crypto ?? // Node.js >18
|
|
34951
35493
|
import("node:crypto").then((m) => m.webcrypto);
|
|
34952
35494
|
async function getRandomValues(size) {
|
|
34953
|
-
return (await
|
|
35495
|
+
return (await crypto3).getRandomValues(new Uint8Array(size));
|
|
34954
35496
|
}
|
|
34955
35497
|
async function random(size) {
|
|
34956
35498
|
const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
@@ -34966,7 +35508,7 @@ async function generateVerifier(length) {
|
|
|
34966
35508
|
return await random(length);
|
|
34967
35509
|
}
|
|
34968
35510
|
async function generateChallenge(code_verifier) {
|
|
34969
|
-
const buffer = await (await
|
|
35511
|
+
const buffer = await (await crypto3).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
34970
35512
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
34971
35513
|
}
|
|
34972
35514
|
async function pkceChallenge(length) {
|
|
@@ -36036,14 +36578,14 @@ var StreamableHTTPClientTransport = class {
|
|
|
36036
36578
|
(_a3 = this.onerror) == null ? void 0 : _a3.call(this, new Error(`Maximum reconnection attempts (${maxRetries}) exceeded.`));
|
|
36037
36579
|
return;
|
|
36038
36580
|
}
|
|
36039
|
-
const
|
|
36581
|
+
const delay2 = this._getNextReconnectionDelay(attemptCount);
|
|
36040
36582
|
this._reconnectionTimeout = setTimeout(() => {
|
|
36041
36583
|
this._startOrAuthSse(options).catch((error2) => {
|
|
36042
36584
|
var _a4;
|
|
36043
36585
|
(_a4 = this.onerror) == null ? void 0 : _a4.call(this, new Error(`Failed to reconnect SSE stream: ${error2 instanceof Error ? error2.message : String(error2)}`));
|
|
36044
36586
|
this._scheduleReconnection(options, attemptCount + 1);
|
|
36045
36587
|
});
|
|
36046
|
-
},
|
|
36588
|
+
}, delay2);
|
|
36047
36589
|
}
|
|
36048
36590
|
_handleSseStream(stream, options, isReconnectable) {
|
|
36049
36591
|
if (!stream) {
|
|
@@ -36321,8 +36863,8 @@ var StreamableHTTPClientTransport = class {
|
|
|
36321
36863
|
};
|
|
36322
36864
|
|
|
36323
36865
|
// src/mcp-proxy/proxy.ts
|
|
36324
|
-
import * as
|
|
36325
|
-
import * as
|
|
36866
|
+
import * as path14 from "node:path";
|
|
36867
|
+
import * as crypto5 from "node:crypto";
|
|
36326
36868
|
|
|
36327
36869
|
// src/mcp-proxy/cookieJar.ts
|
|
36328
36870
|
var CookieJar = class {
|
|
@@ -36503,9 +37045,9 @@ function createCookieFetch(cookieJar) {
|
|
|
36503
37045
|
}
|
|
36504
37046
|
|
|
36505
37047
|
// src/core/utils/logWriter.ts
|
|
36506
|
-
import * as
|
|
36507
|
-
import * as
|
|
36508
|
-
import * as
|
|
37048
|
+
import * as fs12 from "node:fs";
|
|
37049
|
+
import * as path13 from "node:path";
|
|
37050
|
+
import * as crypto4 from "node:crypto";
|
|
36509
37051
|
|
|
36510
37052
|
// src/core/types/log.ts
|
|
36511
37053
|
var LOG_LEVEL_PRIORITY = {
|
|
@@ -36545,7 +37087,7 @@ var LogWriter = class {
|
|
|
36545
37087
|
return;
|
|
36546
37088
|
}
|
|
36547
37089
|
try {
|
|
36548
|
-
await
|
|
37090
|
+
await fs12.promises.mkdir(this.config.logDir, { recursive: true });
|
|
36549
37091
|
await this.cleanupOldLogs();
|
|
36550
37092
|
this.initialized = true;
|
|
36551
37093
|
} catch (error2) {
|
|
@@ -36568,7 +37110,7 @@ var LogWriter = class {
|
|
|
36568
37110
|
*/
|
|
36569
37111
|
getLogFilePath(date5) {
|
|
36570
37112
|
const d = date5 || this.getCurrentDate();
|
|
36571
|
-
return
|
|
37113
|
+
return path13.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
36572
37114
|
}
|
|
36573
37115
|
/**
|
|
36574
37116
|
* 获取或创建写入流
|
|
@@ -36583,7 +37125,7 @@ var LogWriter = class {
|
|
|
36583
37125
|
}
|
|
36584
37126
|
this.currentDate = date5;
|
|
36585
37127
|
try {
|
|
36586
|
-
this.writeStream =
|
|
37128
|
+
this.writeStream = fs12.createWriteStream(this.getLogFilePath(date5), {
|
|
36587
37129
|
flags: "a",
|
|
36588
37130
|
encoding: "utf8"
|
|
36589
37131
|
});
|
|
@@ -36635,11 +37177,11 @@ var LogWriter = class {
|
|
|
36635
37177
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
36636
37178
|
try {
|
|
36637
37179
|
const filePath = this.getLogFilePath();
|
|
36638
|
-
const dir =
|
|
36639
|
-
if (!
|
|
36640
|
-
|
|
37180
|
+
const dir = path13.dirname(filePath);
|
|
37181
|
+
if (!fs12.existsSync(dir)) {
|
|
37182
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
36641
37183
|
}
|
|
36642
|
-
|
|
37184
|
+
fs12.appendFileSync(filePath, message, "utf8");
|
|
36643
37185
|
} catch {
|
|
36644
37186
|
}
|
|
36645
37187
|
}
|
|
@@ -36650,7 +37192,7 @@ var LogWriter = class {
|
|
|
36650
37192
|
async cleanupOldLogs() {
|
|
36651
37193
|
if (this.config.maxDays <= 0) return;
|
|
36652
37194
|
try {
|
|
36653
|
-
const files = await
|
|
37195
|
+
const files = await fs12.promises.readdir(this.config.logDir);
|
|
36654
37196
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
36655
37197
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
36656
37198
|
const prefix = this.config.prefix;
|
|
@@ -36665,7 +37207,7 @@ var LogWriter = class {
|
|
|
36665
37207
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
36666
37208
|
const fileDate = new Date(year, month - 1, day);
|
|
36667
37209
|
if (fileDate < cutoffDate) {
|
|
36668
|
-
await
|
|
37210
|
+
await fs12.promises.unlink(path13.join(this.config.logDir, file2));
|
|
36669
37211
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
36670
37212
|
`);
|
|
36671
37213
|
}
|
|
@@ -36736,10 +37278,10 @@ var TapTapMCPProxy = class {
|
|
|
36736
37278
|
const { user_id, project_id } = this.config.tenant;
|
|
36737
37279
|
let logDir;
|
|
36738
37280
|
if (user_id && project_id) {
|
|
36739
|
-
logDir =
|
|
37281
|
+
logDir = path14.join(logRoot, "proxy", user_id, project_id);
|
|
36740
37282
|
} else {
|
|
36741
|
-
const kidHash =
|
|
36742
|
-
logDir =
|
|
37283
|
+
const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
37284
|
+
logDir = path14.join(logRoot, "proxy", kidHash);
|
|
36743
37285
|
}
|
|
36744
37286
|
return new LogWriter({
|
|
36745
37287
|
logDir,
|
|
@@ -37374,8 +37916,9 @@ function printHelp2() {
|
|
|
37374
37916
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
37375
37917
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
37376
37918
|
" # --pat warns: PAT appears in ps/history",
|
|
37919
|
+
" taptap-maker login [--env rnd|production] [--json]",
|
|
37377
37920
|
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
37378
|
-
" taptap-maker pat set [PAT|--pat PAT] [--json] # warns: PAT appears in ps/history",
|
|
37921
|
+
" taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
|
|
37379
37922
|
" taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
37380
37923
|
" [--json] # alias for mcp install",
|
|
37381
37924
|
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|