@taptap/maker 0.0.10 → 0.0.12
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 +1064 -542
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +22 -24
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 spawnSync6(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,7 +12995,7 @@ 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 = spawnSync6;
|
|
12999
12999
|
module.exports._parse = parse3;
|
|
13000
13000
|
module.exports._enoent = enoent;
|
|
13001
13001
|
}
|
|
@@ -13003,8 +13003,8 @@ var require_cross_spawn = __commonJS({
|
|
|
13003
13003
|
|
|
13004
13004
|
// src/maker/server/mcp.ts
|
|
13005
13005
|
import { execFileSync, spawn as spawn4 } from "node:child_process";
|
|
13006
|
-
import
|
|
13007
|
-
import
|
|
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") {
|
|
@@ -29369,6 +29639,7 @@ var MakerGitError = class extends Error {
|
|
|
29369
29639
|
}
|
|
29370
29640
|
};
|
|
29371
29641
|
var MAKER_FIRST_CLONE_WAIT_MESSAGE = "First Maker clone/fetch can take 20+ seconds while the server prepares the repository. Please keep this running; transient 503/5xx errors are retried automatically.";
|
|
29642
|
+
var MAKER_GIT_SHALLOW_DEPTH = 1;
|
|
29372
29643
|
function getConfiguredMakerApiBase() {
|
|
29373
29644
|
return getMakerEndpoints().apiBase;
|
|
29374
29645
|
}
|
|
@@ -29462,7 +29733,7 @@ async function listMakerProjects(options) {
|
|
|
29462
29733
|
}
|
|
29463
29734
|
async function cloneMakerProject(options) {
|
|
29464
29735
|
var _a3, _b, _c, _d, _e, _f, _g, _h;
|
|
29465
|
-
const target =
|
|
29736
|
+
const target = path6.resolve(options.targetDir);
|
|
29466
29737
|
ensureTargetCanBindApp(target, options.appId);
|
|
29467
29738
|
const warnings = createPreCloneWarnings(target);
|
|
29468
29739
|
(_a3 = options.onProgress) == null ? void 0 : _a3.call(options, {
|
|
@@ -29558,9 +29829,9 @@ async function cloneMakerProject(options) {
|
|
|
29558
29829
|
progress: 10,
|
|
29559
29830
|
total: 100,
|
|
29560
29831
|
phase: "clone",
|
|
29561
|
-
message: `
|
|
29832
|
+
message: `Checking out Maker project ${options.appId}`
|
|
29562
29833
|
});
|
|
29563
|
-
transientRetries += await
|
|
29834
|
+
transientRetries += await fetchAndCheckoutTarget(
|
|
29564
29835
|
target,
|
|
29565
29836
|
authUrl,
|
|
29566
29837
|
pat.token,
|
|
@@ -29581,9 +29852,9 @@ async function cloneMakerProject(options) {
|
|
|
29581
29852
|
progress: 10,
|
|
29582
29853
|
total: 100,
|
|
29583
29854
|
phase: "clone",
|
|
29584
|
-
message: `Retrying
|
|
29855
|
+
message: `Retrying Maker project checkout ${options.appId} with refreshed PAT`
|
|
29585
29856
|
});
|
|
29586
|
-
transientRetries += await
|
|
29857
|
+
transientRetries += await fetchAndCheckoutTarget(
|
|
29587
29858
|
target,
|
|
29588
29859
|
authUrl,
|
|
29589
29860
|
pat.token,
|
|
@@ -29608,7 +29879,7 @@ async function cloneMakerProject(options) {
|
|
|
29608
29879
|
progress: 100,
|
|
29609
29880
|
total: 100,
|
|
29610
29881
|
phase: "done",
|
|
29611
|
-
message: "Maker project
|
|
29882
|
+
message: "Maker project checkout completed"
|
|
29612
29883
|
});
|
|
29613
29884
|
return {
|
|
29614
29885
|
appId: options.appId,
|
|
@@ -29628,7 +29899,7 @@ async function pushMakerProject(options) {
|
|
|
29628
29899
|
phase: "prepare",
|
|
29629
29900
|
message: "Preparing Maker project push"
|
|
29630
29901
|
});
|
|
29631
|
-
const requestedCwd =
|
|
29902
|
+
const requestedCwd = path6.resolve(options.cwd);
|
|
29632
29903
|
const workspace = resolveUsableMakerGitWorkspace(requestedCwd);
|
|
29633
29904
|
const cwd = workspace.projectRoot;
|
|
29634
29905
|
const project = loadProjectConfig(cwd);
|
|
@@ -29934,7 +30205,7 @@ async function inspectMakerRemoteSyncStatus(cwd) {
|
|
|
29934
30205
|
}
|
|
29935
30206
|
function getMakerRemoteSyncFailureNextAction(failure) {
|
|
29936
30207
|
if (failure.classification === "auth") {
|
|
29937
|
-
return
|
|
30208
|
+
return "暂时无法检查 Maker 远端是否有新提交:Git 鉴权失败。请运行 `taptap-maker login` 重新完成 Maker 登录授权后,再重新读取 maker://status。";
|
|
29938
30209
|
}
|
|
29939
30210
|
return "暂时无法检查 Maker 远端是否有新提交。请把 failure 信息反馈给用户;如果只是 503、5xx、超时或网络中断,可稍后重新读取 maker://status。";
|
|
29940
30211
|
}
|
|
@@ -30155,7 +30426,7 @@ function nextActionForFailure(classification) {
|
|
|
30155
30426
|
case "git_missing":
|
|
30156
30427
|
return "本机未检测到可用的 Git。请用户自行安装 Git,并在 `git --version` 可用后重启 MCP 客户端再重试;安装前不要执行 clone、fetch、commit 或 push。";
|
|
30157
30428
|
case "auth":
|
|
30158
|
-
return
|
|
30429
|
+
return "Maker Git 鉴权失败。请运行 `taptap-maker login` 重新完成 Maker 登录授权后重试。";
|
|
30159
30430
|
case "remote_transient":
|
|
30160
30431
|
return "远端 Maker git 服务临时不可用。本地 commit 会保留;不要手动执行通用 git push,稍后直接重试 maker_build_current_directory。";
|
|
30161
30432
|
case "branch_not_allowed":
|
|
@@ -30258,46 +30529,44 @@ async function ensureAuthenticatedOrigin(options) {
|
|
|
30258
30529
|
function makeAuthenticatedGitUrl(gitUrl, pat) {
|
|
30259
30530
|
return gitUrl.replace(/^https:\/\//, `https://git:${encodeURIComponent(pat)}@`);
|
|
30260
30531
|
}
|
|
30261
|
-
async function
|
|
30262
|
-
if (
|
|
30532
|
+
async function fetchAndCheckoutTarget(target, authUrl, pat, onProgress) {
|
|
30533
|
+
if (fs5.existsSync(target) && hasDirectoryEntries(target)) {
|
|
30263
30534
|
onProgress == null ? void 0 : onProgress({
|
|
30264
30535
|
progress: 10,
|
|
30265
30536
|
total: 100,
|
|
30266
30537
|
phase: "clone",
|
|
30267
30538
|
message: "Target directory is not empty; initializing git repository in place and keeping existing untracked files unless they conflict with Maker project files."
|
|
30268
30539
|
});
|
|
30269
|
-
let transientRetries = 0;
|
|
30270
|
-
emitFirstCloneWaitNotice(onProgress, "fetch");
|
|
30271
|
-
transientRetries += await runGitCaptureWithTransientRetry(["init", target], {
|
|
30272
|
-
sanitize: pat,
|
|
30273
|
-
onProgress
|
|
30274
|
-
});
|
|
30275
|
-
await setOrigin(target, authUrl);
|
|
30276
|
-
transientRetries += await runGitWithTransientRetry(["fetch", "--progress", "origin"], {
|
|
30277
|
-
cwd: target,
|
|
30278
|
-
onProgress
|
|
30279
|
-
});
|
|
30280
|
-
const branch = await resolveRemoteDefaultBranch(target);
|
|
30281
|
-
await assertNoCheckoutFileConflicts(target, branch);
|
|
30282
|
-
try {
|
|
30283
|
-
transientRetries += await runGitCaptureWithTransientRetry(
|
|
30284
|
-
["checkout", "-B", branch, `origin/${branch}`],
|
|
30285
|
-
{
|
|
30286
|
-
cwd: target,
|
|
30287
|
-
sanitize: pat,
|
|
30288
|
-
onProgress
|
|
30289
|
-
}
|
|
30290
|
-
);
|
|
30291
|
-
} catch (error2) {
|
|
30292
|
-
throw enhanceCheckoutConflictError(error2, target);
|
|
30293
|
-
}
|
|
30294
|
-
return transientRetries;
|
|
30295
30540
|
}
|
|
30296
|
-
|
|
30297
|
-
|
|
30541
|
+
let transientRetries = 0;
|
|
30542
|
+
emitFirstCloneWaitNotice(onProgress, "fetch");
|
|
30543
|
+
transientRetries += await runGitCaptureWithTransientRetry(["init", target], {
|
|
30298
30544
|
sanitize: pat,
|
|
30299
30545
|
onProgress
|
|
30300
30546
|
});
|
|
30547
|
+
await setOrigin(target, authUrl);
|
|
30548
|
+
transientRetries += await runGitWithTransientRetry(createShallowFetchArgs(), {
|
|
30549
|
+
cwd: target,
|
|
30550
|
+
onProgress
|
|
30551
|
+
});
|
|
30552
|
+
const branch = await resolveRemoteDefaultBranch(target);
|
|
30553
|
+
await assertNoCheckoutFileConflicts(target, branch);
|
|
30554
|
+
try {
|
|
30555
|
+
transientRetries += await runGitCaptureWithTransientRetry(
|
|
30556
|
+
["checkout", "-B", branch, `origin/${branch}`],
|
|
30557
|
+
{
|
|
30558
|
+
cwd: target,
|
|
30559
|
+
sanitize: pat,
|
|
30560
|
+
onProgress
|
|
30561
|
+
}
|
|
30562
|
+
);
|
|
30563
|
+
} catch (error2) {
|
|
30564
|
+
throw enhanceCheckoutConflictError(error2, target);
|
|
30565
|
+
}
|
|
30566
|
+
return transientRetries;
|
|
30567
|
+
}
|
|
30568
|
+
function createShallowFetchArgs() {
|
|
30569
|
+
return ["fetch", "--progress", `--depth=${String(MAKER_GIT_SHALLOW_DEPTH)}`, "origin"];
|
|
30301
30570
|
}
|
|
30302
30571
|
function emitFirstCloneWaitNotice(onProgress, phase) {
|
|
30303
30572
|
onProgress == null ? void 0 : onProgress({
|
|
@@ -30308,23 +30577,23 @@ function emitFirstCloneWaitNotice(onProgress, phase) {
|
|
|
30308
30577
|
});
|
|
30309
30578
|
}
|
|
30310
30579
|
function hasDirectoryEntries(target) {
|
|
30311
|
-
if (!
|
|
30580
|
+
if (!fs5.existsSync(target)) {
|
|
30312
30581
|
return false;
|
|
30313
30582
|
}
|
|
30314
|
-
return
|
|
30583
|
+
return fs5.readdirSync(target).length > 0;
|
|
30315
30584
|
}
|
|
30316
30585
|
function listLocalFiles(root) {
|
|
30317
|
-
if (!
|
|
30586
|
+
if (!fs5.existsSync(root)) {
|
|
30318
30587
|
return [];
|
|
30319
30588
|
}
|
|
30320
30589
|
const files = [];
|
|
30321
30590
|
const visit = (dir, relativeDir) => {
|
|
30322
|
-
for (const entry of
|
|
30591
|
+
for (const entry of fs5.readdirSync(dir, { withFileTypes: true })) {
|
|
30323
30592
|
const relativePath = relativeDir ? `${relativeDir}/${entry.name}` : entry.name;
|
|
30324
30593
|
if (entry.name === ".git" || relativePath === ".maker-mcp" || relativePath.startsWith(".maker-mcp/") || entry.name === ".DS_Store") {
|
|
30325
30594
|
continue;
|
|
30326
30595
|
}
|
|
30327
|
-
const fullPath =
|
|
30596
|
+
const fullPath = path6.join(dir, entry.name);
|
|
30328
30597
|
if (entry.isDirectory()) {
|
|
30329
30598
|
visit(fullPath, relativePath);
|
|
30330
30599
|
continue;
|
|
@@ -30338,10 +30607,10 @@ function listLocalFiles(root) {
|
|
|
30338
30607
|
return files;
|
|
30339
30608
|
}
|
|
30340
30609
|
function listPreCloneNoticeFiles(root) {
|
|
30341
|
-
if (!
|
|
30610
|
+
if (!fs5.existsSync(root)) {
|
|
30342
30611
|
return [];
|
|
30343
30612
|
}
|
|
30344
|
-
return
|
|
30613
|
+
return fs5.readdirSync(root, { withFileTypes: true }).filter((entry) => !isIgnorablePreCloneEntry(entry.name)).map((entry) => entry.name).sort();
|
|
30345
30614
|
}
|
|
30346
30615
|
function createPreCloneWarnings(target) {
|
|
30347
30616
|
const preCloneLocalFiles = listPreCloneNoticeFiles(target);
|
|
@@ -30464,7 +30733,7 @@ function ensureOwnGitRoot(repoDir) {
|
|
|
30464
30733
|
);
|
|
30465
30734
|
}
|
|
30466
30735
|
function inspectMakerDirectoryGitStatus(cwd) {
|
|
30467
|
-
const targetDir =
|
|
30736
|
+
const targetDir = path6.resolve(cwd);
|
|
30468
30737
|
const gitRoot = resolveGitRoot(targetDir);
|
|
30469
30738
|
const gitDir = resolveGitDir(targetDir);
|
|
30470
30739
|
const makerBinding = findMakerProjectBinding(targetDir);
|
|
@@ -30537,16 +30806,16 @@ function formatMakerGitRootMismatch(status) {
|
|
|
30537
30806
|
}
|
|
30538
30807
|
function findMakerProjectBinding(startDir) {
|
|
30539
30808
|
var _a3;
|
|
30540
|
-
let current =
|
|
30809
|
+
let current = path6.resolve(startDir);
|
|
30541
30810
|
while (current.length > 0) {
|
|
30542
30811
|
const configPath = getProjectConfigPath(current);
|
|
30543
|
-
if (
|
|
30812
|
+
if (fs5.existsSync(configPath) && ((_a3 = loadProjectConfig(current)) == null ? void 0 : _a3.project_id)) {
|
|
30544
30813
|
return {
|
|
30545
30814
|
projectRoot: current,
|
|
30546
30815
|
configPath
|
|
30547
30816
|
};
|
|
30548
30817
|
}
|
|
30549
|
-
const parent =
|
|
30818
|
+
const parent = path6.dirname(current);
|
|
30550
30819
|
if (parent === current) {
|
|
30551
30820
|
return null;
|
|
30552
30821
|
}
|
|
@@ -30556,7 +30825,7 @@ function findMakerProjectBinding(startDir) {
|
|
|
30556
30825
|
}
|
|
30557
30826
|
function resolveGitRoot(cwd) {
|
|
30558
30827
|
try {
|
|
30559
|
-
return
|
|
30828
|
+
return path6.resolve(readGitSync(["-C", cwd, "rev-parse", "--show-toplevel"]).trim());
|
|
30560
30829
|
} catch {
|
|
30561
30830
|
return void 0;
|
|
30562
30831
|
}
|
|
@@ -30564,7 +30833,7 @@ function resolveGitRoot(cwd) {
|
|
|
30564
30833
|
function resolveGitDir(cwd) {
|
|
30565
30834
|
try {
|
|
30566
30835
|
const gitDir = readGitSync(["-C", cwd, "rev-parse", "--git-dir"]).trim();
|
|
30567
|
-
return
|
|
30836
|
+
return path6.isAbsolute(gitDir) ? path6.resolve(gitDir) : path6.resolve(cwd, gitDir);
|
|
30568
30837
|
} catch {
|
|
30569
30838
|
return void 0;
|
|
30570
30839
|
}
|
|
@@ -30573,9 +30842,9 @@ function samePath(left, right) {
|
|
|
30573
30842
|
return normalizePathForCompare(left) === normalizePathForCompare(right);
|
|
30574
30843
|
}
|
|
30575
30844
|
function normalizePathForCompare(value) {
|
|
30576
|
-
const resolved =
|
|
30845
|
+
const resolved = path6.resolve(value);
|
|
30577
30846
|
try {
|
|
30578
|
-
return
|
|
30847
|
+
return fs5.realpathSync.native(resolved);
|
|
30579
30848
|
} catch {
|
|
30580
30849
|
return resolved;
|
|
30581
30850
|
}
|
|
@@ -30904,18 +31173,24 @@ function normalizeTapAuthResponse(data) {
|
|
|
30904
31173
|
raw: data
|
|
30905
31174
|
};
|
|
30906
31175
|
}
|
|
30907
|
-
function getMakerTapTokenUrl() {
|
|
30908
|
-
const tapTokenUrl = getMakerEndpoints().tapTokenUrl;
|
|
30909
|
-
return requireMakerEndpoint("tapTokenUrl", tapTokenUrl);
|
|
31176
|
+
function getMakerTapTokenUrl(environment) {
|
|
31177
|
+
const tapTokenUrl = getMakerEndpoints(environment).tapTokenUrl;
|
|
31178
|
+
return requireMakerEndpoint("tapTokenUrl", tapTokenUrl, environment);
|
|
30910
31179
|
}
|
|
30911
|
-
async function requestTapAuthWithPat(manualPat) {
|
|
31180
|
+
async function requestTapAuthWithPat(manualPat, environment, options = {}) {
|
|
30912
31181
|
const pat = requireMakerPat(manualPat);
|
|
30913
|
-
const response = await
|
|
30914
|
-
|
|
30915
|
-
|
|
30916
|
-
|
|
30917
|
-
|
|
30918
|
-
|
|
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
|
+
);
|
|
30919
31194
|
const text = await response.text();
|
|
30920
31195
|
let json2 = {};
|
|
30921
31196
|
if (text) {
|
|
@@ -30934,8 +31209,8 @@ async function requestTapAuthWithPat(manualPat) {
|
|
|
30934
31209
|
}
|
|
30935
31210
|
|
|
30936
31211
|
// src/maker/cli/skill.ts
|
|
30937
|
-
import
|
|
30938
|
-
import
|
|
31212
|
+
import fs6 from "node:fs";
|
|
31213
|
+
import path7 from "node:path";
|
|
30939
31214
|
import { fileURLToPath } from "node:url";
|
|
30940
31215
|
var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
|
|
30941
31216
|
var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
|
|
@@ -30954,7 +31229,7 @@ var BUNDLED_SKILLS = [
|
|
|
30954
31229
|
function formatMakerSkillStatus(_options = {}) {
|
|
30955
31230
|
const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
|
|
30956
31231
|
name: skill.name,
|
|
30957
|
-
path:
|
|
31232
|
+
path: path7.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
|
|
30958
31233
|
}));
|
|
30959
31234
|
return [
|
|
30960
31235
|
"TapTap Maker workflow guide documents",
|
|
@@ -30987,11 +31262,11 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
30987
31262
|
}
|
|
30988
31263
|
function resolveMakerSkillSourceDir(skillName = MAKER_LOCAL_SKILL_NAME) {
|
|
30989
31264
|
const candidates = [
|
|
30990
|
-
|
|
31265
|
+
path7.join(process.cwd(), "skills", skillName),
|
|
30991
31266
|
getBundledSkillSourceDir(skillName)
|
|
30992
31267
|
].filter(Boolean);
|
|
30993
31268
|
for (const candidate of candidates) {
|
|
30994
|
-
if (
|
|
31269
|
+
if (fs6.existsSync(path7.join(candidate, "SKILL.md"))) {
|
|
30995
31270
|
return candidate;
|
|
30996
31271
|
}
|
|
30997
31272
|
}
|
|
@@ -31004,13 +31279,13 @@ function getBundledSkillSourceDir(skillName) {
|
|
|
31004
31279
|
return null;
|
|
31005
31280
|
}
|
|
31006
31281
|
const bundlePath = fileURLToPath(__MAKER_BUNDLE_URL__);
|
|
31007
|
-
const packageRoot =
|
|
31008
|
-
return
|
|
31282
|
+
const packageRoot = path7.dirname(path7.dirname(bundlePath));
|
|
31283
|
+
return path7.join(packageRoot, "skills", skillName);
|
|
31009
31284
|
}
|
|
31010
31285
|
|
|
31011
31286
|
// src/maker/server/runtimeLogs.ts
|
|
31012
|
-
import
|
|
31013
|
-
import
|
|
31287
|
+
import fs7 from "node:fs";
|
|
31288
|
+
import path8 from "node:path";
|
|
31014
31289
|
var DEFAULT_RUNTIME_LOG_SINCE_SECONDS = 600;
|
|
31015
31290
|
var DEFAULT_RUNTIME_LOG_IDLE_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
31016
31291
|
var MAX_RUNTIME_LOG_WINDOW_SECONDS = 3600;
|
|
@@ -31151,19 +31426,19 @@ async function pullRuntimeLogs(options) {
|
|
|
31151
31426
|
}
|
|
31152
31427
|
function resetRuntimeLogs(projectRoot) {
|
|
31153
31428
|
const runtimeDir = getRuntimeLogDir(projectRoot);
|
|
31154
|
-
|
|
31429
|
+
fs7.mkdirSync(runtimeDir, { recursive: true });
|
|
31155
31430
|
for (const file2 of RUNTIME_LOG_FILES_TO_RESET) {
|
|
31156
|
-
|
|
31431
|
+
fs7.rmSync(path8.join(runtimeDir, file2), { force: true });
|
|
31157
31432
|
}
|
|
31158
31433
|
return runtimeDir;
|
|
31159
31434
|
}
|
|
31160
31435
|
function readRuntimeLogState(projectRoot) {
|
|
31161
31436
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31162
|
-
if (!
|
|
31437
|
+
if (!fs7.existsSync(statePath)) {
|
|
31163
31438
|
return null;
|
|
31164
31439
|
}
|
|
31165
31440
|
try {
|
|
31166
|
-
const state = JSON.parse(
|
|
31441
|
+
const state = JSON.parse(fs7.readFileSync(statePath, "utf8"));
|
|
31167
31442
|
return isRuntimeLogState(state) ? state : null;
|
|
31168
31443
|
} catch {
|
|
31169
31444
|
return null;
|
|
@@ -31191,9 +31466,9 @@ function normalizeRuntimeLogQueryResult(result) {
|
|
|
31191
31466
|
};
|
|
31192
31467
|
}
|
|
31193
31468
|
function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
31194
|
-
const rawPath =
|
|
31195
|
-
|
|
31196
|
-
|
|
31469
|
+
const rawPath = path8.join(getRuntimeLogDir(projectRoot), "last-query-runtime-logs-result.json");
|
|
31470
|
+
fs7.mkdirSync(path8.dirname(rawPath), { recursive: true });
|
|
31471
|
+
fs7.writeFileSync(
|
|
31197
31472
|
rawPath,
|
|
31198
31473
|
`${JSON.stringify({ capturedAt: (/* @__PURE__ */ new Date()).toISOString(), raw }, null, 2)}
|
|
31199
31474
|
`,
|
|
@@ -31202,7 +31477,7 @@ function writeRuntimeLogRawResponse(projectRoot, raw) {
|
|
|
31202
31477
|
return rawPath;
|
|
31203
31478
|
}
|
|
31204
31479
|
function appendRuntimeLogs(projectRoot, logs) {
|
|
31205
|
-
|
|
31480
|
+
fs7.mkdirSync(getRuntimeLogDir(projectRoot), { recursive: true });
|
|
31206
31481
|
if (logs.length === 0) {
|
|
31207
31482
|
return { files: [], written: 0 };
|
|
31208
31483
|
}
|
|
@@ -31210,7 +31485,7 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31210
31485
|
let written = 0;
|
|
31211
31486
|
for (const log of logs) {
|
|
31212
31487
|
const line = JSON.stringify(compactRuntimeLogEntry(log));
|
|
31213
|
-
|
|
31488
|
+
fs7.appendFileSync(filePath, `${line}
|
|
31214
31489
|
`, "utf8");
|
|
31215
31490
|
written += 1;
|
|
31216
31491
|
}
|
|
@@ -31218,11 +31493,11 @@ function appendRuntimeLogs(projectRoot, logs) {
|
|
|
31218
31493
|
}
|
|
31219
31494
|
function writeRuntimeLogState(projectRoot, state) {
|
|
31220
31495
|
const statePath = getRuntimeLogStatePath(projectRoot);
|
|
31221
|
-
|
|
31496
|
+
fs7.mkdirSync(path8.dirname(statePath), { recursive: true });
|
|
31222
31497
|
const tempPath = `${statePath}.${process.pid}.${Date.now()}.tmp`;
|
|
31223
|
-
|
|
31498
|
+
fs7.writeFileSync(tempPath, `${JSON.stringify(state, null, 2)}
|
|
31224
31499
|
`, "utf8");
|
|
31225
|
-
|
|
31500
|
+
fs7.renameSync(tempPath, statePath);
|
|
31226
31501
|
}
|
|
31227
31502
|
function writeRuntimeLogFailureState(projectRoot, options) {
|
|
31228
31503
|
const nowIso = new Date(options.nowMs()).toISOString();
|
|
@@ -31254,13 +31529,13 @@ function isNonRetryableRuntimeLogError(error2) {
|
|
|
31254
31529
|
);
|
|
31255
31530
|
}
|
|
31256
31531
|
function getRuntimeLogDir(projectRoot) {
|
|
31257
|
-
return
|
|
31532
|
+
return path8.join(projectRoot, ".maker", "logs", "runtime");
|
|
31258
31533
|
}
|
|
31259
31534
|
function getRuntimeLogStatePath(projectRoot) {
|
|
31260
|
-
return
|
|
31535
|
+
return path8.join(getRuntimeLogDir(projectRoot), "state.json");
|
|
31261
31536
|
}
|
|
31262
31537
|
function getRuntimeLogPath(projectRoot) {
|
|
31263
|
-
return
|
|
31538
|
+
return path8.join(getRuntimeLogDir(projectRoot), MERGED_RUNTIME_LOG_FILE);
|
|
31264
31539
|
}
|
|
31265
31540
|
function resolveNextRuntimeLogCursor(result) {
|
|
31266
31541
|
const maxLogTime = result.logs.reduce((max, log) => {
|
|
@@ -31385,8 +31660,8 @@ function compactRuntimeLogEntry(entry) {
|
|
|
31385
31660
|
}
|
|
31386
31661
|
|
|
31387
31662
|
// src/maker/server/proxyAssets.ts
|
|
31388
|
-
import
|
|
31389
|
-
import
|
|
31663
|
+
import fs8 from "node:fs";
|
|
31664
|
+
import path9 from "node:path";
|
|
31390
31665
|
var IMAGE_ASSET_DIRS = ["assets/image"];
|
|
31391
31666
|
var VIDEO_ASSET_DIRS = ["assets/video"];
|
|
31392
31667
|
var AUDIO_ASSET_DIRS = ["assets/audio"];
|
|
@@ -31630,8 +31905,8 @@ async function materializeAsset(options) {
|
|
|
31630
31905
|
};
|
|
31631
31906
|
}
|
|
31632
31907
|
const bytes = Buffer.from(await response.arrayBuffer());
|
|
31633
|
-
|
|
31634
|
-
|
|
31908
|
+
fs8.mkdirSync(path9.dirname(absolutePath), { recursive: true });
|
|
31909
|
+
fs8.writeFileSync(absolutePath, bytes);
|
|
31635
31910
|
return { localPath: relativePath, absolutePath, download: { success: true } };
|
|
31636
31911
|
} catch (error2) {
|
|
31637
31912
|
return {
|
|
@@ -31645,12 +31920,12 @@ async function materializeAsset(options) {
|
|
|
31645
31920
|
function createUniqueAssetPath(options) {
|
|
31646
31921
|
const stem = `${sanitizeAssetBaseName(options.baseName)}_${formatAssetTimestamp(options.now)}`;
|
|
31647
31922
|
for (let index = 1; index <= 9999; index += 1) {
|
|
31648
|
-
const relativePath =
|
|
31923
|
+
const relativePath = path9.posix.join(
|
|
31649
31924
|
options.relativeDir,
|
|
31650
31925
|
`${stem}${index === 1 ? "" : `_${index}`}.${options.extension}`
|
|
31651
31926
|
);
|
|
31652
|
-
const absolutePath =
|
|
31653
|
-
if (!
|
|
31927
|
+
const absolutePath = path9.join(options.targetDir, ...relativePath.split("/"));
|
|
31928
|
+
if (!fs8.existsSync(absolutePath)) {
|
|
31654
31929
|
return { relativePath, absolutePath };
|
|
31655
31930
|
}
|
|
31656
31931
|
}
|
|
@@ -31733,7 +32008,7 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
31733
32008
|
if (!isKnownAssetPath(localPath, assetDirs)) {
|
|
31734
32009
|
return false;
|
|
31735
32010
|
}
|
|
31736
|
-
const basename =
|
|
32011
|
+
const basename = path9.posix.basename(localPath);
|
|
31737
32012
|
const stem = basename.replace(/\.[^.]+$/, "");
|
|
31738
32013
|
return basename === value || stem === value || record2.name === value || record2.taskId === value;
|
|
31739
32014
|
});
|
|
@@ -31746,13 +32021,13 @@ function findRegistryAssetByName(value, registry2, assetDirs) {
|
|
|
31746
32021
|
}
|
|
31747
32022
|
function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
31748
32023
|
var _a3;
|
|
31749
|
-
const hasExtension = Boolean(
|
|
32024
|
+
const hasExtension = Boolean(path9.extname(value));
|
|
31750
32025
|
const candidates = [];
|
|
31751
32026
|
for (const assetDir of assetDirs) {
|
|
31752
|
-
const absoluteDir =
|
|
32027
|
+
const absoluteDir = path9.join(targetDir, ...assetDir.split("/"));
|
|
31753
32028
|
let entries;
|
|
31754
32029
|
try {
|
|
31755
|
-
entries =
|
|
32030
|
+
entries = fs8.readdirSync(absoluteDir);
|
|
31756
32031
|
} catch {
|
|
31757
32032
|
continue;
|
|
31758
32033
|
}
|
|
@@ -31761,11 +32036,11 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
31761
32036
|
if (hasExtension ? entry !== value : stem !== value && !stem.startsWith(`${value}_`)) {
|
|
31762
32037
|
continue;
|
|
31763
32038
|
}
|
|
31764
|
-
const absolutePath =
|
|
32039
|
+
const absolutePath = path9.join(absoluteDir, entry);
|
|
31765
32040
|
try {
|
|
31766
32041
|
candidates.push({
|
|
31767
|
-
localPath:
|
|
31768
|
-
mtimeMs:
|
|
32042
|
+
localPath: path9.posix.join(assetDir, entry),
|
|
32043
|
+
mtimeMs: fs8.statSync(absolutePath).mtimeMs
|
|
31769
32044
|
});
|
|
31770
32045
|
} catch {
|
|
31771
32046
|
}
|
|
@@ -31775,7 +32050,7 @@ function findLocalAssetByName(targetDir, value, assetDirs) {
|
|
|
31775
32050
|
return (_a3 = candidates[0]) == null ? void 0 : _a3.localPath;
|
|
31776
32051
|
}
|
|
31777
32052
|
function isKnownAssetPath(relativePath, assetDirs) {
|
|
31778
|
-
if (relativePath.startsWith("../") ||
|
|
32053
|
+
if (relativePath.startsWith("../") || path9.isAbsolute(relativePath)) {
|
|
31779
32054
|
return false;
|
|
31780
32055
|
}
|
|
31781
32056
|
return assetDirs.some(
|
|
@@ -31789,31 +32064,31 @@ function upsertGeneratedAssetRecord(targetDir, localPath, record2) {
|
|
|
31789
32064
|
const registry2 = readGeneratedAssetRegistry(targetDir);
|
|
31790
32065
|
registry2[localPath] = record2;
|
|
31791
32066
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
31792
|
-
|
|
31793
|
-
|
|
32067
|
+
fs8.mkdirSync(path9.dirname(registryPath), { recursive: true });
|
|
32068
|
+
fs8.writeFileSync(registryPath, `${JSON.stringify(registry2, null, 2)}
|
|
31794
32069
|
`, "utf8");
|
|
31795
32070
|
}
|
|
31796
32071
|
function readGeneratedAssetRegistry(targetDir) {
|
|
31797
32072
|
const registryPath = getGeneratedAssetRegistryPath(targetDir);
|
|
31798
|
-
if (!
|
|
32073
|
+
if (!fs8.existsSync(registryPath)) {
|
|
31799
32074
|
return {};
|
|
31800
32075
|
}
|
|
31801
32076
|
try {
|
|
31802
|
-
const parsed = JSON.parse(
|
|
32077
|
+
const parsed = JSON.parse(fs8.readFileSync(registryPath, "utf8"));
|
|
31803
32078
|
return isRecord(parsed) ? parsed : {};
|
|
31804
32079
|
} catch {
|
|
31805
32080
|
return {};
|
|
31806
32081
|
}
|
|
31807
32082
|
}
|
|
31808
32083
|
function getGeneratedAssetRegistryPath(targetDir) {
|
|
31809
|
-
return
|
|
32084
|
+
return path9.join(targetDir, ".maker", "assets", "generated-assets.json");
|
|
31810
32085
|
}
|
|
31811
32086
|
function normalizeAssetRegistryKey(targetDir, value) {
|
|
31812
32087
|
if (/^https?:\/\//i.test(value) || value.startsWith("data:")) {
|
|
31813
32088
|
return void 0;
|
|
31814
32089
|
}
|
|
31815
|
-
const relative =
|
|
31816
|
-
return relative.split(
|
|
32090
|
+
const relative = path9.isAbsolute(value) ? path9.relative(targetDir, value) : value;
|
|
32091
|
+
return relative.split(path9.sep).join("/");
|
|
31817
32092
|
}
|
|
31818
32093
|
function isRecord(value) {
|
|
31819
32094
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -31842,7 +32117,7 @@ function extensionFromUrl(url2) {
|
|
|
31842
32117
|
}
|
|
31843
32118
|
try {
|
|
31844
32119
|
const pathname = new URL(url2).pathname;
|
|
31845
|
-
const extension =
|
|
32120
|
+
const extension = path9.extname(pathname).replace(/^\./, "").toLowerCase();
|
|
31846
32121
|
return extension || void 0;
|
|
31847
32122
|
} catch {
|
|
31848
32123
|
return void 0;
|
|
@@ -31850,7 +32125,7 @@ function extensionFromUrl(url2) {
|
|
|
31850
32125
|
}
|
|
31851
32126
|
|
|
31852
32127
|
// src/maker/server/mcp.ts
|
|
31853
|
-
var VERSION = true ? "0.0.
|
|
32128
|
+
var VERSION = true ? "0.0.12" : "dev";
|
|
31854
32129
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
31855
32130
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
31856
32131
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -32205,16 +32480,16 @@ async function startMakerMcpServer() {
|
|
|
32205
32480
|
async function formatStatus(options = {}) {
|
|
32206
32481
|
var _a3;
|
|
32207
32482
|
const targetDir = resolveMakerToolTargetDir(options.targetDir);
|
|
32483
|
+
const env = getMakerEnvironment(void 0, targetDir);
|
|
32208
32484
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
32209
32485
|
const gitDirectoryStatus = inspectMakerDirectoryGitStatus(targetDir);
|
|
32210
32486
|
const remoteSyncText = identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo && !options.skipRemoteSync ? await formatMakerRemoteSyncStatusSafely(identify.projectRoot) : identify.projectRoot && gitDirectoryStatus.isUsableMakerGitRepo ? formatMakerRemoteSyncSkipped() : "";
|
|
32211
32487
|
const pat = loadPat();
|
|
32212
32488
|
let tapAuth = loadTapAuth();
|
|
32213
|
-
const makerPatTokensUrl = getMakerPatTokensUrl();
|
|
32214
32489
|
let tapAuthRefreshText = "";
|
|
32215
32490
|
if (pat && !tapAuth) {
|
|
32216
32491
|
try {
|
|
32217
|
-
tapAuth = await requestTapAuthWithPat(pat.token);
|
|
32492
|
+
tapAuth = await requestTapAuthWithPat(pat.token, env);
|
|
32218
32493
|
tapAuthRefreshText = [
|
|
32219
32494
|
"TapTap token",
|
|
32220
32495
|
"",
|
|
@@ -32239,6 +32514,7 @@ async function formatStatus(options = {}) {
|
|
|
32239
32514
|
"TapTap Maker MCP status",
|
|
32240
32515
|
"",
|
|
32241
32516
|
`- version: ${VERSION}`,
|
|
32517
|
+
`- env: ${env}`,
|
|
32242
32518
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
32243
32519
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
32244
32520
|
`- target_dir: ${targetDir}`,
|
|
@@ -32257,17 +32533,38 @@ async function formatStatus(options = {}) {
|
|
|
32257
32533
|
"",
|
|
32258
32534
|
identify.projectRoot ? await formatMakerProxyToolsStatusSafely({ targetDir: identify.projectRoot }) : "",
|
|
32259
32535
|
"",
|
|
32260
|
-
|
|
32536
|
+
formatAuthNextStep({ hasPat: Boolean(pat), isProjectBound: Boolean(identify.projectRoot) }),
|
|
32261
32537
|
"",
|
|
32262
32538
|
tapAuthRefreshText,
|
|
32263
32539
|
"",
|
|
32264
|
-
identify.projectRoot ? await formatAiDevKitStatus(identify.projectRoot
|
|
32540
|
+
identify.projectRoot ? await formatAiDevKitStatus(identify.projectRoot, {
|
|
32541
|
+
environment: env,
|
|
32542
|
+
skipVersionCheck: options.skipRemoteSync
|
|
32543
|
+
}) : "",
|
|
32265
32544
|
"",
|
|
32266
32545
|
formatMakerSkillStatus({ projectRoot: identify.projectRoot || targetDir }),
|
|
32267
32546
|
"",
|
|
32268
32547
|
projectSection
|
|
32269
32548
|
].filter(Boolean).join("\n");
|
|
32270
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
|
+
}
|
|
32271
32568
|
function formatMakerRemoteSyncSkipped() {
|
|
32272
32569
|
return [
|
|
32273
32570
|
"Maker remote sync",
|
|
@@ -32433,22 +32730,31 @@ function formatAiDialogueDirectoryHint(targetDir) {
|
|
|
32433
32730
|
}
|
|
32434
32731
|
function resolveMakerToolTargetDir(targetDir) {
|
|
32435
32732
|
if (targetDir) {
|
|
32436
|
-
return
|
|
32733
|
+
return path10.resolve(targetDir);
|
|
32437
32734
|
}
|
|
32438
32735
|
return process.cwd();
|
|
32439
32736
|
}
|
|
32440
|
-
async function formatAiDevKitStatus(projectRoot) {
|
|
32737
|
+
async function formatAiDevKitStatus(projectRoot, options = {}) {
|
|
32441
32738
|
const devKitStatus = inspectAiDevKit(projectRoot);
|
|
32739
|
+
const updateStatus = options.skipVersionCheck ? void 0 : await checkAiDevKitUpdate(projectRoot, { environment: options.environment });
|
|
32442
32740
|
if (devKitStatus.ready) {
|
|
32443
|
-
return formatAiDevKitStatusLines("ready", devKitStatus).join("\n");
|
|
32741
|
+
return formatAiDevKitStatusLines("ready", devKitStatus, updateStatus).join("\n");
|
|
32444
32742
|
}
|
|
32445
32743
|
return [
|
|
32446
|
-
...formatAiDevKitStatusLines("missing", devKitStatus),
|
|
32744
|
+
...formatAiDevKitStatusLines("missing", devKitStatus, updateStatus),
|
|
32447
32745
|
"- next_step: 请运行 taptap-maker dev-kit update,或重新执行 taptap-maker init。"
|
|
32448
32746
|
].join("\n");
|
|
32449
32747
|
}
|
|
32450
|
-
function formatAiDevKitStatusLines(status, devKitStatus) {
|
|
32748
|
+
function formatAiDevKitStatusLines(status, devKitStatus, updateStatus) {
|
|
32749
|
+
var _a3, _b;
|
|
32451
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"];
|
|
32452
32758
|
return [
|
|
32453
32759
|
"AI dev kit",
|
|
32454
32760
|
"",
|
|
@@ -32456,6 +32762,7 @@ function formatAiDevKitStatusLines(status, devKitStatus) {
|
|
|
32456
32762
|
`- required_entries: ${devKitStatus.requiredEntries.join(", ")}`,
|
|
32457
32763
|
`- present_entries: ${devKitStatus.presentEntries.join(", ") || "(none)"}`,
|
|
32458
32764
|
`- missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
32765
|
+
...versionLines,
|
|
32459
32766
|
`- skill_install_status: ${skillStatus.status}`,
|
|
32460
32767
|
`- skill_install_summary: ${skillStatus.summary}`
|
|
32461
32768
|
];
|
|
@@ -32474,7 +32781,7 @@ async function formatAutoProjectListFromPat() {
|
|
|
32474
32781
|
return [
|
|
32475
32782
|
"本地已有 Maker PAT,但自动列出 Maker Apps 失败。",
|
|
32476
32783
|
`原因:${error2 instanceof Error ? error2.message : String(error2)}`,
|
|
32477
|
-
|
|
32784
|
+
"如果本地鉴权已失效,请运行 `taptap-maker login` 重新完成 Maker 登录授权。"
|
|
32478
32785
|
].join("\n");
|
|
32479
32786
|
}
|
|
32480
32787
|
}
|
|
@@ -32523,14 +32830,14 @@ function formatStatusProjectList(projects) {
|
|
|
32523
32830
|
].filter((line) => line !== void 0).join("\n");
|
|
32524
32831
|
}
|
|
32525
32832
|
function formatClonePartialStateLines(targetDir) {
|
|
32526
|
-
const resolvedTargetDir =
|
|
32833
|
+
const resolvedTargetDir = path10.resolve(targetDir);
|
|
32527
32834
|
const identify = identifyMakerProject({ cwd: resolvedTargetDir });
|
|
32528
32835
|
const gitStatus = inspectMakerDirectoryGitStatus(resolvedTargetDir);
|
|
32529
32836
|
const devKitStatus = inspectAiDevKit(resolvedTargetDir);
|
|
32530
|
-
const stagedDevKitGitignorePath =
|
|
32837
|
+
const stagedDevKitGitignorePath = path10.join(resolvedTargetDir, DEV_KIT_GITIGNORE_STAGING_FILE);
|
|
32531
32838
|
const projectBound = Boolean(identify.projectId);
|
|
32532
32839
|
const gitInitialized = Boolean(
|
|
32533
|
-
gitStatus.isOwnGitRoot ||
|
|
32840
|
+
gitStatus.isOwnGitRoot || fs9.existsSync(path10.join(resolvedTargetDir, ".git"))
|
|
32534
32841
|
);
|
|
32535
32842
|
const safeToRetry = !projectBound;
|
|
32536
32843
|
return [
|
|
@@ -32544,7 +32851,7 @@ function formatClonePartialStateLines(targetDir) {
|
|
|
32544
32851
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
32545
32852
|
`- ai_dev_kit_present: ${devKitStatus.ready ? "yes" : "no"}`,
|
|
32546
32853
|
`- ai_dev_kit_missing_entries: ${devKitStatus.missingEntries.join(", ") || "(none)"}`,
|
|
32547
|
-
`- staged_dev_kit_gitignore: ${
|
|
32854
|
+
`- staged_dev_kit_gitignore: ${fs9.existsSync(stagedDevKitGitignorePath) ? "yes" : "no"}`,
|
|
32548
32855
|
`- safe_to_retry: ${safeToRetry ? "yes" : "no"}`,
|
|
32549
32856
|
safeToRetry ? "- next_step: 可以直接重试 taptap-maker init;如果连续失败,建议换一个全新的独立目录重新 clone。" : "- next_step: 当前目录已经有 Maker 绑定信息;先运行 taptap-maker doctor 或读取 maker://status 确认状态。"
|
|
32550
32857
|
].filter(Boolean);
|
|
@@ -32558,9 +32865,10 @@ function createRemoteProxyContext(options) {
|
|
|
32558
32865
|
}
|
|
32559
32866
|
const projectConfig = loadProjectConfig(identify.projectRoot);
|
|
32560
32867
|
const projectId = (projectConfig == null ? void 0 : projectConfig.project_id) || identify.projectId;
|
|
32868
|
+
const env = getMakerEnvironment(options.env, identify.projectRoot);
|
|
32561
32869
|
const tapAuth = loadTapAuth();
|
|
32562
32870
|
if (!tapAuth) {
|
|
32563
|
-
throw new Error("Tap auth not found. Run taptap-maker
|
|
32871
|
+
throw new Error("Tap auth not found. Run `taptap-maker login` first.");
|
|
32564
32872
|
}
|
|
32565
32873
|
let userId = projectConfig == null ? void 0 : projectConfig.user_id;
|
|
32566
32874
|
if (!userId) {
|
|
@@ -32572,7 +32880,6 @@ function createRemoteProxyContext(options) {
|
|
|
32572
32880
|
"Cannot resolve user_id. Re-run taptap-maker init with PAT so the project config can cache user_id."
|
|
32573
32881
|
);
|
|
32574
32882
|
}
|
|
32575
|
-
const env = getMakerEnvironment(options.env);
|
|
32576
32883
|
const serverUrl = options.serverUrl || requireMakerEndpoint("remoteMcpServerUrl", getMakerEndpoints(env).remoteMcpServerUrl, env);
|
|
32577
32884
|
const projectPath = `${projectId}/workspace`;
|
|
32578
32885
|
const proxyCfg = {
|
|
@@ -32617,7 +32924,7 @@ function resolveEmbeddedProxyCommand(options) {
|
|
|
32617
32924
|
}
|
|
32618
32925
|
return {
|
|
32619
32926
|
command: process.execPath,
|
|
32620
|
-
args: [
|
|
32927
|
+
args: [path10.resolve(makerEntry), "__maker-proxy"]
|
|
32621
32928
|
};
|
|
32622
32929
|
}
|
|
32623
32930
|
function createToolProgressReporter(progressToken, extra, operationName) {
|
|
@@ -32919,18 +33226,18 @@ async function attachRuntimeLogWatch(buildResult, startWatch) {
|
|
|
32919
33226
|
}
|
|
32920
33227
|
}
|
|
32921
33228
|
async function startRuntimeLogWatch(buildResult) {
|
|
32922
|
-
const runtimeDir =
|
|
32923
|
-
|
|
32924
|
-
const stdoutLog =
|
|
32925
|
-
const stderrLog =
|
|
32926
|
-
const pidFile =
|
|
33229
|
+
const runtimeDir = path10.join(buildResult.projectRoot, ".maker", "logs", "runtime");
|
|
33230
|
+
fs9.mkdirSync(runtimeDir, { recursive: true });
|
|
33231
|
+
const stdoutLog = path10.join(runtimeDir, "watcher.out.log");
|
|
33232
|
+
const stderrLog = path10.join(runtimeDir, "watcher.err.log");
|
|
33233
|
+
const pidFile = path10.join(runtimeDir, "watcher.pid");
|
|
32927
33234
|
const previous = stopExistingRuntimeLogWatcher(pidFile);
|
|
32928
|
-
const outFd =
|
|
32929
|
-
const errFd =
|
|
33235
|
+
const outFd = fs9.openSync(stdoutLog, "a");
|
|
33236
|
+
const errFd = fs9.openSync(stderrLog, "a");
|
|
32930
33237
|
const command = formatRuntimeLogWatchCommand(buildResult);
|
|
32931
33238
|
if (previous.previousStopError) {
|
|
32932
|
-
|
|
32933
|
-
|
|
33239
|
+
fs9.closeSync(outFd);
|
|
33240
|
+
fs9.closeSync(errFd);
|
|
32934
33241
|
return {
|
|
32935
33242
|
started: false,
|
|
32936
33243
|
command: command.text,
|
|
@@ -32993,18 +33300,18 @@ async function startRuntimeLogWatch(buildResult) {
|
|
|
32993
33300
|
...previous
|
|
32994
33301
|
};
|
|
32995
33302
|
} finally {
|
|
32996
|
-
|
|
32997
|
-
|
|
33303
|
+
fs9.closeSync(outFd);
|
|
33304
|
+
fs9.closeSync(errFd);
|
|
32998
33305
|
}
|
|
32999
33306
|
}
|
|
33000
33307
|
function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
33001
|
-
if (!
|
|
33308
|
+
if (!fs9.existsSync(pidFile)) {
|
|
33002
33309
|
return {};
|
|
33003
33310
|
}
|
|
33004
33311
|
const pidState = readRuntimeLogWatcherPidState(pidFile);
|
|
33005
33312
|
const pid = pidState == null ? void 0 : pidState.pid;
|
|
33006
33313
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
33007
|
-
|
|
33314
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33008
33315
|
return {};
|
|
33009
33316
|
}
|
|
33010
33317
|
try {
|
|
@@ -33012,7 +33319,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33012
33319
|
const processCommand = (options.getProcessCommand || getProcessCommand)(pid);
|
|
33013
33320
|
const verifiedCommand = getVerifiedRuntimeLogWatcherCommand(processCommand, pidState);
|
|
33014
33321
|
if (!verifiedCommand) {
|
|
33015
|
-
|
|
33322
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33016
33323
|
return {
|
|
33017
33324
|
previousPid: pid,
|
|
33018
33325
|
previousStopped: false,
|
|
@@ -33022,7 +33329,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33022
33329
|
process.kill(pid, "SIGTERM");
|
|
33023
33330
|
const stopped = (options.waitForExit || waitForProcessExit)(pid, WATCHER_STOP_TIMEOUT_MS);
|
|
33024
33331
|
if (stopped) {
|
|
33025
|
-
|
|
33332
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33026
33333
|
return { previousPid: pid, previousStopped: true };
|
|
33027
33334
|
}
|
|
33028
33335
|
return {
|
|
@@ -33031,7 +33338,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33031
33338
|
previousStopError: `process ${pid} did not exit after SIGTERM within ${WATCHER_STOP_TIMEOUT_MS}ms`
|
|
33032
33339
|
};
|
|
33033
33340
|
} catch (error2) {
|
|
33034
|
-
|
|
33341
|
+
fs9.rmSync(pidFile, { force: true });
|
|
33035
33342
|
const code = error2 && typeof error2 === "object" && "code" in error2 ? String(error2.code) : "";
|
|
33036
33343
|
if (code === "ESRCH") {
|
|
33037
33344
|
return { previousPid: pid, previousStopped: false };
|
|
@@ -33044,7 +33351,7 @@ function stopExistingRuntimeLogWatcher(pidFile, options = {}) {
|
|
|
33044
33351
|
}
|
|
33045
33352
|
}
|
|
33046
33353
|
function readRuntimeLogWatcherPidState(pidFile) {
|
|
33047
|
-
const raw =
|
|
33354
|
+
const raw = fs9.readFileSync(pidFile, "utf8").trim();
|
|
33048
33355
|
if (!raw) {
|
|
33049
33356
|
return null;
|
|
33050
33357
|
}
|
|
@@ -33060,7 +33367,7 @@ function readRuntimeLogWatcherPidState(pidFile) {
|
|
|
33060
33367
|
}
|
|
33061
33368
|
}
|
|
33062
33369
|
function writeRuntimeLogWatcherPidFile(pidFile, state) {
|
|
33063
|
-
|
|
33370
|
+
fs9.writeFileSync(pidFile, `${JSON.stringify(state, null, 2)}
|
|
33064
33371
|
`, "utf8");
|
|
33065
33372
|
}
|
|
33066
33373
|
function getProcessCommand(pid) {
|
|
@@ -33146,10 +33453,10 @@ function formatRuntimeLogWatchCommand(buildResult) {
|
|
|
33146
33453
|
};
|
|
33147
33454
|
}
|
|
33148
33455
|
function resolveMakerCliEntry() {
|
|
33149
|
-
return process.argv[1] ||
|
|
33456
|
+
return process.argv[1] || path10.resolve(process.cwd(), "dist", "maker.js");
|
|
33150
33457
|
}
|
|
33151
33458
|
function getRuntimeLogFilePath(projectRoot) {
|
|
33152
|
-
return
|
|
33459
|
+
return path10.join(projectRoot, ".maker", "logs", "runtime", "runtime.log");
|
|
33153
33460
|
}
|
|
33154
33461
|
async function refreshMakerPreview(buildResult) {
|
|
33155
33462
|
const makerEnv = buildResult.env === "rnd" || buildResult.env === "production" ? buildResult.env : void 0;
|
|
@@ -33163,7 +33470,7 @@ async function refreshMakerPreview(buildResult) {
|
|
|
33163
33470
|
ok: false,
|
|
33164
33471
|
status: 0,
|
|
33165
33472
|
url: url2,
|
|
33166
|
-
error: "Maker PAT not found. Run taptap-maker
|
|
33473
|
+
error: "Maker PAT not found. Run `taptap-maker login` first."
|
|
33167
33474
|
};
|
|
33168
33475
|
}
|
|
33169
33476
|
const controller = new AbortController();
|
|
@@ -33280,7 +33587,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
33280
33587
|
if (options.scriptsPath) {
|
|
33281
33588
|
buildArgs.scriptsPath = options.scriptsPath;
|
|
33282
33589
|
}
|
|
33283
|
-
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer &&
|
|
33590
|
+
if (!options.entry && !options.scriptsPath && !options.entryClient && !options.entryServer && !options.multiplayer && fs9.existsSync(path10.join(projectRoot, "scripts", "main.lua"))) {
|
|
33284
33591
|
buildArgs.entry = "main.lua";
|
|
33285
33592
|
buildArgs.scriptsPath = "scripts";
|
|
33286
33593
|
}
|
|
@@ -33292,7 +33599,7 @@ function createBuildArgs(projectRoot, options) {
|
|
|
33292
33599
|
}
|
|
33293
33600
|
if (options.multiplayer) {
|
|
33294
33601
|
buildArgs.multiplayer = options.multiplayer;
|
|
33295
|
-
} else if (!
|
|
33602
|
+
} else if (!fs9.existsSync(path10.join(projectRoot, ".project", "settings.json"))) {
|
|
33296
33603
|
buildArgs.multiplayer = { enabled: false };
|
|
33297
33604
|
}
|
|
33298
33605
|
return buildArgs;
|
|
@@ -33454,11 +33761,11 @@ function formatRuntimeLogWatchNextActionLines(result) {
|
|
|
33454
33761
|
((_a3 = result.runtimeLogWatch) == null ? void 0 : _a3.pid) ? `- watch_pid: ${result.runtimeLogWatch.pid}` : "",
|
|
33455
33762
|
`- watch_command: ${command}`,
|
|
33456
33763
|
((_b = result.runtimeLogWatch) == null ? void 0 : _b.command) ? `- actual_watch_command: ${result.runtimeLogWatch.command}` : "",
|
|
33457
|
-
`- local_file: ${
|
|
33764
|
+
`- local_file: ${path10.join(result.projectRoot, ".maker", "logs", "runtime", "runtime.log")}`,
|
|
33458
33765
|
((_c = result.runtimeLogWatch) == null ? void 0 : _c.stdoutLog) ? `- watcher_stdout: ${result.runtimeLogWatch.stdoutLog}` : "",
|
|
33459
33766
|
((_d = result.runtimeLogWatch) == null ? void 0 : _d.stderrLog) ? `- watcher_stderr: ${result.runtimeLogWatch.stderrLog}` : "",
|
|
33460
33767
|
((_e = result.runtimeLogWatch) == null ? void 0 : _e.pidFile) ? `- watcher_pid_file: ${result.runtimeLogWatch.pidFile}` : "",
|
|
33461
|
-
`- state_file: ${
|
|
33768
|
+
`- state_file: ${path10.join(result.projectRoot, ".maker", "logs", "runtime", "state.json")}`,
|
|
33462
33769
|
((_f = result.runtimeLogWatch) == null ? void 0 : _f.previousPid) ? `- previous_watch_pid: ${result.runtimeLogWatch.previousPid}` : "",
|
|
33463
33770
|
((_g = result.runtimeLogWatch) == null ? void 0 : _g.previousStopped) !== void 0 ? `- previous_watch_stopped: ${result.runtimeLogWatch.previousStopped ? "yes" : "no"}` : "",
|
|
33464
33771
|
((_h = result.runtimeLogWatch) == null ? void 0 : _h.previousStopError) ? `- previous_watch_stop_error: ${result.runtimeLogWatch.previousStopError}` : "",
|
|
@@ -33573,13 +33880,156 @@ function indent(value) {
|
|
|
33573
33880
|
}
|
|
33574
33881
|
|
|
33575
33882
|
// src/maker/cli/commands.ts
|
|
33576
|
-
import { spawnSync as
|
|
33577
|
-
import
|
|
33578
|
-
import
|
|
33883
|
+
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
33884
|
+
import crypto2 from "node:crypto";
|
|
33885
|
+
import fs10 from "node:fs";
|
|
33579
33886
|
import os4 from "node:os";
|
|
33580
|
-
import
|
|
33887
|
+
import path11 from "node:path";
|
|
33581
33888
|
import readline from "node:readline/promises";
|
|
33582
33889
|
import { stdin as input, stdout as output } from "node:process";
|
|
33890
|
+
|
|
33891
|
+
// src/maker/auth/cliLogin.ts
|
|
33892
|
+
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
33893
|
+
import crypto from "node:crypto";
|
|
33894
|
+
var DEFAULT_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
33895
|
+
var DEFAULT_POLL_INTERVAL_MS = 1e3;
|
|
33896
|
+
function createCliLoginCode() {
|
|
33897
|
+
return crypto.randomBytes(24).toString("base64url");
|
|
33898
|
+
}
|
|
33899
|
+
function getMakerCliLoginUrl(code, env) {
|
|
33900
|
+
const url2 = new URL("/pat-tokens", getMakerWebUrl(env));
|
|
33901
|
+
url2.searchParams.set("code", code);
|
|
33902
|
+
return url2.toString();
|
|
33903
|
+
}
|
|
33904
|
+
function getMakerCliLoginResultUrl(code, env) {
|
|
33905
|
+
const url2 = new URL("cli-auth/result", `${getMakerApiBaseUrl(env)}/`);
|
|
33906
|
+
url2.searchParams.set("code", code);
|
|
33907
|
+
return url2.toString();
|
|
33908
|
+
}
|
|
33909
|
+
async function loginWithCliAuthCode(options = {}) {
|
|
33910
|
+
var _a3;
|
|
33911
|
+
const env = options.env || getMakerEnvironment();
|
|
33912
|
+
const code = createCliLoginCode();
|
|
33913
|
+
const authUrl = getMakerCliLoginUrl(code, env);
|
|
33914
|
+
(_a3 = options.onStatus) == null ? void 0 : _a3.call(
|
|
33915
|
+
options,
|
|
33916
|
+
`Opening Maker PAT page: ${authUrl}
|
|
33917
|
+
请在页面登录并点击“创建 token”,CLI 会继续等待授权结果。`
|
|
33918
|
+
);
|
|
33919
|
+
if (options.openBrowser !== false) {
|
|
33920
|
+
openBrowser(authUrl);
|
|
33921
|
+
}
|
|
33922
|
+
const pat = await pollCliLoginResult(code, {
|
|
33923
|
+
...options,
|
|
33924
|
+
env
|
|
33925
|
+
});
|
|
33926
|
+
return {
|
|
33927
|
+
...pat,
|
|
33928
|
+
code,
|
|
33929
|
+
auth_url: authUrl
|
|
33930
|
+
};
|
|
33931
|
+
}
|
|
33932
|
+
async function pollCliLoginResult(code, options) {
|
|
33933
|
+
const fetchImpl = options.fetchImpl || fetch;
|
|
33934
|
+
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
33935
|
+
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
|
|
33936
|
+
const requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_SHORT_FETCH_TIMEOUT_MS;
|
|
33937
|
+
const deadline = Date.now() + timeoutMs;
|
|
33938
|
+
const resultUrl = getMakerCliLoginResultUrl(code, options.env);
|
|
33939
|
+
let lastPollError;
|
|
33940
|
+
for (; ; ) {
|
|
33941
|
+
if (Date.now() >= deadline) {
|
|
33942
|
+
const suffix = lastPollError ? ` Last polling error: ${formatError2(lastPollError)}` : "";
|
|
33943
|
+
throw new Error(
|
|
33944
|
+
`Maker CLI login timed out. Run \`taptap-maker login\` and try again.${suffix}`
|
|
33945
|
+
);
|
|
33946
|
+
}
|
|
33947
|
+
let response;
|
|
33948
|
+
try {
|
|
33949
|
+
response = await fetchWithTimeout(
|
|
33950
|
+
fetchImpl,
|
|
33951
|
+
resultUrl,
|
|
33952
|
+
{
|
|
33953
|
+
headers: {
|
|
33954
|
+
Accept: "application/json"
|
|
33955
|
+
}
|
|
33956
|
+
},
|
|
33957
|
+
Math.min(requestTimeoutMs, Math.max(1, deadline - Date.now())),
|
|
33958
|
+
"Maker CLI login poll"
|
|
33959
|
+
);
|
|
33960
|
+
} catch (error2) {
|
|
33961
|
+
lastPollError = error2;
|
|
33962
|
+
await delay(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
|
|
33963
|
+
continue;
|
|
33964
|
+
}
|
|
33965
|
+
const json2 = await readJsonResponse(response);
|
|
33966
|
+
if (!response.ok) {
|
|
33967
|
+
throw new Error(
|
|
33968
|
+
`Maker CLI login poll failed: HTTP ${response.status} ${JSON.stringify(json2)}`
|
|
33969
|
+
);
|
|
33970
|
+
}
|
|
33971
|
+
const normalized = normalizePollResponse(json2);
|
|
33972
|
+
if (normalized.status === "authorized") {
|
|
33973
|
+
if (!normalized.token) {
|
|
33974
|
+
throw new Error("Maker CLI login result does not contain PAT token.");
|
|
33975
|
+
}
|
|
33976
|
+
return {
|
|
33977
|
+
token: normalized.token,
|
|
33978
|
+
expires_at: normalized.expires_at,
|
|
33979
|
+
raw: json2
|
|
33980
|
+
};
|
|
33981
|
+
}
|
|
33982
|
+
if (normalized.status === "expired" || normalized.status === "consumed") {
|
|
33983
|
+
throw new Error(`Maker CLI login ${normalized.status}. Run \`taptap-maker login\` again.`);
|
|
33984
|
+
}
|
|
33985
|
+
await delay(Math.min(pollIntervalMs, Math.max(0, deadline - Date.now())));
|
|
33986
|
+
}
|
|
33987
|
+
}
|
|
33988
|
+
function normalizePollResponse(data) {
|
|
33989
|
+
const source = data.data || data;
|
|
33990
|
+
const token = source.pat || source.token || source.access_token;
|
|
33991
|
+
return {
|
|
33992
|
+
status: source.status || data.status || (token ? "authorized" : "pending"),
|
|
33993
|
+
token,
|
|
33994
|
+
expires_at: source.expires_at
|
|
33995
|
+
};
|
|
33996
|
+
}
|
|
33997
|
+
async function readJsonResponse(response) {
|
|
33998
|
+
const text = await response.text();
|
|
33999
|
+
if (!text) {
|
|
34000
|
+
return {};
|
|
34001
|
+
}
|
|
34002
|
+
try {
|
|
34003
|
+
return JSON.parse(text);
|
|
34004
|
+
} catch {
|
|
34005
|
+
return { error: text };
|
|
34006
|
+
}
|
|
34007
|
+
}
|
|
34008
|
+
function openBrowser(url2) {
|
|
34009
|
+
const command = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
|
|
34010
|
+
const args = process.platform === "win32" ? ["/c", "start", "", url2] : [url2];
|
|
34011
|
+
const result = spawnSync4(command, args, {
|
|
34012
|
+
stdio: "ignore",
|
|
34013
|
+
windowsHide: true
|
|
34014
|
+
});
|
|
34015
|
+
if (result.error || result.status !== 0) {
|
|
34016
|
+
process.stderr.write(
|
|
34017
|
+
`Open this Maker PAT URL in your browser, then log in and click "创建 token":
|
|
34018
|
+
${url2}
|
|
34019
|
+
`
|
|
34020
|
+
);
|
|
34021
|
+
}
|
|
34022
|
+
}
|
|
34023
|
+
function delay(ms) {
|
|
34024
|
+
return new Promise((resolve) => {
|
|
34025
|
+
setTimeout(resolve, ms);
|
|
34026
|
+
});
|
|
34027
|
+
}
|
|
34028
|
+
function formatError2(error2) {
|
|
34029
|
+
return error2 instanceof Error ? error2.message : String(error2);
|
|
34030
|
+
}
|
|
34031
|
+
|
|
34032
|
+
// src/maker/cli/commands.ts
|
|
33583
34033
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
33584
34034
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
33585
34035
|
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs"]);
|
|
@@ -33597,6 +34047,7 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
33597
34047
|
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";
|
|
33598
34048
|
async function runMakerCli(argv) {
|
|
33599
34049
|
const parsed = parseArgs(argv);
|
|
34050
|
+
setMakerEnvironmentOverride(makerEnvOption(parsed));
|
|
33600
34051
|
const ctx = { json: Boolean(parsed.options.json) };
|
|
33601
34052
|
const [command, subcommand] = parsed.command;
|
|
33602
34053
|
if (!command || command === "help" || command === "--help" || command === "-h") {
|
|
@@ -33615,6 +34066,10 @@ async function runMakerCli(argv) {
|
|
|
33615
34066
|
await runApps(parsed, ctx);
|
|
33616
34067
|
return;
|
|
33617
34068
|
}
|
|
34069
|
+
if (command === "login") {
|
|
34070
|
+
await runLogin(parsed, ctx);
|
|
34071
|
+
return;
|
|
34072
|
+
}
|
|
33618
34073
|
if (command === "pat" && subcommand === "set") {
|
|
33619
34074
|
await runPatSet(parsed, ctx);
|
|
33620
34075
|
return;
|
|
@@ -33688,7 +34143,7 @@ function toOptionKey(value) {
|
|
|
33688
34143
|
}
|
|
33689
34144
|
async function runInit(parsed, ctx) {
|
|
33690
34145
|
rejectPackageOption(parsed);
|
|
33691
|
-
const targetDir =
|
|
34146
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
33692
34147
|
const env = makerEnvOption(parsed);
|
|
33693
34148
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
33694
34149
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -33705,17 +34160,19 @@ async function runInit(parsed, ctx) {
|
|
|
33705
34160
|
emit(ctx, "doctor", "Git is available", { version: git.version });
|
|
33706
34161
|
const pat = await resolvePat(parsed, ctx);
|
|
33707
34162
|
emit(ctx, "pat", "Maker PAT ready", { saved: getPatPath() });
|
|
33708
|
-
const tapAuth = await requestTapAuthWithPat(pat).catch((error2) => {
|
|
34163
|
+
const tapAuth = await requestTapAuthWithPat(pat, env).catch((error2) => {
|
|
33709
34164
|
throw appendPatRecoveryUrl(error2, parsed);
|
|
33710
34165
|
});
|
|
33711
34166
|
emit(ctx, "tap_auth", "TapTap token exchanged and saved", {
|
|
33712
34167
|
kid: mask(tapAuth.kid),
|
|
33713
34168
|
saved: getTapAuthPath()
|
|
33714
34169
|
});
|
|
34170
|
+
const existingProjectConfig = loadProjectConfig(targetDir);
|
|
33715
34171
|
const projects = await listMakerProjects({ pat }).catch((error2) => {
|
|
33716
34172
|
throw appendPatRecoveryUrl(error2, parsed);
|
|
33717
34173
|
});
|
|
33718
34174
|
const selected = await resolveProjectSelection(parsed, projects, {
|
|
34175
|
+
existingProjectConfig,
|
|
33719
34176
|
skipConfirm
|
|
33720
34177
|
});
|
|
33721
34178
|
emit(ctx, "app", "Maker app selected", {
|
|
@@ -33723,6 +34180,12 @@ async function runInit(parsed, ctx) {
|
|
|
33723
34180
|
name: selected.name,
|
|
33724
34181
|
user_id: selected.user_id
|
|
33725
34182
|
});
|
|
34183
|
+
ensureInitTargetCanRecordProject(targetDir, existingProjectConfig == null ? void 0 : existingProjectConfig.project_id, selected.id);
|
|
34184
|
+
saveProjectConfig(targetDir, {
|
|
34185
|
+
project_id: selected.id,
|
|
34186
|
+
user_id: selected.user_id || (existingProjectConfig == null ? void 0 : existingProjectConfig.user_id),
|
|
34187
|
+
sce_endpoint: selected.sce_endpoint || (existingProjectConfig == null ? void 0 : existingProjectConfig.sce_endpoint)
|
|
34188
|
+
});
|
|
33726
34189
|
saveInitState(targetDir, {
|
|
33727
34190
|
status: "app_selected",
|
|
33728
34191
|
target_dir: targetDir,
|
|
@@ -33742,7 +34205,8 @@ async function runInit(parsed, ctx) {
|
|
|
33742
34205
|
emit(ctx, "clone", "Maker project cloned or fetched", cloneResult);
|
|
33743
34206
|
await prepareDevKit(targetDir, ctx, {
|
|
33744
34207
|
finalizeGitignore: true,
|
|
33745
|
-
forceInstall: true
|
|
34208
|
+
forceInstall: true,
|
|
34209
|
+
environment: env
|
|
33746
34210
|
});
|
|
33747
34211
|
if (!skipMcpInstall) {
|
|
33748
34212
|
const ides = parseIdeList(stringOption(parsed, "register_mcp") || "codex,cursor,claude");
|
|
@@ -33769,27 +34233,35 @@ async function runInit(parsed, ctx) {
|
|
|
33769
34233
|
});
|
|
33770
34234
|
}
|
|
33771
34235
|
async function runDoctor(parsed, ctx) {
|
|
33772
|
-
|
|
34236
|
+
var _a3, _b;
|
|
34237
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
34238
|
+
const env = makerEnvOption(parsed);
|
|
33773
34239
|
const git = checkGitEnvironment();
|
|
33774
34240
|
const pat = loadPat();
|
|
33775
34241
|
const tapAuth = loadTapAuth();
|
|
33776
34242
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
33777
|
-
const
|
|
34243
|
+
const isProjectBound = Boolean(identify.projectRoot);
|
|
34244
|
+
const projectRoot = identify.projectRoot || targetDir;
|
|
34245
|
+
const devKit = inspectAiDevKit(projectRoot);
|
|
34246
|
+
const devKitUpdate = await checkAiDevKitUpdate(projectRoot, { environment: env });
|
|
33778
34247
|
if (ctx.json) {
|
|
33779
34248
|
writeJson({
|
|
34249
|
+
env,
|
|
33780
34250
|
git,
|
|
33781
34251
|
auth: {
|
|
33782
34252
|
pat: Boolean(pat),
|
|
33783
34253
|
tap_auth: Boolean(tapAuth)
|
|
33784
34254
|
},
|
|
33785
34255
|
project: identify,
|
|
33786
|
-
dev_kit: devKit
|
|
34256
|
+
dev_kit: devKit,
|
|
34257
|
+
dev_kit_update: devKitUpdate
|
|
33787
34258
|
});
|
|
33788
34259
|
return;
|
|
33789
34260
|
}
|
|
33790
34261
|
process.stdout.write(
|
|
33791
34262
|
[
|
|
33792
34263
|
"TapTap Maker doctor",
|
|
34264
|
+
`env: ${env}`,
|
|
33793
34265
|
"",
|
|
33794
34266
|
"Git",
|
|
33795
34267
|
formatGitEnvironmentStatus(git),
|
|
@@ -33797,7 +34269,7 @@ async function runDoctor(parsed, ctx) {
|
|
|
33797
34269
|
"Auth",
|
|
33798
34270
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
33799
34271
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
33800
|
-
pat ? "" :
|
|
34272
|
+
pat ? "" : isProjectBound ? "- next_auth_step: taptap-maker login" : "- next_step: taptap-maker init",
|
|
33801
34273
|
"",
|
|
33802
34274
|
"Project",
|
|
33803
34275
|
`- target_dir: ${targetDir}`,
|
|
@@ -33807,8 +34279,12 @@ async function runDoctor(parsed, ctx) {
|
|
|
33807
34279
|
"AI dev kit",
|
|
33808
34280
|
`- ready: ${devKit.ready ? "yes" : "no"}`,
|
|
33809
34281
|
`- missing_entries: ${devKit.missingEntries.join(", ") || "(none)"}`,
|
|
34282
|
+
`- installed_version: ${((_a3 = devKitUpdate.installed) == null ? void 0 : _a3.version) || "(unknown)"}`,
|
|
34283
|
+
`- latest_version: ${((_b = devKitUpdate.latest) == null ? void 0 : _b.version) || "(unknown)"}`,
|
|
34284
|
+
`- update_available: ${devKitUpdate.updateAvailable ? "yes" : "no"}`,
|
|
34285
|
+
devKitUpdate.versionCheckError ? `- version_check: ${devKitUpdate.versionCheckError}` : "",
|
|
33810
34286
|
"",
|
|
33811
|
-
formatMakerSkillStatus({ projectRoot
|
|
34287
|
+
formatMakerSkillStatus({ projectRoot }),
|
|
33812
34288
|
""
|
|
33813
34289
|
].filter(Boolean).join("\n")
|
|
33814
34290
|
);
|
|
@@ -33830,10 +34306,29 @@ async function runApps(parsed, ctx) {
|
|
|
33830
34306
|
process.stdout.write(`${formatMakerProjectList(projects, { showAll })}
|
|
33831
34307
|
`);
|
|
33832
34308
|
}
|
|
34309
|
+
async function runLogin(parsed, ctx) {
|
|
34310
|
+
const env = makerEnvOption(parsed);
|
|
34311
|
+
const pat = await loginWithCliAuthCode({
|
|
34312
|
+
env,
|
|
34313
|
+
onStatus: (message) => emit(ctx, "login", message)
|
|
34314
|
+
});
|
|
34315
|
+
saveManualMakerPat(pat.token);
|
|
34316
|
+
const tapAuth = await requestTapAuthWithPat(pat.token, env).catch((error2) => {
|
|
34317
|
+
throw appendPatRecoveryUrl(error2, parsed);
|
|
34318
|
+
});
|
|
34319
|
+
emit(ctx, "login", "Maker CLI login completed", {
|
|
34320
|
+
env,
|
|
34321
|
+
code: pat.code,
|
|
34322
|
+
pat_path: getPatPath(),
|
|
34323
|
+
tap_auth_path: getTapAuthPath(),
|
|
34324
|
+
kid: mask(tapAuth.kid)
|
|
34325
|
+
});
|
|
34326
|
+
}
|
|
33833
34327
|
async function runPatSet(parsed, ctx) {
|
|
33834
34328
|
const pat = await resolvePatSet(parsed, ctx);
|
|
33835
34329
|
saveManualMakerPat(pat);
|
|
33836
|
-
const
|
|
34330
|
+
const env = makerEnvOption(parsed);
|
|
34331
|
+
const tapAuth = await requestTapAuthWithPat(pat, env).catch((error2) => {
|
|
33837
34332
|
throw appendPatRecoveryUrl(error2, parsed);
|
|
33838
34333
|
});
|
|
33839
34334
|
emit(ctx, "pat", "Maker PAT and TapTap token saved", {
|
|
@@ -33844,7 +34339,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
33844
34339
|
}
|
|
33845
34340
|
async function resolvePatSet(parsed, ctx) {
|
|
33846
34341
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
33847
|
-
const pat =
|
|
34342
|
+
const pat = fs10.readFileSync(0, "utf8").trim();
|
|
33848
34343
|
if (!pat) {
|
|
33849
34344
|
throw new Error("No PAT found on stdin.");
|
|
33850
34345
|
}
|
|
@@ -33857,10 +34352,13 @@ async function resolvePatSet(parsed, ctx) {
|
|
|
33857
34352
|
return fromPositional || fromOption;
|
|
33858
34353
|
}
|
|
33859
34354
|
if (!ctx.json) {
|
|
33860
|
-
process.stdout.write(
|
|
33861
|
-
`);
|
|
34355
|
+
process.stdout.write("Starting Maker CLI login...\n");
|
|
33862
34356
|
}
|
|
33863
|
-
|
|
34357
|
+
const result = await loginWithCliAuthCode({
|
|
34358
|
+
env: makerEnvOption(parsed),
|
|
34359
|
+
onStatus: (message) => emit(ctx, "login", message)
|
|
34360
|
+
});
|
|
34361
|
+
return result.token;
|
|
33864
34362
|
}
|
|
33865
34363
|
async function runMcpInstall(parsed, ctx) {
|
|
33866
34364
|
rejectPackageOption(parsed);
|
|
@@ -33883,7 +34381,7 @@ async function runMcpVerify(parsed, ctx) {
|
|
|
33883
34381
|
rejectPackageOption(parsed);
|
|
33884
34382
|
const mode = mcpVerifyModeOption(parsed);
|
|
33885
34383
|
const command = mode === "npx" ? getNpxCliCommand(MAKER_NPM_PACKAGE) : getCurrentCliCommand();
|
|
33886
|
-
const result =
|
|
34384
|
+
const result = spawnSync5(command.command, [...command.args, "help"], {
|
|
33887
34385
|
encoding: "utf8"
|
|
33888
34386
|
});
|
|
33889
34387
|
const failureType = classifyMcpVerifyFailure(result);
|
|
@@ -33972,17 +34470,19 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
33972
34470
|
];
|
|
33973
34471
|
}
|
|
33974
34472
|
async function runDevKitUpdate(parsed, ctx) {
|
|
33975
|
-
const targetDir =
|
|
34473
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
33976
34474
|
const result = await installAiDevKit({
|
|
33977
34475
|
targetDir,
|
|
33978
|
-
preserveExisting:
|
|
34476
|
+
preserveExisting: false,
|
|
34477
|
+
replaceManagedEntries: true,
|
|
34478
|
+
environment: makerEnvOption(parsed)
|
|
33979
34479
|
});
|
|
33980
34480
|
finalizeStagedDevKitGitignore(targetDir);
|
|
33981
34481
|
emit(ctx, "dev_kit", formatDevKitInstallMessage("AI dev kit updated", result), result);
|
|
33982
34482
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
33983
34483
|
}
|
|
33984
34484
|
async function runLogsWatch(parsed, ctx) {
|
|
33985
|
-
const targetDir =
|
|
34485
|
+
const targetDir = path11.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
33986
34486
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
33987
34487
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? 60 * 1e3;
|
|
33988
34488
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -33992,9 +34492,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
33992
34492
|
serverUrl: stringOption(parsed, "server_url"),
|
|
33993
34493
|
env: makerEnvOption(parsed)
|
|
33994
34494
|
});
|
|
33995
|
-
const runtimeDir =
|
|
33996
|
-
const runtimeLog =
|
|
33997
|
-
const pidFile =
|
|
34495
|
+
const runtimeDir = path11.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
34496
|
+
const runtimeLog = path11.join(runtimeDir, "runtime.log");
|
|
34497
|
+
const pidFile = path11.join(runtimeDir, "watcher.pid");
|
|
33998
34498
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
33999
34499
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
34000
34500
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -34039,10 +34539,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
34039
34539
|
}
|
|
34040
34540
|
}
|
|
34041
34541
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
34042
|
-
|
|
34542
|
+
fs10.mkdirSync(path11.dirname(pidFile), { recursive: true });
|
|
34043
34543
|
const existingPid = readPidFile(pidFile);
|
|
34044
34544
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
34045
|
-
|
|
34545
|
+
fs10.writeFileSync(
|
|
34046
34546
|
pidFile,
|
|
34047
34547
|
`${JSON.stringify(
|
|
34048
34548
|
{
|
|
@@ -34060,10 +34560,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
34060
34560
|
return previous;
|
|
34061
34561
|
}
|
|
34062
34562
|
function readPidFile(pidFile) {
|
|
34063
|
-
if (!
|
|
34563
|
+
if (!fs10.existsSync(pidFile)) {
|
|
34064
34564
|
return void 0;
|
|
34065
34565
|
}
|
|
34066
|
-
const raw =
|
|
34566
|
+
const raw = fs10.readFileSync(pidFile, "utf8").trim();
|
|
34067
34567
|
let pid = Number(raw);
|
|
34068
34568
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
34069
34569
|
try {
|
|
@@ -34083,7 +34583,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
34083
34583
|
}
|
|
34084
34584
|
cleaned = true;
|
|
34085
34585
|
if (readPidFile(pidFile) === process.pid) {
|
|
34086
|
-
|
|
34586
|
+
fs10.rmSync(pidFile, { force: true });
|
|
34087
34587
|
}
|
|
34088
34588
|
};
|
|
34089
34589
|
process.once("exit", cleanup);
|
|
@@ -34107,26 +34607,37 @@ async function resolvePat(parsed, ctx) {
|
|
|
34107
34607
|
}
|
|
34108
34608
|
if (booleanOption(parsed, "skip_confirm")) {
|
|
34109
34609
|
throw new Error(
|
|
34110
|
-
|
|
34610
|
+
"Maker PAT missing. Run `taptap-maker login` or provide --pat/MAKER_PAT for non-interactive init."
|
|
34111
34611
|
);
|
|
34112
34612
|
}
|
|
34113
|
-
|
|
34114
|
-
|
|
34115
|
-
pat_page: patPage
|
|
34613
|
+
emit(ctx, "pat_required", "Maker login is required", {
|
|
34614
|
+
next_step: "taptap-maker login"
|
|
34116
34615
|
});
|
|
34117
34616
|
if (!ctx.json) {
|
|
34118
|
-
process.stdout.write(
|
|
34119
|
-
`);
|
|
34617
|
+
process.stdout.write("Starting Maker CLI login...\n");
|
|
34120
34618
|
}
|
|
34121
|
-
const
|
|
34619
|
+
const loginResult = await loginWithCliAuthCode({
|
|
34620
|
+
env: makerEnvOption(parsed),
|
|
34621
|
+
onStatus: (message) => emit(ctx, "login", message)
|
|
34622
|
+
});
|
|
34623
|
+
const pat = loginResult.token;
|
|
34122
34624
|
saveManualMakerPat(pat);
|
|
34123
34625
|
return pat;
|
|
34124
34626
|
}
|
|
34125
34627
|
async function resolveProjectSelection(parsed, projects, options) {
|
|
34628
|
+
var _a3;
|
|
34126
34629
|
const appId = stringOption(parsed, "app_id") || parsed.positionals[0];
|
|
34127
34630
|
if (appId) {
|
|
34128
34631
|
return projects.find((project) => project.id === appId) || { id: appId };
|
|
34129
34632
|
}
|
|
34633
|
+
if ((_a3 = options.existingProjectConfig) == null ? void 0 : _a3.project_id) {
|
|
34634
|
+
const projectId = options.existingProjectConfig.project_id;
|
|
34635
|
+
return projects.find((project) => project.id === projectId) || {
|
|
34636
|
+
id: projectId,
|
|
34637
|
+
user_id: options.existingProjectConfig.user_id,
|
|
34638
|
+
sce_endpoint: options.existingProjectConfig.sce_endpoint
|
|
34639
|
+
};
|
|
34640
|
+
}
|
|
34130
34641
|
if (projects.length === 0) {
|
|
34131
34642
|
throw new Error("No Maker apps found for this PAT.");
|
|
34132
34643
|
}
|
|
@@ -34160,6 +34671,19 @@ async function resolveProjectSelection(parsed, projects, options) {
|
|
|
34160
34671
|
return selected;
|
|
34161
34672
|
}
|
|
34162
34673
|
}
|
|
34674
|
+
function ensureInitTargetCanRecordProject(targetDir, existingProjectId, selectedProjectId) {
|
|
34675
|
+
if (!existingProjectId || existingProjectId === selectedProjectId) {
|
|
34676
|
+
return;
|
|
34677
|
+
}
|
|
34678
|
+
throw new Error(
|
|
34679
|
+
[
|
|
34680
|
+
`${targetDir} is already bound to Maker project ${existingProjectId}.`,
|
|
34681
|
+
`You are trying to initialize Maker project ${selectedProjectId} into the same directory.`,
|
|
34682
|
+
"A Maker workspace directory can only be bound to one project at a time.",
|
|
34683
|
+
"Please switch to the directory for the existing project, or create/open a new empty directory for the new project."
|
|
34684
|
+
].join("\n")
|
|
34685
|
+
);
|
|
34686
|
+
}
|
|
34163
34687
|
async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
34164
34688
|
const before = inspectAiDevKit(targetDir);
|
|
34165
34689
|
if (before.ready && !options.forceInstall) {
|
|
@@ -34168,7 +34692,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
34168
34692
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
34169
34693
|
});
|
|
34170
34694
|
writeDevKitStagedGitignore(
|
|
34171
|
-
|
|
34695
|
+
path11.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
34172
34696
|
listPresentDevKitManagedEntries(targetDir)
|
|
34173
34697
|
);
|
|
34174
34698
|
if (options.finalizeGitignore) {
|
|
@@ -34185,7 +34709,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
34185
34709
|
);
|
|
34186
34710
|
} catch (error2) {
|
|
34187
34711
|
writeDevKitStagedGitignore(
|
|
34188
|
-
|
|
34712
|
+
path11.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
34189
34713
|
listPresentDevKitManagedEntries(targetDir)
|
|
34190
34714
|
);
|
|
34191
34715
|
if (options.finalizeGitignore) {
|
|
@@ -34203,6 +34727,7 @@ ${detail}`, {
|
|
|
34203
34727
|
const result = await installAiDevKit({
|
|
34204
34728
|
targetDir,
|
|
34205
34729
|
preserveExisting: options.preserveExisting,
|
|
34730
|
+
environment: options.environment,
|
|
34206
34731
|
onSkillInstallerStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
34207
34732
|
});
|
|
34208
34733
|
if (options.finalizeGitignore) {
|
|
@@ -34242,19 +34767,13 @@ ${detail}`, {
|
|
|
34242
34767
|
error: detail
|
|
34243
34768
|
});
|
|
34244
34769
|
}
|
|
34245
|
-
function appendPatRecoveryUrl(error2,
|
|
34770
|
+
function appendPatRecoveryUrl(error2, _parsed) {
|
|
34246
34771
|
const message = error2 instanceof Error ? error2.message : String(error2);
|
|
34247
|
-
if (!isPatValidationFailure(message)
|
|
34772
|
+
if (!isPatValidationFailure(message)) {
|
|
34248
34773
|
return error2 instanceof Error ? error2 : new Error(message);
|
|
34249
34774
|
}
|
|
34250
|
-
const patPage = getMakerPatTokensUrl(makerEnvOption(parsed));
|
|
34251
34775
|
return new Error(
|
|
34252
|
-
[
|
|
34253
|
-
message,
|
|
34254
|
-
"",
|
|
34255
|
-
`PAT 页面:${patPage}`,
|
|
34256
|
-
"请在该页面创建新的 Maker PAT,然后运行 `taptap-maker pat set` 并粘贴 PAT。"
|
|
34257
|
-
].join("\n")
|
|
34776
|
+
[message, "", "请运行 `taptap-maker login` 重新完成 Maker CLI 登录授权。"].join("\n")
|
|
34258
34777
|
);
|
|
34259
34778
|
}
|
|
34260
34779
|
function isPatValidationFailure(message) {
|
|
@@ -34278,7 +34797,7 @@ function installMcpConfig(ide, options) {
|
|
|
34278
34797
|
}
|
|
34279
34798
|
function installMcpConfigUnsafe(ide, options) {
|
|
34280
34799
|
if (ide === "codex") {
|
|
34281
|
-
const configPath =
|
|
34800
|
+
const configPath = path11.join(os4.homedir(), ".codex", "config.toml");
|
|
34282
34801
|
mergeCodexMcpConfig(configPath, options);
|
|
34283
34802
|
return {
|
|
34284
34803
|
ide,
|
|
@@ -34288,7 +34807,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
34288
34807
|
};
|
|
34289
34808
|
}
|
|
34290
34809
|
if (ide === "cursor") {
|
|
34291
|
-
const configPath =
|
|
34810
|
+
const configPath = path11.join(os4.homedir(), ".cursor", "mcp.json");
|
|
34292
34811
|
mergeJsonMcpConfig(configPath, options);
|
|
34293
34812
|
return {
|
|
34294
34813
|
ide,
|
|
@@ -34302,7 +34821,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
34302
34821
|
if (claudeResult.ok) {
|
|
34303
34822
|
return { ide, ok: true, message: "✓ Claude Code MCP config updated with claude mcp add" };
|
|
34304
34823
|
}
|
|
34305
|
-
const configPath =
|
|
34824
|
+
const configPath = path11.join(os4.homedir(), ".claude.json");
|
|
34306
34825
|
mergeJsonMcpConfig(configPath, options);
|
|
34307
34826
|
return {
|
|
34308
34827
|
ide,
|
|
@@ -34319,13 +34838,13 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
34319
34838
|
const mcpServers = asObject(existing.mcpServers);
|
|
34320
34839
|
mcpServers[options.mcpName] = createJsonMcpServerConfig(options);
|
|
34321
34840
|
existing.mcpServers = mcpServers;
|
|
34322
|
-
|
|
34323
|
-
|
|
34841
|
+
fs10.mkdirSync(path11.dirname(configPath), { recursive: true });
|
|
34842
|
+
fs10.writeFileSync(configPath, `${JSON.stringify(existing, null, 2)}
|
|
34324
34843
|
`, "utf8");
|
|
34325
34844
|
}
|
|
34326
34845
|
function mergeCodexMcpConfig(configPath, options) {
|
|
34327
34846
|
const backupPath = backupIfExists(configPath);
|
|
34328
|
-
const existing =
|
|
34847
|
+
const existing = fs10.existsSync(configPath) ? fs10.readFileSync(configPath, "utf8") : "";
|
|
34329
34848
|
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
34330
34849
|
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
34331
34850
|
const command = getNpxCommand();
|
|
@@ -34338,9 +34857,9 @@ function mergeCodexMcpConfig(configPath, options) {
|
|
|
34338
34857
|
`TAPTAP_MCP_ENV = "${options.env}"`,
|
|
34339
34858
|
""
|
|
34340
34859
|
].join("\n");
|
|
34341
|
-
|
|
34342
|
-
|
|
34343
|
-
const updated =
|
|
34860
|
+
fs10.mkdirSync(path11.dirname(configPath), { recursive: true });
|
|
34861
|
+
fs10.writeFileSync(configPath, [withoutOld, section].filter(Boolean).join("\n\n"), "utf8");
|
|
34862
|
+
const updated = fs10.readFileSync(configPath, "utf8");
|
|
34344
34863
|
const duplicates = findCodexMcpTableDuplicates(updated, options.mcpName);
|
|
34345
34864
|
if (duplicates.length > 0) {
|
|
34346
34865
|
restoreBackup(configPath, backupPath);
|
|
@@ -34393,7 +34912,7 @@ function normalizeCodexMcpTablePath(tablePath, mcpName) {
|
|
|
34393
34912
|
}
|
|
34394
34913
|
function tryClaudeMcpAdd(options) {
|
|
34395
34914
|
const command = process.platform === "win32" ? "claude.cmd" : "claude";
|
|
34396
|
-
const result =
|
|
34915
|
+
const result = spawnSync5(
|
|
34397
34916
|
command,
|
|
34398
34917
|
[
|
|
34399
34918
|
"mcp",
|
|
@@ -34445,10 +34964,10 @@ function rejectPackageOption(parsed) {
|
|
|
34445
34964
|
}
|
|
34446
34965
|
}
|
|
34447
34966
|
function readJsonObject(filePath) {
|
|
34448
|
-
if (!
|
|
34967
|
+
if (!fs10.existsSync(filePath)) {
|
|
34449
34968
|
return {};
|
|
34450
34969
|
}
|
|
34451
|
-
return JSON.parse(
|
|
34970
|
+
return JSON.parse(fs10.readFileSync(filePath, "utf8"));
|
|
34452
34971
|
}
|
|
34453
34972
|
function asObject(value) {
|
|
34454
34973
|
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
@@ -34457,26 +34976,26 @@ function asObject(value) {
|
|
|
34457
34976
|
return {};
|
|
34458
34977
|
}
|
|
34459
34978
|
function backupIfExists(filePath) {
|
|
34460
|
-
if (!
|
|
34979
|
+
if (!fs10.existsSync(filePath)) {
|
|
34461
34980
|
return void 0;
|
|
34462
34981
|
}
|
|
34463
34982
|
const stamp = (/* @__PURE__ */ new Date()).toISOString().replace(/[-:]/g, "").replace(/\..+$/, "");
|
|
34464
34983
|
const backupPath = `${filePath}.bak.${stamp}`;
|
|
34465
|
-
|
|
34984
|
+
fs10.copyFileSync(filePath, backupPath);
|
|
34466
34985
|
return backupPath;
|
|
34467
34986
|
}
|
|
34468
34987
|
function restoreBackup(filePath, backupPath) {
|
|
34469
34988
|
if (backupPath) {
|
|
34470
|
-
|
|
34989
|
+
fs10.copyFileSync(backupPath, filePath);
|
|
34471
34990
|
return;
|
|
34472
34991
|
}
|
|
34473
|
-
|
|
34992
|
+
fs10.rmSync(filePath, { force: true });
|
|
34474
34993
|
}
|
|
34475
34994
|
function saveInitState(targetDir, state) {
|
|
34476
|
-
|
|
34477
|
-
const key =
|
|
34478
|
-
|
|
34479
|
-
|
|
34995
|
+
fs10.mkdirSync(getMakerHome(), { recursive: true });
|
|
34996
|
+
const key = crypto2.createHash("sha256").update(path11.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
34997
|
+
fs10.writeFileSync(
|
|
34998
|
+
path11.join(getMakerHome(), `init-state-${key}.json`),
|
|
34480
34999
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
34481
35000
|
`,
|
|
34482
35001
|
"utf8"
|
|
@@ -34611,7 +35130,8 @@ function makerEnvOption(parsed) {
|
|
|
34611
35130
|
if (env === "rnd" || env === "production") {
|
|
34612
35131
|
return env;
|
|
34613
35132
|
}
|
|
34614
|
-
|
|
35133
|
+
const targetDir = stringOption(parsed, "target_dir");
|
|
35134
|
+
return getMakerEnvironment(void 0, targetDir ? path11.resolve(targetDir) : process.cwd());
|
|
34615
35135
|
}
|
|
34616
35136
|
function mcpVerifyModeOption(parsed) {
|
|
34617
35137
|
const mode = stringOption(parsed, "mode") || "npx";
|
|
@@ -34655,8 +35175,9 @@ function printHelp() {
|
|
|
34655
35175
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
34656
35176
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
34657
35177
|
" # --pat warns: PAT appears in ps/history",
|
|
35178
|
+
" taptap-maker login [--env rnd|production] [--json]",
|
|
34658
35179
|
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
34659
|
-
" taptap-maker pat set [PAT|--pat PAT] [--json] # warns: PAT appears in ps/history",
|
|
35180
|
+
" taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
|
|
34660
35181
|
" taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
34661
35182
|
" [--json] # alias for mcp install",
|
|
34662
35183
|
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
@@ -34682,14 +35203,14 @@ function formatCliError(error2) {
|
|
|
34682
35203
|
}
|
|
34683
35204
|
|
|
34684
35205
|
// src/maker/crashLog.ts
|
|
34685
|
-
import
|
|
34686
|
-
import
|
|
35206
|
+
import fs11 from "node:fs";
|
|
35207
|
+
import path12 from "node:path";
|
|
34687
35208
|
var DEFAULT_MAX_BYTES = 1024 * 1024;
|
|
34688
35209
|
var DEFAULT_MAX_ENTRY_BYTES = 16 * 1024;
|
|
34689
35210
|
function appendMakerCrashLog(source, error2, options = {}) {
|
|
34690
35211
|
const makerHome = getMakerHome();
|
|
34691
|
-
|
|
34692
|
-
const logPath =
|
|
35212
|
+
fs11.mkdirSync(makerHome, { recursive: true });
|
|
35213
|
+
const logPath = path12.join(makerHome, "mcp-crash.log");
|
|
34693
35214
|
const maxBytes = positiveInteger(options.maxBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_BYTES", DEFAULT_MAX_BYTES);
|
|
34694
35215
|
const maxEntryBytes = positiveInteger(options.maxEntryBytes) || resolveEnvBytes("TAPTAP_MAKER_CRASH_LOG_MAX_ENTRY_BYTES", DEFAULT_MAX_ENTRY_BYTES);
|
|
34695
35216
|
const message = error2 instanceof Error ? error2.stack || error2.message : String(error2);
|
|
@@ -34699,31 +35220,31 @@ function appendMakerCrashLog(source, error2, options = {}) {
|
|
|
34699
35220
|
);
|
|
34700
35221
|
const entryBytes = Buffer.byteLength(entry, "utf8");
|
|
34701
35222
|
rotateIfNeeded(logPath, maxBytes, entryBytes);
|
|
34702
|
-
|
|
35223
|
+
fs11.appendFileSync(logPath, entry, "utf8");
|
|
34703
35224
|
}
|
|
34704
35225
|
function rotateIfNeeded(logPath, maxBytes, incomingBytes) {
|
|
34705
|
-
if (!
|
|
35226
|
+
if (!fs11.existsSync(logPath)) {
|
|
34706
35227
|
return;
|
|
34707
35228
|
}
|
|
34708
|
-
const currentBytes =
|
|
35229
|
+
const currentBytes = fs11.statSync(logPath).size;
|
|
34709
35230
|
if (currentBytes + incomingBytes <= maxBytes) {
|
|
34710
35231
|
return;
|
|
34711
35232
|
}
|
|
34712
35233
|
const rotatedPath = `${logPath}.1`;
|
|
34713
35234
|
writeFileTail(logPath, rotatedPath, maxBytes);
|
|
34714
|
-
|
|
35235
|
+
fs11.writeFileSync(logPath, "", "utf8");
|
|
34715
35236
|
}
|
|
34716
35237
|
function writeFileTail(sourcePath, targetPath, maxBytes) {
|
|
34717
|
-
const size =
|
|
35238
|
+
const size = fs11.statSync(sourcePath).size;
|
|
34718
35239
|
const bytesToRead = Math.min(size, maxBytes);
|
|
34719
35240
|
const start = Math.max(0, size - bytesToRead);
|
|
34720
|
-
const fd =
|
|
35241
|
+
const fd = fs11.openSync(sourcePath, "r");
|
|
34721
35242
|
try {
|
|
34722
35243
|
const buffer = Buffer.alloc(bytesToRead);
|
|
34723
|
-
|
|
34724
|
-
|
|
35244
|
+
fs11.readSync(fd, buffer, 0, bytesToRead, start);
|
|
35245
|
+
fs11.writeFileSync(targetPath, buffer);
|
|
34725
35246
|
} finally {
|
|
34726
|
-
|
|
35247
|
+
fs11.closeSync(fd);
|
|
34727
35248
|
}
|
|
34728
35249
|
}
|
|
34729
35250
|
function truncateUtf8(value, maxBytes) {
|
|
@@ -34915,13 +35436,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
34915
35436
|
}
|
|
34916
35437
|
|
|
34917
35438
|
// node_modules/pkce-challenge/dist/index.node.js
|
|
34918
|
-
var
|
|
35439
|
+
var crypto3;
|
|
34919
35440
|
var _a2;
|
|
34920
|
-
|
|
35441
|
+
crypto3 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
|
|
34921
35442
|
globalThis.crypto ?? // Node.js >18
|
|
34922
35443
|
import("node:crypto").then((m) => m.webcrypto);
|
|
34923
35444
|
async function getRandomValues(size) {
|
|
34924
|
-
return (await
|
|
35445
|
+
return (await crypto3).getRandomValues(new Uint8Array(size));
|
|
34925
35446
|
}
|
|
34926
35447
|
async function random(size) {
|
|
34927
35448
|
const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
@@ -34937,7 +35458,7 @@ async function generateVerifier(length) {
|
|
|
34937
35458
|
return await random(length);
|
|
34938
35459
|
}
|
|
34939
35460
|
async function generateChallenge(code_verifier) {
|
|
34940
|
-
const buffer = await (await
|
|
35461
|
+
const buffer = await (await crypto3).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
34941
35462
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
34942
35463
|
}
|
|
34943
35464
|
async function pkceChallenge(length) {
|
|
@@ -36007,14 +36528,14 @@ var StreamableHTTPClientTransport = class {
|
|
|
36007
36528
|
(_a3 = this.onerror) == null ? void 0 : _a3.call(this, new Error(`Maximum reconnection attempts (${maxRetries}) exceeded.`));
|
|
36008
36529
|
return;
|
|
36009
36530
|
}
|
|
36010
|
-
const
|
|
36531
|
+
const delay2 = this._getNextReconnectionDelay(attemptCount);
|
|
36011
36532
|
this._reconnectionTimeout = setTimeout(() => {
|
|
36012
36533
|
this._startOrAuthSse(options).catch((error2) => {
|
|
36013
36534
|
var _a4;
|
|
36014
36535
|
(_a4 = this.onerror) == null ? void 0 : _a4.call(this, new Error(`Failed to reconnect SSE stream: ${error2 instanceof Error ? error2.message : String(error2)}`));
|
|
36015
36536
|
this._scheduleReconnection(options, attemptCount + 1);
|
|
36016
36537
|
});
|
|
36017
|
-
},
|
|
36538
|
+
}, delay2);
|
|
36018
36539
|
}
|
|
36019
36540
|
_handleSseStream(stream, options, isReconnectable) {
|
|
36020
36541
|
if (!stream) {
|
|
@@ -36292,8 +36813,8 @@ var StreamableHTTPClientTransport = class {
|
|
|
36292
36813
|
};
|
|
36293
36814
|
|
|
36294
36815
|
// src/mcp-proxy/proxy.ts
|
|
36295
|
-
import * as
|
|
36296
|
-
import * as
|
|
36816
|
+
import * as path14 from "node:path";
|
|
36817
|
+
import * as crypto5 from "node:crypto";
|
|
36297
36818
|
|
|
36298
36819
|
// src/mcp-proxy/cookieJar.ts
|
|
36299
36820
|
var CookieJar = class {
|
|
@@ -36474,9 +36995,9 @@ function createCookieFetch(cookieJar) {
|
|
|
36474
36995
|
}
|
|
36475
36996
|
|
|
36476
36997
|
// src/core/utils/logWriter.ts
|
|
36477
|
-
import * as
|
|
36478
|
-
import * as
|
|
36479
|
-
import * as
|
|
36998
|
+
import * as fs12 from "node:fs";
|
|
36999
|
+
import * as path13 from "node:path";
|
|
37000
|
+
import * as crypto4 from "node:crypto";
|
|
36480
37001
|
|
|
36481
37002
|
// src/core/types/log.ts
|
|
36482
37003
|
var LOG_LEVEL_PRIORITY = {
|
|
@@ -36516,7 +37037,7 @@ var LogWriter = class {
|
|
|
36516
37037
|
return;
|
|
36517
37038
|
}
|
|
36518
37039
|
try {
|
|
36519
|
-
await
|
|
37040
|
+
await fs12.promises.mkdir(this.config.logDir, { recursive: true });
|
|
36520
37041
|
await this.cleanupOldLogs();
|
|
36521
37042
|
this.initialized = true;
|
|
36522
37043
|
} catch (error2) {
|
|
@@ -36539,7 +37060,7 @@ var LogWriter = class {
|
|
|
36539
37060
|
*/
|
|
36540
37061
|
getLogFilePath(date5) {
|
|
36541
37062
|
const d = date5 || this.getCurrentDate();
|
|
36542
|
-
return
|
|
37063
|
+
return path13.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
36543
37064
|
}
|
|
36544
37065
|
/**
|
|
36545
37066
|
* 获取或创建写入流
|
|
@@ -36554,7 +37075,7 @@ var LogWriter = class {
|
|
|
36554
37075
|
}
|
|
36555
37076
|
this.currentDate = date5;
|
|
36556
37077
|
try {
|
|
36557
|
-
this.writeStream =
|
|
37078
|
+
this.writeStream = fs12.createWriteStream(this.getLogFilePath(date5), {
|
|
36558
37079
|
flags: "a",
|
|
36559
37080
|
encoding: "utf8"
|
|
36560
37081
|
});
|
|
@@ -36606,11 +37127,11 @@ var LogWriter = class {
|
|
|
36606
37127
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
36607
37128
|
try {
|
|
36608
37129
|
const filePath = this.getLogFilePath();
|
|
36609
|
-
const dir =
|
|
36610
|
-
if (!
|
|
36611
|
-
|
|
37130
|
+
const dir = path13.dirname(filePath);
|
|
37131
|
+
if (!fs12.existsSync(dir)) {
|
|
37132
|
+
fs12.mkdirSync(dir, { recursive: true });
|
|
36612
37133
|
}
|
|
36613
|
-
|
|
37134
|
+
fs12.appendFileSync(filePath, message, "utf8");
|
|
36614
37135
|
} catch {
|
|
36615
37136
|
}
|
|
36616
37137
|
}
|
|
@@ -36621,7 +37142,7 @@ var LogWriter = class {
|
|
|
36621
37142
|
async cleanupOldLogs() {
|
|
36622
37143
|
if (this.config.maxDays <= 0) return;
|
|
36623
37144
|
try {
|
|
36624
|
-
const files = await
|
|
37145
|
+
const files = await fs12.promises.readdir(this.config.logDir);
|
|
36625
37146
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
36626
37147
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
36627
37148
|
const prefix = this.config.prefix;
|
|
@@ -36636,7 +37157,7 @@ var LogWriter = class {
|
|
|
36636
37157
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
36637
37158
|
const fileDate = new Date(year, month - 1, day);
|
|
36638
37159
|
if (fileDate < cutoffDate) {
|
|
36639
|
-
await
|
|
37160
|
+
await fs12.promises.unlink(path13.join(this.config.logDir, file2));
|
|
36640
37161
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
36641
37162
|
`);
|
|
36642
37163
|
}
|
|
@@ -36707,10 +37228,10 @@ var TapTapMCPProxy = class {
|
|
|
36707
37228
|
const { user_id, project_id } = this.config.tenant;
|
|
36708
37229
|
let logDir;
|
|
36709
37230
|
if (user_id && project_id) {
|
|
36710
|
-
logDir =
|
|
37231
|
+
logDir = path14.join(logRoot, "proxy", user_id, project_id);
|
|
36711
37232
|
} else {
|
|
36712
|
-
const kidHash =
|
|
36713
|
-
logDir =
|
|
37233
|
+
const kidHash = crypto5.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
37234
|
+
logDir = path14.join(logRoot, "proxy", kidHash);
|
|
36714
37235
|
}
|
|
36715
37236
|
return new LogWriter({
|
|
36716
37237
|
logDir,
|
|
@@ -37345,8 +37866,9 @@ function printHelp2() {
|
|
|
37345
37866
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
37346
37867
|
" taptap-maker apps [--pat PAT] [--all] [--json]",
|
|
37347
37868
|
" # --pat warns: PAT appears in ps/history",
|
|
37869
|
+
" taptap-maker login [--env rnd|production] [--json]",
|
|
37348
37870
|
" taptap-maker pat set [--pat-stdin] [--json]",
|
|
37349
|
-
" taptap-maker pat set [PAT|--pat PAT] [--json] # warns: PAT appears in ps/history",
|
|
37871
|
+
" taptap-maker pat set [PAT|--pat PAT] [--json] # fallback; warns: PAT appears in ps/history",
|
|
37350
37872
|
" taptap-maker install [--ide codex,cursor,claude] [--env rnd|production]",
|
|
37351
37873
|
" [--json] # alias for mcp install",
|
|
37352
37874
|
" taptap-maker mcp install [--ide codex,cursor,claude] [--env rnd|production]",
|