@taptap/maker 0.0.31-beta.2 → 0.0.32-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/maker.js +363 -1601
- package/docs/MAKER_MCP_CONNECTION_TROUBLESHOOTING.md +5 -5
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +21 -25
package/dist/maker.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// TapTap Maker MCP - Standalone Bundle
|
|
3
|
-
// TapTap Maker MCP version: 0.0.31-beta.2
|
|
4
3
|
import { createRequire } from 'node:module';
|
|
5
4
|
const require = createRequire(import.meta.url);
|
|
6
5
|
const __MAKER_BUNDLE_URL__ = import.meta.url;
|
|
@@ -3234,8 +3233,8 @@ var require_utils = __commonJS({
|
|
|
3234
3233
|
}
|
|
3235
3234
|
return ind;
|
|
3236
3235
|
}
|
|
3237
|
-
function removeDotSegments(
|
|
3238
|
-
let input2 =
|
|
3236
|
+
function removeDotSegments(path25) {
|
|
3237
|
+
let input2 = path25;
|
|
3239
3238
|
const output2 = [];
|
|
3240
3239
|
let nextSlash = -1;
|
|
3241
3240
|
let len = 0;
|
|
@@ -3434,8 +3433,8 @@ var require_schemes = __commonJS({
|
|
|
3434
3433
|
wsComponent.secure = void 0;
|
|
3435
3434
|
}
|
|
3436
3435
|
if (wsComponent.resourceName) {
|
|
3437
|
-
const [
|
|
3438
|
-
wsComponent.path =
|
|
3436
|
+
const [path25, query] = wsComponent.resourceName.split("?");
|
|
3437
|
+
wsComponent.path = path25 && path25 !== "/" ? path25 : void 0;
|
|
3439
3438
|
wsComponent.query = query;
|
|
3440
3439
|
wsComponent.resourceName = void 0;
|
|
3441
3440
|
}
|
|
@@ -12492,12 +12491,12 @@ var require_dist = __commonJS({
|
|
|
12492
12491
|
throw new Error(`Unknown format "${name}"`);
|
|
12493
12492
|
return f;
|
|
12494
12493
|
};
|
|
12495
|
-
function addFormats(ajv, list,
|
|
12494
|
+
function addFormats(ajv, list, fs23, exportName) {
|
|
12496
12495
|
var _a3;
|
|
12497
12496
|
var _b;
|
|
12498
12497
|
(_a3 = (_b = ajv.opts.code).formats) !== null && _a3 !== void 0 ? _a3 : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
12499
12498
|
for (const f of list)
|
|
12500
|
-
ajv.addFormat(f,
|
|
12499
|
+
ajv.addFormat(f, fs23[f]);
|
|
12501
12500
|
}
|
|
12502
12501
|
module.exports = exports = formatsPlugin;
|
|
12503
12502
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -12510,8 +12509,8 @@ var require_windows = __commonJS({
|
|
|
12510
12509
|
"node_modules/isexe/windows.js"(exports, module) {
|
|
12511
12510
|
module.exports = isexe;
|
|
12512
12511
|
isexe.sync = sync;
|
|
12513
|
-
var
|
|
12514
|
-
function checkPathExt(
|
|
12512
|
+
var fs23 = __require("fs");
|
|
12513
|
+
function checkPathExt(path25, options) {
|
|
12515
12514
|
var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
|
|
12516
12515
|
if (!pathext) {
|
|
12517
12516
|
return true;
|
|
@@ -12522,25 +12521,25 @@ var require_windows = __commonJS({
|
|
|
12522
12521
|
}
|
|
12523
12522
|
for (var i = 0; i < pathext.length; i++) {
|
|
12524
12523
|
var p = pathext[i].toLowerCase();
|
|
12525
|
-
if (p &&
|
|
12524
|
+
if (p && path25.substr(-p.length).toLowerCase() === p) {
|
|
12526
12525
|
return true;
|
|
12527
12526
|
}
|
|
12528
12527
|
}
|
|
12529
12528
|
return false;
|
|
12530
12529
|
}
|
|
12531
|
-
function checkStat(stat,
|
|
12530
|
+
function checkStat(stat, path25, options) {
|
|
12532
12531
|
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
|
12533
12532
|
return false;
|
|
12534
12533
|
}
|
|
12535
|
-
return checkPathExt(
|
|
12534
|
+
return checkPathExt(path25, options);
|
|
12536
12535
|
}
|
|
12537
|
-
function isexe(
|
|
12538
|
-
|
|
12539
|
-
cb(er, er ? false : checkStat(stat,
|
|
12536
|
+
function isexe(path25, options, cb) {
|
|
12537
|
+
fs23.stat(path25, function(er, stat) {
|
|
12538
|
+
cb(er, er ? false : checkStat(stat, path25, options));
|
|
12540
12539
|
});
|
|
12541
12540
|
}
|
|
12542
|
-
function sync(
|
|
12543
|
-
return checkStat(
|
|
12541
|
+
function sync(path25, options) {
|
|
12542
|
+
return checkStat(fs23.statSync(path25), path25, options);
|
|
12544
12543
|
}
|
|
12545
12544
|
}
|
|
12546
12545
|
});
|
|
@@ -12550,14 +12549,14 @@ var require_mode = __commonJS({
|
|
|
12550
12549
|
"node_modules/isexe/mode.js"(exports, module) {
|
|
12551
12550
|
module.exports = isexe;
|
|
12552
12551
|
isexe.sync = sync;
|
|
12553
|
-
var
|
|
12554
|
-
function isexe(
|
|
12555
|
-
|
|
12552
|
+
var fs23 = __require("fs");
|
|
12553
|
+
function isexe(path25, options, cb) {
|
|
12554
|
+
fs23.stat(path25, function(er, stat) {
|
|
12556
12555
|
cb(er, er ? false : checkStat(stat, options));
|
|
12557
12556
|
});
|
|
12558
12557
|
}
|
|
12559
|
-
function sync(
|
|
12560
|
-
return checkStat(
|
|
12558
|
+
function sync(path25, options) {
|
|
12559
|
+
return checkStat(fs23.statSync(path25), options);
|
|
12561
12560
|
}
|
|
12562
12561
|
function checkStat(stat, options) {
|
|
12563
12562
|
return stat.isFile() && checkMode(stat, options);
|
|
@@ -12581,7 +12580,7 @@ var require_mode = __commonJS({
|
|
|
12581
12580
|
// node_modules/isexe/index.js
|
|
12582
12581
|
var require_isexe = __commonJS({
|
|
12583
12582
|
"node_modules/isexe/index.js"(exports, module) {
|
|
12584
|
-
var
|
|
12583
|
+
var fs23 = __require("fs");
|
|
12585
12584
|
var core;
|
|
12586
12585
|
if (process.platform === "win32" || global.TESTING_WINDOWS) {
|
|
12587
12586
|
core = require_windows();
|
|
@@ -12590,7 +12589,7 @@ var require_isexe = __commonJS({
|
|
|
12590
12589
|
}
|
|
12591
12590
|
module.exports = isexe;
|
|
12592
12591
|
isexe.sync = sync;
|
|
12593
|
-
function isexe(
|
|
12592
|
+
function isexe(path25, options, cb) {
|
|
12594
12593
|
if (typeof options === "function") {
|
|
12595
12594
|
cb = options;
|
|
12596
12595
|
options = {};
|
|
@@ -12600,7 +12599,7 @@ var require_isexe = __commonJS({
|
|
|
12600
12599
|
throw new TypeError("callback not provided");
|
|
12601
12600
|
}
|
|
12602
12601
|
return new Promise(function(resolve, reject) {
|
|
12603
|
-
isexe(
|
|
12602
|
+
isexe(path25, options || {}, function(er, is) {
|
|
12604
12603
|
if (er) {
|
|
12605
12604
|
reject(er);
|
|
12606
12605
|
} else {
|
|
@@ -12609,7 +12608,7 @@ var require_isexe = __commonJS({
|
|
|
12609
12608
|
});
|
|
12610
12609
|
});
|
|
12611
12610
|
}
|
|
12612
|
-
core(
|
|
12611
|
+
core(path25, options || {}, function(er, is) {
|
|
12613
12612
|
if (er) {
|
|
12614
12613
|
if (er.code === "EACCES" || options && options.ignoreErrors) {
|
|
12615
12614
|
er = null;
|
|
@@ -12619,9 +12618,9 @@ var require_isexe = __commonJS({
|
|
|
12619
12618
|
cb(er, is);
|
|
12620
12619
|
});
|
|
12621
12620
|
}
|
|
12622
|
-
function sync(
|
|
12621
|
+
function sync(path25, options) {
|
|
12623
12622
|
try {
|
|
12624
|
-
return core.sync(
|
|
12623
|
+
return core.sync(path25, options || {});
|
|
12625
12624
|
} catch (er) {
|
|
12626
12625
|
if (options && options.ignoreErrors || er.code === "EACCES") {
|
|
12627
12626
|
return false;
|
|
@@ -12637,7 +12636,7 @@ var require_isexe = __commonJS({
|
|
|
12637
12636
|
var require_which = __commonJS({
|
|
12638
12637
|
"node_modules/which/which.js"(exports, module) {
|
|
12639
12638
|
var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
12640
|
-
var
|
|
12639
|
+
var path25 = __require("path");
|
|
12641
12640
|
var COLON = isWindows ? ";" : ":";
|
|
12642
12641
|
var isexe = require_isexe();
|
|
12643
12642
|
var getNotFoundError = (cmd) => Object.assign(new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
@@ -12675,7 +12674,7 @@ var require_which = __commonJS({
|
|
|
12675
12674
|
return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
|
|
12676
12675
|
const ppRaw = pathEnv[i];
|
|
12677
12676
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12678
|
-
const pCmd =
|
|
12677
|
+
const pCmd = path25.join(pathPart, cmd);
|
|
12679
12678
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12680
12679
|
resolve(subStep(p, i, 0));
|
|
12681
12680
|
});
|
|
@@ -12702,7 +12701,7 @@ var require_which = __commonJS({
|
|
|
12702
12701
|
for (let i = 0; i < pathEnv.length; i++) {
|
|
12703
12702
|
const ppRaw = pathEnv[i];
|
|
12704
12703
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
12705
|
-
const pCmd =
|
|
12704
|
+
const pCmd = path25.join(pathPart, cmd);
|
|
12706
12705
|
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
12707
12706
|
for (let j = 0; j < pathExt.length; j++) {
|
|
12708
12707
|
const cur = p + pathExt[j];
|
|
@@ -12750,7 +12749,7 @@ var require_path_key = __commonJS({
|
|
|
12750
12749
|
var require_resolveCommand = __commonJS({
|
|
12751
12750
|
"node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module) {
|
|
12752
12751
|
"use strict";
|
|
12753
|
-
var
|
|
12752
|
+
var path25 = __require("path");
|
|
12754
12753
|
var which = require_which();
|
|
12755
12754
|
var getPathKey = require_path_key();
|
|
12756
12755
|
function resolveCommandAttempt(parsed, withoutPathExt) {
|
|
@@ -12768,7 +12767,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12768
12767
|
try {
|
|
12769
12768
|
resolved = which.sync(parsed.command, {
|
|
12770
12769
|
path: env[getPathKey({ env })],
|
|
12771
|
-
pathExt: withoutPathExt ?
|
|
12770
|
+
pathExt: withoutPathExt ? path25.delimiter : void 0
|
|
12772
12771
|
});
|
|
12773
12772
|
} catch (e) {
|
|
12774
12773
|
} finally {
|
|
@@ -12777,7 +12776,7 @@ var require_resolveCommand = __commonJS({
|
|
|
12777
12776
|
}
|
|
12778
12777
|
}
|
|
12779
12778
|
if (resolved) {
|
|
12780
|
-
resolved =
|
|
12779
|
+
resolved = path25.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
|
|
12781
12780
|
}
|
|
12782
12781
|
return resolved;
|
|
12783
12782
|
}
|
|
@@ -12831,8 +12830,8 @@ var require_shebang_command = __commonJS({
|
|
|
12831
12830
|
if (!match) {
|
|
12832
12831
|
return null;
|
|
12833
12832
|
}
|
|
12834
|
-
const [
|
|
12835
|
-
const binary =
|
|
12833
|
+
const [path25, argument] = match[0].replace(/#! ?/, "").split(" ");
|
|
12834
|
+
const binary = path25.split("/").pop();
|
|
12836
12835
|
if (binary === "env") {
|
|
12837
12836
|
return argument;
|
|
12838
12837
|
}
|
|
@@ -12845,16 +12844,16 @@ var require_shebang_command = __commonJS({
|
|
|
12845
12844
|
var require_readShebang = __commonJS({
|
|
12846
12845
|
"node_modules/cross-spawn/lib/util/readShebang.js"(exports, module) {
|
|
12847
12846
|
"use strict";
|
|
12848
|
-
var
|
|
12847
|
+
var fs23 = __require("fs");
|
|
12849
12848
|
var shebangCommand = require_shebang_command();
|
|
12850
12849
|
function readShebang(command) {
|
|
12851
12850
|
const size = 150;
|
|
12852
12851
|
const buffer = Buffer.alloc(size);
|
|
12853
12852
|
let fd;
|
|
12854
12853
|
try {
|
|
12855
|
-
fd =
|
|
12856
|
-
|
|
12857
|
-
|
|
12854
|
+
fd = fs23.openSync(command, "r");
|
|
12855
|
+
fs23.readSync(fd, buffer, 0, size, 0);
|
|
12856
|
+
fs23.closeSync(fd);
|
|
12858
12857
|
} catch (e) {
|
|
12859
12858
|
}
|
|
12860
12859
|
return shebangCommand(buffer.toString());
|
|
@@ -12867,7 +12866,7 @@ var require_readShebang = __commonJS({
|
|
|
12867
12866
|
var require_parse = __commonJS({
|
|
12868
12867
|
"node_modules/cross-spawn/lib/parse.js"(exports, module) {
|
|
12869
12868
|
"use strict";
|
|
12870
|
-
var
|
|
12869
|
+
var path25 = __require("path");
|
|
12871
12870
|
var resolveCommand = require_resolveCommand();
|
|
12872
12871
|
var escape2 = require_escape();
|
|
12873
12872
|
var readShebang = require_readShebang();
|
|
@@ -12892,7 +12891,7 @@ var require_parse = __commonJS({
|
|
|
12892
12891
|
const needsShell = !isExecutableRegExp.test(commandFile);
|
|
12893
12892
|
if (parsed.options.forceShell || needsShell) {
|
|
12894
12893
|
const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
|
|
12895
|
-
parsed.command =
|
|
12894
|
+
parsed.command = path25.normalize(parsed.command);
|
|
12896
12895
|
parsed.command = escape2.command(parsed.command);
|
|
12897
12896
|
parsed.args = parsed.args.map((arg) => escape2.argument(arg, needsDoubleEscapeMetaChars));
|
|
12898
12897
|
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
@@ -13015,10 +13014,10 @@ var require_identity = __commonJS({
|
|
|
13015
13014
|
var NODE_TYPE = Symbol.for("yaml.node.type");
|
|
13016
13015
|
var isAlias = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === ALIAS;
|
|
13017
13016
|
var isDocument = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === DOC;
|
|
13018
|
-
var
|
|
13017
|
+
var isMap2 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
|
|
13019
13018
|
var isPair = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === PAIR;
|
|
13020
13019
|
var isScalar = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SCALAR;
|
|
13021
|
-
var
|
|
13020
|
+
var isSeq2 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
|
|
13022
13021
|
function isCollection(node) {
|
|
13023
13022
|
if (node && typeof node === "object")
|
|
13024
13023
|
switch (node[NODE_TYPE]) {
|
|
@@ -13051,11 +13050,11 @@ var require_identity = __commonJS({
|
|
|
13051
13050
|
exports.isAlias = isAlias;
|
|
13052
13051
|
exports.isCollection = isCollection;
|
|
13053
13052
|
exports.isDocument = isDocument;
|
|
13054
|
-
exports.isMap =
|
|
13053
|
+
exports.isMap = isMap2;
|
|
13055
13054
|
exports.isNode = isNode;
|
|
13056
13055
|
exports.isPair = isPair;
|
|
13057
13056
|
exports.isScalar = isScalar;
|
|
13058
|
-
exports.isSeq =
|
|
13057
|
+
exports.isSeq = isSeq2;
|
|
13059
13058
|
}
|
|
13060
13059
|
});
|
|
13061
13060
|
|
|
@@ -13079,17 +13078,17 @@ var require_visit = __commonJS({
|
|
|
13079
13078
|
visit.BREAK = BREAK;
|
|
13080
13079
|
visit.SKIP = SKIP;
|
|
13081
13080
|
visit.REMOVE = REMOVE;
|
|
13082
|
-
function visit_(key, node, visitor,
|
|
13083
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
13081
|
+
function visit_(key, node, visitor, path25) {
|
|
13082
|
+
const ctrl = callVisitor(key, node, visitor, path25);
|
|
13084
13083
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
13085
|
-
replaceNode(key,
|
|
13086
|
-
return visit_(key, ctrl, visitor,
|
|
13084
|
+
replaceNode(key, path25, ctrl);
|
|
13085
|
+
return visit_(key, ctrl, visitor, path25);
|
|
13087
13086
|
}
|
|
13088
13087
|
if (typeof ctrl !== "symbol") {
|
|
13089
13088
|
if (identity.isCollection(node)) {
|
|
13090
|
-
|
|
13089
|
+
path25 = Object.freeze(path25.concat(node));
|
|
13091
13090
|
for (let i = 0; i < node.items.length; ++i) {
|
|
13092
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
13091
|
+
const ci = visit_(i, node.items[i], visitor, path25);
|
|
13093
13092
|
if (typeof ci === "number")
|
|
13094
13093
|
i = ci - 1;
|
|
13095
13094
|
else if (ci === BREAK)
|
|
@@ -13100,13 +13099,13 @@ var require_visit = __commonJS({
|
|
|
13100
13099
|
}
|
|
13101
13100
|
}
|
|
13102
13101
|
} else if (identity.isPair(node)) {
|
|
13103
|
-
|
|
13104
|
-
const ck = visit_("key", node.key, visitor,
|
|
13102
|
+
path25 = Object.freeze(path25.concat(node));
|
|
13103
|
+
const ck = visit_("key", node.key, visitor, path25);
|
|
13105
13104
|
if (ck === BREAK)
|
|
13106
13105
|
return BREAK;
|
|
13107
13106
|
else if (ck === REMOVE)
|
|
13108
13107
|
node.key = null;
|
|
13109
|
-
const cv = visit_("value", node.value, visitor,
|
|
13108
|
+
const cv = visit_("value", node.value, visitor, path25);
|
|
13110
13109
|
if (cv === BREAK)
|
|
13111
13110
|
return BREAK;
|
|
13112
13111
|
else if (cv === REMOVE)
|
|
@@ -13127,17 +13126,17 @@ var require_visit = __commonJS({
|
|
|
13127
13126
|
visitAsync.BREAK = BREAK;
|
|
13128
13127
|
visitAsync.SKIP = SKIP;
|
|
13129
13128
|
visitAsync.REMOVE = REMOVE;
|
|
13130
|
-
async function visitAsync_(key, node, visitor,
|
|
13131
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
13129
|
+
async function visitAsync_(key, node, visitor, path25) {
|
|
13130
|
+
const ctrl = await callVisitor(key, node, visitor, path25);
|
|
13132
13131
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
13133
|
-
replaceNode(key,
|
|
13134
|
-
return visitAsync_(key, ctrl, visitor,
|
|
13132
|
+
replaceNode(key, path25, ctrl);
|
|
13133
|
+
return visitAsync_(key, ctrl, visitor, path25);
|
|
13135
13134
|
}
|
|
13136
13135
|
if (typeof ctrl !== "symbol") {
|
|
13137
13136
|
if (identity.isCollection(node)) {
|
|
13138
|
-
|
|
13137
|
+
path25 = Object.freeze(path25.concat(node));
|
|
13139
13138
|
for (let i = 0; i < node.items.length; ++i) {
|
|
13140
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
13139
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path25);
|
|
13141
13140
|
if (typeof ci === "number")
|
|
13142
13141
|
i = ci - 1;
|
|
13143
13142
|
else if (ci === BREAK)
|
|
@@ -13148,13 +13147,13 @@ var require_visit = __commonJS({
|
|
|
13148
13147
|
}
|
|
13149
13148
|
}
|
|
13150
13149
|
} else if (identity.isPair(node)) {
|
|
13151
|
-
|
|
13152
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
13150
|
+
path25 = Object.freeze(path25.concat(node));
|
|
13151
|
+
const ck = await visitAsync_("key", node.key, visitor, path25);
|
|
13153
13152
|
if (ck === BREAK)
|
|
13154
13153
|
return BREAK;
|
|
13155
13154
|
else if (ck === REMOVE)
|
|
13156
13155
|
node.key = null;
|
|
13157
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
13156
|
+
const cv = await visitAsync_("value", node.value, visitor, path25);
|
|
13158
13157
|
if (cv === BREAK)
|
|
13159
13158
|
return BREAK;
|
|
13160
13159
|
else if (cv === REMOVE)
|
|
@@ -13181,24 +13180,24 @@ var require_visit = __commonJS({
|
|
|
13181
13180
|
}
|
|
13182
13181
|
return visitor;
|
|
13183
13182
|
}
|
|
13184
|
-
function callVisitor(key, node, visitor,
|
|
13183
|
+
function callVisitor(key, node, visitor, path25) {
|
|
13185
13184
|
var _a3, _b, _c, _d, _e;
|
|
13186
13185
|
if (typeof visitor === "function")
|
|
13187
|
-
return visitor(key, node,
|
|
13186
|
+
return visitor(key, node, path25);
|
|
13188
13187
|
if (identity.isMap(node))
|
|
13189
|
-
return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node,
|
|
13188
|
+
return (_a3 = visitor.Map) == null ? void 0 : _a3.call(visitor, key, node, path25);
|
|
13190
13189
|
if (identity.isSeq(node))
|
|
13191
|
-
return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node,
|
|
13190
|
+
return (_b = visitor.Seq) == null ? void 0 : _b.call(visitor, key, node, path25);
|
|
13192
13191
|
if (identity.isPair(node))
|
|
13193
|
-
return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node,
|
|
13192
|
+
return (_c = visitor.Pair) == null ? void 0 : _c.call(visitor, key, node, path25);
|
|
13194
13193
|
if (identity.isScalar(node))
|
|
13195
|
-
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node,
|
|
13194
|
+
return (_d = visitor.Scalar) == null ? void 0 : _d.call(visitor, key, node, path25);
|
|
13196
13195
|
if (identity.isAlias(node))
|
|
13197
|
-
return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node,
|
|
13196
|
+
return (_e = visitor.Alias) == null ? void 0 : _e.call(visitor, key, node, path25);
|
|
13198
13197
|
return void 0;
|
|
13199
13198
|
}
|
|
13200
|
-
function replaceNode(key,
|
|
13201
|
-
const parent =
|
|
13199
|
+
function replaceNode(key, path25, node) {
|
|
13200
|
+
const parent = path25[path25.length - 1];
|
|
13202
13201
|
if (identity.isCollection(parent)) {
|
|
13203
13202
|
parent.items[key] = node;
|
|
13204
13203
|
} else if (identity.isPair(parent)) {
|
|
@@ -13810,10 +13809,10 @@ var require_Collection = __commonJS({
|
|
|
13810
13809
|
var createNode = require_createNode();
|
|
13811
13810
|
var identity = require_identity();
|
|
13812
13811
|
var Node = require_Node();
|
|
13813
|
-
function collectionFromPath(schema,
|
|
13812
|
+
function collectionFromPath(schema, path25, value) {
|
|
13814
13813
|
let v = value;
|
|
13815
|
-
for (let i =
|
|
13816
|
-
const k =
|
|
13814
|
+
for (let i = path25.length - 1; i >= 0; --i) {
|
|
13815
|
+
const k = path25[i];
|
|
13817
13816
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
13818
13817
|
const a = [];
|
|
13819
13818
|
a[k] = v;
|
|
@@ -13832,7 +13831,7 @@ var require_Collection = __commonJS({
|
|
|
13832
13831
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
13833
13832
|
});
|
|
13834
13833
|
}
|
|
13835
|
-
var isEmptyPath = (
|
|
13834
|
+
var isEmptyPath = (path25) => path25 == null || typeof path25 === "object" && !!path25[Symbol.iterator]().next().done;
|
|
13836
13835
|
var Collection = class extends Node.NodeBase {
|
|
13837
13836
|
constructor(type, schema) {
|
|
13838
13837
|
super(type);
|
|
@@ -13862,11 +13861,11 @@ var require_Collection = __commonJS({
|
|
|
13862
13861
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
13863
13862
|
* that already exists in the map.
|
|
13864
13863
|
*/
|
|
13865
|
-
addIn(
|
|
13866
|
-
if (isEmptyPath(
|
|
13864
|
+
addIn(path25, value) {
|
|
13865
|
+
if (isEmptyPath(path25))
|
|
13867
13866
|
this.add(value);
|
|
13868
13867
|
else {
|
|
13869
|
-
const [key, ...rest] =
|
|
13868
|
+
const [key, ...rest] = path25;
|
|
13870
13869
|
const node = this.get(key, true);
|
|
13871
13870
|
if (identity.isCollection(node))
|
|
13872
13871
|
node.addIn(rest, value);
|
|
@@ -13880,8 +13879,8 @@ var require_Collection = __commonJS({
|
|
|
13880
13879
|
* Removes a value from the collection.
|
|
13881
13880
|
* @returns `true` if the item was found and removed.
|
|
13882
13881
|
*/
|
|
13883
|
-
deleteIn(
|
|
13884
|
-
const [key, ...rest] =
|
|
13882
|
+
deleteIn(path25) {
|
|
13883
|
+
const [key, ...rest] = path25;
|
|
13885
13884
|
if (rest.length === 0)
|
|
13886
13885
|
return this.delete(key);
|
|
13887
13886
|
const node = this.get(key, true);
|
|
@@ -13895,8 +13894,8 @@ var require_Collection = __commonJS({
|
|
|
13895
13894
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
13896
13895
|
* `true` (collections are always returned intact).
|
|
13897
13896
|
*/
|
|
13898
|
-
getIn(
|
|
13899
|
-
const [key, ...rest] =
|
|
13897
|
+
getIn(path25, keepScalar) {
|
|
13898
|
+
const [key, ...rest] = path25;
|
|
13900
13899
|
const node = this.get(key, true);
|
|
13901
13900
|
if (rest.length === 0)
|
|
13902
13901
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -13914,8 +13913,8 @@ var require_Collection = __commonJS({
|
|
|
13914
13913
|
/**
|
|
13915
13914
|
* Checks if the collection includes a value with the key `key`.
|
|
13916
13915
|
*/
|
|
13917
|
-
hasIn(
|
|
13918
|
-
const [key, ...rest] =
|
|
13916
|
+
hasIn(path25) {
|
|
13917
|
+
const [key, ...rest] = path25;
|
|
13919
13918
|
if (rest.length === 0)
|
|
13920
13919
|
return this.has(key);
|
|
13921
13920
|
const node = this.get(key, true);
|
|
@@ -13925,8 +13924,8 @@ var require_Collection = __commonJS({
|
|
|
13925
13924
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
13926
13925
|
* boolean to add/remove the item from the set.
|
|
13927
13926
|
*/
|
|
13928
|
-
setIn(
|
|
13929
|
-
const [key, ...rest] =
|
|
13927
|
+
setIn(path25, value) {
|
|
13928
|
+
const [key, ...rest] = path25;
|
|
13930
13929
|
if (rest.length === 0) {
|
|
13931
13930
|
this.set(key, value);
|
|
13932
13931
|
} else {
|
|
@@ -16440,9 +16439,9 @@ var require_Document = __commonJS({
|
|
|
16440
16439
|
this.contents.add(value);
|
|
16441
16440
|
}
|
|
16442
16441
|
/** Adds a value to the document. */
|
|
16443
|
-
addIn(
|
|
16442
|
+
addIn(path25, value) {
|
|
16444
16443
|
if (assertCollection(this.contents))
|
|
16445
|
-
this.contents.addIn(
|
|
16444
|
+
this.contents.addIn(path25, value);
|
|
16446
16445
|
}
|
|
16447
16446
|
/**
|
|
16448
16447
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -16517,14 +16516,14 @@ var require_Document = __commonJS({
|
|
|
16517
16516
|
* Removes a value from the document.
|
|
16518
16517
|
* @returns `true` if the item was found and removed.
|
|
16519
16518
|
*/
|
|
16520
|
-
deleteIn(
|
|
16521
|
-
if (Collection.isEmptyPath(
|
|
16519
|
+
deleteIn(path25) {
|
|
16520
|
+
if (Collection.isEmptyPath(path25)) {
|
|
16522
16521
|
if (this.contents == null)
|
|
16523
16522
|
return false;
|
|
16524
16523
|
this.contents = null;
|
|
16525
16524
|
return true;
|
|
16526
16525
|
}
|
|
16527
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
16526
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path25) : false;
|
|
16528
16527
|
}
|
|
16529
16528
|
/**
|
|
16530
16529
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -16539,10 +16538,10 @@ var require_Document = __commonJS({
|
|
|
16539
16538
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
16540
16539
|
* `true` (collections are always returned intact).
|
|
16541
16540
|
*/
|
|
16542
|
-
getIn(
|
|
16543
|
-
if (Collection.isEmptyPath(
|
|
16541
|
+
getIn(path25, keepScalar) {
|
|
16542
|
+
if (Collection.isEmptyPath(path25))
|
|
16544
16543
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
16545
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
16544
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path25, keepScalar) : void 0;
|
|
16546
16545
|
}
|
|
16547
16546
|
/**
|
|
16548
16547
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -16553,10 +16552,10 @@ var require_Document = __commonJS({
|
|
|
16553
16552
|
/**
|
|
16554
16553
|
* Checks if the document includes a value at `path`.
|
|
16555
16554
|
*/
|
|
16556
|
-
hasIn(
|
|
16557
|
-
if (Collection.isEmptyPath(
|
|
16555
|
+
hasIn(path25) {
|
|
16556
|
+
if (Collection.isEmptyPath(path25))
|
|
16558
16557
|
return this.contents !== void 0;
|
|
16559
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
16558
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path25) : false;
|
|
16560
16559
|
}
|
|
16561
16560
|
/**
|
|
16562
16561
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -16573,13 +16572,13 @@ var require_Document = __commonJS({
|
|
|
16573
16572
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
16574
16573
|
* boolean to add/remove the item from the set.
|
|
16575
16574
|
*/
|
|
16576
|
-
setIn(
|
|
16577
|
-
if (Collection.isEmptyPath(
|
|
16575
|
+
setIn(path25, value) {
|
|
16576
|
+
if (Collection.isEmptyPath(path25)) {
|
|
16578
16577
|
this.contents = value;
|
|
16579
16578
|
} else if (this.contents == null) {
|
|
16580
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
16579
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path25), value);
|
|
16581
16580
|
} else if (assertCollection(this.contents)) {
|
|
16582
|
-
this.contents.setIn(
|
|
16581
|
+
this.contents.setIn(path25, value);
|
|
16583
16582
|
}
|
|
16584
16583
|
}
|
|
16585
16584
|
/**
|
|
@@ -17165,9 +17164,9 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17165
17164
|
var isBlock = (token) => token && (token.type === "block-map" || token.type === "block-seq");
|
|
17166
17165
|
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
17167
17166
|
var _a3;
|
|
17168
|
-
const
|
|
17169
|
-
const fcName =
|
|
17170
|
-
const NodeClass = (tag == null ? void 0 : tag.nodeClass) ?? (
|
|
17167
|
+
const isMap2 = fc.start.source === "{";
|
|
17168
|
+
const fcName = isMap2 ? "flow map" : "flow sequence";
|
|
17169
|
+
const NodeClass = (tag == null ? void 0 : tag.nodeClass) ?? (isMap2 ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
|
|
17171
17170
|
const coll = new NodeClass(ctx.schema);
|
|
17172
17171
|
coll.flow = true;
|
|
17173
17172
|
const atRoot = ctx.atRoot;
|
|
@@ -17203,7 +17202,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17203
17202
|
offset = props.end;
|
|
17204
17203
|
continue;
|
|
17205
17204
|
}
|
|
17206
|
-
if (!
|
|
17205
|
+
if (!isMap2 && ctx.options.strict && utilContainsNewline.containsNewline(key))
|
|
17207
17206
|
onError(
|
|
17208
17207
|
key,
|
|
17209
17208
|
// checked by containsNewline()
|
|
@@ -17243,7 +17242,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17243
17242
|
}
|
|
17244
17243
|
}
|
|
17245
17244
|
}
|
|
17246
|
-
if (!
|
|
17245
|
+
if (!isMap2 && !sep && !props.found) {
|
|
17247
17246
|
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep, null, props, onError);
|
|
17248
17247
|
coll.items.push(valueNode);
|
|
17249
17248
|
offset = valueNode.range[2];
|
|
@@ -17266,7 +17265,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17266
17265
|
startOnNewline: false
|
|
17267
17266
|
});
|
|
17268
17267
|
if (valueProps.found) {
|
|
17269
|
-
if (!
|
|
17268
|
+
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
17270
17269
|
if (sep)
|
|
17271
17270
|
for (const st of sep) {
|
|
17272
17271
|
if (st === valueProps.found)
|
|
@@ -17298,7 +17297,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17298
17297
|
const pair = new Pair.Pair(keyNode, valueNode);
|
|
17299
17298
|
if (ctx.options.keepSourceTokens)
|
|
17300
17299
|
pair.srcToken = collItem;
|
|
17301
|
-
if (
|
|
17300
|
+
if (isMap2) {
|
|
17302
17301
|
const map2 = coll;
|
|
17303
17302
|
if (utilMapIncludes.mapIncludes(ctx, map2.items, keyNode))
|
|
17304
17303
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
@@ -17314,7 +17313,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
17314
17313
|
offset = valueNode ? valueNode.range[2] : valueProps.end;
|
|
17315
17314
|
}
|
|
17316
17315
|
}
|
|
17317
|
-
const expectedEnd =
|
|
17316
|
+
const expectedEnd = isMap2 ? "}" : "]";
|
|
17318
17317
|
const [ce, ...ee] = fc.end;
|
|
17319
17318
|
let cePos = offset;
|
|
17320
17319
|
if ((ce == null ? void 0 : ce.source) === expectedEnd)
|
|
@@ -18542,9 +18541,9 @@ var require_cst_visit = __commonJS({
|
|
|
18542
18541
|
visit.BREAK = BREAK;
|
|
18543
18542
|
visit.SKIP = SKIP;
|
|
18544
18543
|
visit.REMOVE = REMOVE;
|
|
18545
|
-
visit.itemAtPath = (cst,
|
|
18544
|
+
visit.itemAtPath = (cst, path25) => {
|
|
18546
18545
|
let item = cst;
|
|
18547
|
-
for (const [field, index] of
|
|
18546
|
+
for (const [field, index] of path25) {
|
|
18548
18547
|
const tok = item == null ? void 0 : item[field];
|
|
18549
18548
|
if (tok && "items" in tok) {
|
|
18550
18549
|
item = tok.items[index];
|
|
@@ -18553,23 +18552,23 @@ var require_cst_visit = __commonJS({
|
|
|
18553
18552
|
}
|
|
18554
18553
|
return item;
|
|
18555
18554
|
};
|
|
18556
|
-
visit.parentCollection = (cst,
|
|
18557
|
-
const parent = visit.itemAtPath(cst,
|
|
18558
|
-
const field =
|
|
18555
|
+
visit.parentCollection = (cst, path25) => {
|
|
18556
|
+
const parent = visit.itemAtPath(cst, path25.slice(0, -1));
|
|
18557
|
+
const field = path25[path25.length - 1][0];
|
|
18559
18558
|
const coll = parent == null ? void 0 : parent[field];
|
|
18560
18559
|
if (coll && "items" in coll)
|
|
18561
18560
|
return coll;
|
|
18562
18561
|
throw new Error("Parent collection not found");
|
|
18563
18562
|
};
|
|
18564
|
-
function _visit(
|
|
18565
|
-
let ctrl = visitor(item,
|
|
18563
|
+
function _visit(path25, item, visitor) {
|
|
18564
|
+
let ctrl = visitor(item, path25);
|
|
18566
18565
|
if (typeof ctrl === "symbol")
|
|
18567
18566
|
return ctrl;
|
|
18568
18567
|
for (const field of ["key", "value"]) {
|
|
18569
18568
|
const token = item[field];
|
|
18570
18569
|
if (token && "items" in token) {
|
|
18571
18570
|
for (let i = 0; i < token.items.length; ++i) {
|
|
18572
|
-
const ci = _visit(Object.freeze(
|
|
18571
|
+
const ci = _visit(Object.freeze(path25.concat([[field, i]])), token.items[i], visitor);
|
|
18573
18572
|
if (typeof ci === "number")
|
|
18574
18573
|
i = ci - 1;
|
|
18575
18574
|
else if (ci === BREAK)
|
|
@@ -18580,10 +18579,10 @@ var require_cst_visit = __commonJS({
|
|
|
18580
18579
|
}
|
|
18581
18580
|
}
|
|
18582
18581
|
if (typeof ctrl === "function" && field === "key")
|
|
18583
|
-
ctrl = ctrl(item,
|
|
18582
|
+
ctrl = ctrl(item, path25);
|
|
18584
18583
|
}
|
|
18585
18584
|
}
|
|
18586
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
18585
|
+
return typeof ctrl === "function" ? ctrl(item, path25) : ctrl;
|
|
18587
18586
|
}
|
|
18588
18587
|
exports.visit = visit;
|
|
18589
18588
|
}
|
|
@@ -19870,14 +19869,14 @@ var require_parser = __commonJS({
|
|
|
19870
19869
|
case "scalar":
|
|
19871
19870
|
case "single-quoted-scalar":
|
|
19872
19871
|
case "double-quoted-scalar": {
|
|
19873
|
-
const
|
|
19872
|
+
const fs23 = this.flowScalar(this.type);
|
|
19874
19873
|
if (atNextItem || it.value) {
|
|
19875
|
-
map2.items.push({ start, key:
|
|
19874
|
+
map2.items.push({ start, key: fs23, sep: [] });
|
|
19876
19875
|
this.onKeyLine = true;
|
|
19877
19876
|
} else if (it.sep) {
|
|
19878
|
-
this.stack.push(
|
|
19877
|
+
this.stack.push(fs23);
|
|
19879
19878
|
} else {
|
|
19880
|
-
Object.assign(it, { key:
|
|
19879
|
+
Object.assign(it, { key: fs23, sep: [] });
|
|
19881
19880
|
this.onKeyLine = true;
|
|
19882
19881
|
}
|
|
19883
19882
|
return;
|
|
@@ -20006,13 +20005,13 @@ var require_parser = __commonJS({
|
|
|
20006
20005
|
case "scalar":
|
|
20007
20006
|
case "single-quoted-scalar":
|
|
20008
20007
|
case "double-quoted-scalar": {
|
|
20009
|
-
const
|
|
20008
|
+
const fs23 = this.flowScalar(this.type);
|
|
20010
20009
|
if (!it || it.value)
|
|
20011
|
-
fc.items.push({ start: [], key:
|
|
20010
|
+
fc.items.push({ start: [], key: fs23, sep: [] });
|
|
20012
20011
|
else if (it.sep)
|
|
20013
|
-
this.stack.push(
|
|
20012
|
+
this.stack.push(fs23);
|
|
20014
20013
|
else
|
|
20015
|
-
Object.assign(it, { key:
|
|
20014
|
+
Object.assign(it, { key: fs23, sep: [] });
|
|
20016
20015
|
return;
|
|
20017
20016
|
}
|
|
20018
20017
|
case "flow-map-end":
|
|
@@ -20201,7 +20200,7 @@ var require_public_api = __commonJS({
|
|
|
20201
20200
|
return docs;
|
|
20202
20201
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
20203
20202
|
}
|
|
20204
|
-
function
|
|
20203
|
+
function parseDocument2(source, options = {}) {
|
|
20205
20204
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
20206
20205
|
const parser$1 = new parser.Parser(lineCounter2 == null ? void 0 : lineCounter2.addNewLine);
|
|
20207
20206
|
const composer$1 = new composer.Composer(options);
|
|
@@ -20227,7 +20226,7 @@ var require_public_api = __commonJS({
|
|
|
20227
20226
|
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
20228
20227
|
options = reviver;
|
|
20229
20228
|
}
|
|
20230
|
-
const doc =
|
|
20229
|
+
const doc = parseDocument2(src, options);
|
|
20231
20230
|
if (!doc)
|
|
20232
20231
|
return null;
|
|
20233
20232
|
doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
|
|
@@ -20263,7 +20262,7 @@ var require_public_api = __commonJS({
|
|
|
20263
20262
|
}
|
|
20264
20263
|
exports.parse = parse3;
|
|
20265
20264
|
exports.parseAllDocuments = parseAllDocuments;
|
|
20266
|
-
exports.parseDocument =
|
|
20265
|
+
exports.parseDocument = parseDocument2;
|
|
20267
20266
|
exports.stringify = stringify;
|
|
20268
20267
|
}
|
|
20269
20268
|
});
|
|
@@ -20685,8 +20684,8 @@ function getErrorMap() {
|
|
|
20685
20684
|
|
|
20686
20685
|
// node_modules/zod/v3/helpers/parseUtil.js
|
|
20687
20686
|
var makeIssue = (params) => {
|
|
20688
|
-
const { data, path:
|
|
20689
|
-
const fullPath = [...
|
|
20687
|
+
const { data, path: path25, errorMaps, issueData } = params;
|
|
20688
|
+
const fullPath = [...path25, ...issueData.path || []];
|
|
20690
20689
|
const fullIssue = {
|
|
20691
20690
|
...issueData,
|
|
20692
20691
|
path: fullPath
|
|
@@ -20801,11 +20800,11 @@ var errorUtil;
|
|
|
20801
20800
|
|
|
20802
20801
|
// node_modules/zod/v3/types.js
|
|
20803
20802
|
var ParseInputLazyPath = class {
|
|
20804
|
-
constructor(parent, value,
|
|
20803
|
+
constructor(parent, value, path25, key) {
|
|
20805
20804
|
this._cachedPath = [];
|
|
20806
20805
|
this.parent = parent;
|
|
20807
20806
|
this.data = value;
|
|
20808
|
-
this._path =
|
|
20807
|
+
this._path = path25;
|
|
20809
20808
|
this._key = key;
|
|
20810
20809
|
}
|
|
20811
20810
|
get path() {
|
|
@@ -24454,10 +24453,10 @@ function mergeDefs(...defs) {
|
|
|
24454
24453
|
function cloneDef(schema) {
|
|
24455
24454
|
return mergeDefs(schema._zod.def);
|
|
24456
24455
|
}
|
|
24457
|
-
function getElementAtPath(obj,
|
|
24458
|
-
if (!
|
|
24456
|
+
function getElementAtPath(obj, path25) {
|
|
24457
|
+
if (!path25)
|
|
24459
24458
|
return obj;
|
|
24460
|
-
return
|
|
24459
|
+
return path25.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
24461
24460
|
}
|
|
24462
24461
|
function promiseAllObject(promisesObj) {
|
|
24463
24462
|
const keys = Object.keys(promisesObj);
|
|
@@ -24842,11 +24841,11 @@ function aborted(x, startIndex = 0) {
|
|
|
24842
24841
|
}
|
|
24843
24842
|
return false;
|
|
24844
24843
|
}
|
|
24845
|
-
function prefixIssues(
|
|
24844
|
+
function prefixIssues(path25, issues) {
|
|
24846
24845
|
return issues.map((iss) => {
|
|
24847
24846
|
var _a3;
|
|
24848
24847
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
24849
|
-
iss.path.unshift(
|
|
24848
|
+
iss.path.unshift(path25);
|
|
24850
24849
|
return iss;
|
|
24851
24850
|
});
|
|
24852
24851
|
}
|
|
@@ -36682,7 +36681,7 @@ function createMakerAgentsPolicyBody() {
|
|
|
36682
36681
|
" `mcp report --ide <client> --target-dir <project> --context-stdin --consent --json`.",
|
|
36683
36682
|
"- This preserves the configured package version and the absolute Windows node.exe/npm-cli.js.",
|
|
36684
36683
|
"- Only with a known exact installed version, fallback to",
|
|
36685
|
-
" `npx -y --package @taptap/maker@0.0.
|
|
36684
|
+
" `npx -y --package @taptap/maker@0.0.32-beta.1 taptap-maker mcp report ...`.",
|
|
36686
36685
|
"- Never use an unversioned npm package, or assume `taptap-maker`/`npx` is globally available.",
|
|
36687
36686
|
"- Never include the complete conversation, project source, other MCP server entries, PAT/token",
|
|
36688
36687
|
" values, or full environment variables. Normalize the user home path to `~`.",
|
|
@@ -37890,12 +37889,12 @@ function getBlockingRemoteSyncFailure(status) {
|
|
|
37890
37889
|
};
|
|
37891
37890
|
}
|
|
37892
37891
|
function includeMandatoryMakerSubmitFiles(cwd, files) {
|
|
37893
|
-
const
|
|
37892
|
+
const unique = new Set(files);
|
|
37894
37893
|
const changedFiles = parseGitStatusFiles(readGitSync(["-C", cwd, "status", "--porcelain", "-z"]));
|
|
37895
37894
|
if (changedFiles.includes(".gitignore")) {
|
|
37896
|
-
|
|
37895
|
+
unique.add(".gitignore");
|
|
37897
37896
|
}
|
|
37898
|
-
return [...
|
|
37897
|
+
return [...unique];
|
|
37899
37898
|
}
|
|
37900
37899
|
async function readMakerProjectLocalChanges(cwd) {
|
|
37901
37900
|
ensureGitAvailable();
|
|
@@ -39684,35 +39683,9 @@ function saveLuaLspRuntimeConfig(environment) {
|
|
|
39684
39683
|
import fs10 from "node:fs";
|
|
39685
39684
|
import path11 from "node:path";
|
|
39686
39685
|
import { fileURLToPath } from "node:url";
|
|
39687
|
-
|
|
39688
|
-
// src/maker/pluginDistribution.ts
|
|
39689
|
-
function hasMakerPluginDistribution(distribution = process.env.TAPTAP_MAKER_DISTRIBUTION) {
|
|
39690
|
-
return Boolean(distribution == null ? void 0 : distribution.trim());
|
|
39691
|
-
}
|
|
39692
|
-
function resolveMakerPluginDistribution(distribution = process.env.TAPTAP_MAKER_DISTRIBUTION) {
|
|
39693
|
-
if (distribution === "codex_plugin") {
|
|
39694
|
-
return { id: distribution, client: "codex", displayName: "Codex" };
|
|
39695
|
-
}
|
|
39696
|
-
if (distribution === "workbuddy_plugin") {
|
|
39697
|
-
return { id: distribution, client: "workbuddy", displayName: "WorkBuddy" };
|
|
39698
|
-
}
|
|
39699
|
-
if (distribution === "dsh_plugin") {
|
|
39700
|
-
return { id: distribution, client: "dsh", displayName: "DSH" };
|
|
39701
|
-
}
|
|
39702
|
-
return void 0;
|
|
39703
|
-
}
|
|
39704
|
-
function formatMakerPluginUpdateAction(distribution) {
|
|
39705
|
-
if (distribution.client === "dsh") {
|
|
39706
|
-
return "Update the installed DSH plugin via `dsh plugin --profile <profile> update @taptap/dsh-maker`; do not install or upgrade the standalone npm package.";
|
|
39707
|
-
}
|
|
39708
|
-
return `Update the installed ${distribution.displayName} plugin through its marketplace; do not install or upgrade the standalone npm package.`;
|
|
39709
|
-
}
|
|
39710
|
-
|
|
39711
|
-
// src/maker/cli/skill.ts
|
|
39712
39686
|
var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
|
|
39713
39687
|
var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
|
|
39714
39688
|
var UPDATE_TAPTAP_MCP_SKILL_NAME = "update-taptap-mcp";
|
|
39715
|
-
var MAKER_PLUGIN_LIFECYCLE_SKILL_NAME = "taptap-maker-plugin-lifecycle";
|
|
39716
39689
|
var BUNDLED_SKILLS = [
|
|
39717
39690
|
{
|
|
39718
39691
|
name: MAKER_LOCAL_SKILL_NAME
|
|
@@ -39725,10 +39698,7 @@ var BUNDLED_SKILLS = [
|
|
|
39725
39698
|
}
|
|
39726
39699
|
];
|
|
39727
39700
|
function formatMakerSkillStatus(_options = {}) {
|
|
39728
|
-
const
|
|
39729
|
-
const clientPluginDistribution = pluginDistribution && pluginDistribution.client !== "dsh" ? pluginDistribution : void 0;
|
|
39730
|
-
const bundledSkills = clientPluginDistribution ? [...BUNDLED_SKILLS, { name: MAKER_PLUGIN_LIFECYCLE_SKILL_NAME }] : BUNDLED_SKILLS;
|
|
39731
|
-
const skillDocuments = bundledSkills.map((skill) => ({
|
|
39701
|
+
const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
|
|
39732
39702
|
name: skill.name,
|
|
39733
39703
|
path: path11.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
|
|
39734
39704
|
}));
|
|
@@ -39738,27 +39708,6 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
39738
39708
|
...skillDocuments.map((skill) => `- ${skill.name}: ${skill.path}`),
|
|
39739
39709
|
"",
|
|
39740
39710
|
"Use these documents as reading references for Maker local workflows.",
|
|
39741
|
-
...clientPluginDistribution ? [
|
|
39742
|
-
"",
|
|
39743
|
-
`Maker ${clientPluginDistribution.displayName} plugin lifecycle`,
|
|
39744
|
-
`- entry: ${MAKER_PLUGIN_LIFECYCLE_SKILL_NAME}`,
|
|
39745
|
-
`- Inspect a legacy ${clientPluginDistribution.displayName} Maker MCP registration before first use.`,
|
|
39746
|
-
...clientPluginDistribution.client === "codex" ? [
|
|
39747
|
-
"- Automatically disable an active legacy Codex Maker MCP; the plugin installation request is the authorization.",
|
|
39748
|
-
"- Verify the legacy registration is disabled or absent before reporting the plugin ready.",
|
|
39749
|
-
"- Require explicit confirmation only when restoring the old MCP during plugin removal."
|
|
39750
|
-
] : ["- Require explicit confirmation before disabling or restoring it."],
|
|
39751
|
-
"- Initialize with `taptap-maker init --skip-mcp-install`; the plugin already provides MCP.",
|
|
39752
|
-
`- ${formatMakerPluginUpdateAction(clientPluginDistribution)}`
|
|
39753
|
-
] : [],
|
|
39754
|
-
...(pluginDistribution == null ? void 0 : pluginDistribution.client) === "dsh" ? [
|
|
39755
|
-
"",
|
|
39756
|
-
"Maker DSH plugin lifecycle",
|
|
39757
|
-
"- Inspect a legacy DSH L1 MCP registration with `taptap-maker plugin inspect --client dsh` before first use.",
|
|
39758
|
-
"- Migrate/disable it with `taptap-maker plugin migrate --client dsh --confirm`; restore with `taptap-maker plugin restore --client dsh --confirm`.",
|
|
39759
|
-
"- Initialize with `taptap-maker init --skip-mcp-install`; the DSH plugin already provides MCP.",
|
|
39760
|
-
`- ${formatMakerPluginUpdateAction(pluginDistribution)}`
|
|
39761
|
-
] : [],
|
|
39762
39711
|
"",
|
|
39763
39712
|
"Maker Git workflow policy",
|
|
39764
39713
|
`- entry: ${MAKER_LOCAL_SKILL_NAME} > Maker Git Workflow Policy`,
|
|
@@ -39804,7 +39753,7 @@ function formatMakerSkillStatus(_options = {}) {
|
|
|
39804
39753
|
" mcp report --ide <client> --target-dir <project> --context-stdin --consent --json",
|
|
39805
39754
|
"- Never use an unversioned npm package; preserve the configured version and Windows absolute launcher.",
|
|
39806
39755
|
"- A manual_required result never blocks troubleshooting or the original Maker task.",
|
|
39807
|
-
|
|
39756
|
+
"Maker initialization next_step: execute `taptap-maker init`.",
|
|
39808
39757
|
"Load these documents when the current AI client supports reading local guide files."
|
|
39809
39758
|
].join("\n");
|
|
39810
39759
|
}
|
|
@@ -40278,9 +40227,6 @@ function decideMakerPackageUpdate(currentVersion, policy) {
|
|
|
40278
40227
|
async function checkMakerPackageUpdate(options) {
|
|
40279
40228
|
const now = options.now ?? /* @__PURE__ */ new Date();
|
|
40280
40229
|
const currentVersion = options.currentVersion;
|
|
40281
|
-
if (hasMakerPluginDistribution()) {
|
|
40282
|
-
return buildPluginManagedStatus(currentVersion);
|
|
40283
|
-
}
|
|
40284
40230
|
if (currentVersion === "dev") {
|
|
40285
40231
|
return {
|
|
40286
40232
|
status: "skipped",
|
|
@@ -40339,9 +40285,6 @@ async function checkMakerPackageUpdate(options) {
|
|
|
40339
40285
|
async function getMakerPackageUpdateStatus(options) {
|
|
40340
40286
|
var _a3, _b;
|
|
40341
40287
|
const currentVersion = options.currentVersion;
|
|
40342
|
-
if (hasMakerPluginDistribution()) {
|
|
40343
|
-
return buildPluginManagedStatus(currentVersion);
|
|
40344
|
-
}
|
|
40345
40288
|
if (currentVersion === "dev") {
|
|
40346
40289
|
return {
|
|
40347
40290
|
status: "skipped",
|
|
@@ -40393,9 +40336,6 @@ async function getMakerPackageUpdateStatus(options) {
|
|
|
40393
40336
|
}
|
|
40394
40337
|
var backgroundCheck;
|
|
40395
40338
|
function startMakerPackageUpdateCheck(options) {
|
|
40396
|
-
if (hasMakerPluginDistribution()) {
|
|
40397
|
-
return;
|
|
40398
|
-
}
|
|
40399
40339
|
const key = `${options.currentVersion}
|
|
40400
40340
|
${resolvePolicyUrl(options.policyUrl)}`;
|
|
40401
40341
|
if ((backgroundCheck == null ? void 0 : backgroundCheck.key) === key) {
|
|
@@ -40429,7 +40369,7 @@ function formatMakerPackageUpdateStatus(status) {
|
|
|
40429
40369
|
}
|
|
40430
40370
|
if (status.blacklist_match) {
|
|
40431
40371
|
lines.push(`- blacklist_match: ${status.blacklist_match}`);
|
|
40432
|
-
} else if (status.status !== "skipped"
|
|
40372
|
+
} else if (status.status !== "skipped") {
|
|
40433
40373
|
lines.push("- blacklist_match: no");
|
|
40434
40374
|
}
|
|
40435
40375
|
if (status.checked_at) {
|
|
@@ -40458,13 +40398,6 @@ function formatMakerPackageUpdateStatus(status) {
|
|
|
40458
40398
|
}
|
|
40459
40399
|
return lines.join("\n");
|
|
40460
40400
|
}
|
|
40461
|
-
function buildPluginManagedStatus(currentVersion) {
|
|
40462
|
-
return {
|
|
40463
|
-
status: "managed_by_plugin",
|
|
40464
|
-
current_version: currentVersion,
|
|
40465
|
-
restart_required: false
|
|
40466
|
-
};
|
|
40467
|
-
}
|
|
40468
40401
|
function formatUnavailableNonBlockingError(previousError, backgroundRefresh) {
|
|
40469
40402
|
if (backgroundRefresh) {
|
|
40470
40403
|
return previousError ? `${previousError}; background retry started.` : "Maker package version check is running in the background.";
|
|
@@ -41436,7 +41369,7 @@ import { randomUUID as randomUUID2 } from "node:crypto";
|
|
|
41436
41369
|
// src/maker/server/diagnosticRedaction.ts
|
|
41437
41370
|
function isSensitiveDiagnosticKey(key) {
|
|
41438
41371
|
const normalized = key.replace(/[-\s]/gu, "_").toLowerCase();
|
|
41439
|
-
return /(?:^|_)(?:authorization|cookie|password|passwd|passphrase|pat|token|secret
|
|
41372
|
+
return /(?:^|_)(?:authorization|cookie|password|passwd|passphrase|pat|token|secret)$/u.test(
|
|
41440
41373
|
normalized
|
|
41441
41374
|
) || /(?:^|_)(?:access|refresh|id|api|auth|bearer|personal_access)?_?token$/u.test(normalized) || /(?:^|_)(?:client|app|api|mac)?_?secret$/u.test(normalized) || /(?:^|_)(?:api|auth|mac|private)?_?key$/u.test(normalized) || /(?:^|_)pat$/u.test(normalized);
|
|
41442
41375
|
}
|
|
@@ -41478,10 +41411,10 @@ function sanitizeDiagnosticText(value) {
|
|
|
41478
41411
|
} catch {
|
|
41479
41412
|
}
|
|
41480
41413
|
return value.replace(/\b(authorization|cookie)\b\s*:\s*[^\r\n]*/giu, "$1: <redacted>").replace(
|
|
41481
|
-
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|
|
|
41414
|
+
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key))\s+(?:"[^"]*"|'[^']*'|[^\s,;]+)/gimu,
|
|
41482
41415
|
"$1$2 <redacted>"
|
|
41483
41416
|
).replace(
|
|
41484
|
-
/\b((?:[A-Za-z][A-Za-z0-9_-]*[_-])?(?:authorization|cookie|password|passwd|passphrase|pat|token|secret|
|
|
41417
|
+
/\b((?:[A-Za-z][A-Za-z0-9_-]*[_-])?(?:authorization|cookie|password|passwd|passphrase|pat|token|secret|(?:api|auth|mac|private)[_-]?key))\b\s*[:=]\s*(?:"[^"]*"|'[^']*'|[^\s,;&]+)/giu,
|
|
41485
41418
|
"$1=<redacted>"
|
|
41486
41419
|
).replace(/\bBearer\s+[A-Za-z0-9._~+/=-]{16,}(?=$|[\s,;'"()\x5B\x5D{}])/giu, "Bearer <redacted>").replace(/\beyJ[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+){2}\b/gu, "<redacted>");
|
|
41487
41420
|
}
|
|
@@ -44419,7 +44352,7 @@ function applyDefaults(config2) {
|
|
|
44419
44352
|
var MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
|
|
44420
44353
|
var MAKER_MCP_TRACKING_SOURCE = "local_mcp";
|
|
44421
44354
|
var MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
|
|
44422
|
-
var MAKER_MCP_VERSION = "0.0.
|
|
44355
|
+
var MAKER_MCP_VERSION = "0.0.32-beta.1".trim() ? "0.0.32-beta.1".trim() : "dev";
|
|
44423
44356
|
var TRACKING_ERROR_MAX_LENGTH = 500;
|
|
44424
44357
|
function buildMakerMcpTrackingPayload(event) {
|
|
44425
44358
|
var _a3, _b, _c;
|
|
@@ -44732,7 +44665,7 @@ function createMakerRemoteProxyManager(options = {}) {
|
|
|
44732
44665
|
}
|
|
44733
44666
|
|
|
44734
44667
|
// src/maker/server/mcp.ts
|
|
44735
|
-
var VERSION = true ? "0.0.
|
|
44668
|
+
var VERSION = true ? "0.0.32-beta.1" : "dev";
|
|
44736
44669
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
44737
44670
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
44738
44671
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -45419,8 +45352,6 @@ function installMakerServerExitHandlers(remoteProxyManager) {
|
|
|
45419
45352
|
async function formatStatus(options = {}) {
|
|
45420
45353
|
var _a3;
|
|
45421
45354
|
const detail = options.detail === true;
|
|
45422
|
-
const distribution = process.env.TAPTAP_MAKER_DISTRIBUTION;
|
|
45423
|
-
const pluginDistribution = resolveMakerPluginDistribution(distribution);
|
|
45424
45355
|
const projectContext = await resolveMakerProjectContext({
|
|
45425
45356
|
targetDir: options.targetDir,
|
|
45426
45357
|
listClientRoots: options.listClientRoots,
|
|
@@ -45443,7 +45374,7 @@ async function formatStatus(options = {}) {
|
|
|
45443
45374
|
allowRemoteFetch: false,
|
|
45444
45375
|
...detail ? {} : { backgroundRefresh: false }
|
|
45445
45376
|
});
|
|
45446
|
-
const packageUpdateText = detail ?
|
|
45377
|
+
const packageUpdateText = detail ? formatMakerPackageUpdateStatus(packageUpdateStatus) : "";
|
|
45447
45378
|
const projectInitialization = identify.projectRoot ? inspectMakerProjectInitialization(identify.projectRoot) : void 0;
|
|
45448
45379
|
const projectHealth = identify.projectRoot ? inspectMakerProjectHealth(identify.projectRoot, "status") : void 0;
|
|
45449
45380
|
const projectInitializationText = projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "";
|
|
@@ -45479,9 +45410,8 @@ async function formatStatus(options = {}) {
|
|
|
45479
45410
|
`- lua_lsp: ${luaLsp.status}`,
|
|
45480
45411
|
"Maker MCP package update",
|
|
45481
45412
|
`- status: ${packageUpdateStatus.status}`,
|
|
45482
|
-
pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
|
|
45483
45413
|
packageUpdateStatus.target_version ? `- target_version: ${packageUpdateStatus.target_version}` : "",
|
|
45484
|
-
|
|
45414
|
+
packageUpdateStatus.next_action ? `- next_action: ${packageUpdateStatus.next_action}` : "",
|
|
45485
45415
|
projectInitialization ? `- project_initialization: ${projectInitialization.status}` : "",
|
|
45486
45416
|
projectHealth ? `- project_health: ${projectHealth.status}` : "",
|
|
45487
45417
|
formatMakerClientRootsSummary(projectContext.roots),
|
|
@@ -45507,7 +45437,6 @@ async function formatStatus(options = {}) {
|
|
|
45507
45437
|
"TapTap Maker MCP status",
|
|
45508
45438
|
"",
|
|
45509
45439
|
`- version: ${VERSION}`,
|
|
45510
|
-
pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
|
|
45511
45440
|
`- env: ${env}`,
|
|
45512
45441
|
`- project_context_source: ${projectContext.source}`,
|
|
45513
45442
|
summaryText
|
|
@@ -45517,7 +45446,6 @@ async function formatStatus(options = {}) {
|
|
|
45517
45446
|
"TapTap Maker MCP status",
|
|
45518
45447
|
"",
|
|
45519
45448
|
`- version: ${VERSION}`,
|
|
45520
|
-
pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
|
|
45521
45449
|
`- env: ${env}`,
|
|
45522
45450
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
45523
45451
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
@@ -45578,21 +45506,6 @@ async function formatStatus(options = {}) {
|
|
|
45578
45506
|
projectSection
|
|
45579
45507
|
].filter(Boolean).join("\n");
|
|
45580
45508
|
}
|
|
45581
|
-
function formatMakerPackageUpdateStatusForDistribution(status, distribution) {
|
|
45582
|
-
const formatted = formatMakerPackageUpdateStatus(status);
|
|
45583
|
-
const pluginDistribution = resolveMakerPluginDistribution(distribution);
|
|
45584
|
-
if (!pluginDistribution) {
|
|
45585
|
-
return formatted;
|
|
45586
|
-
}
|
|
45587
|
-
const lines = [
|
|
45588
|
-
...formatted.split("\n").filter((line) => !line.startsWith("- next_action:")),
|
|
45589
|
-
`- distribution: ${pluginDistribution.id}`
|
|
45590
|
-
];
|
|
45591
|
-
if (status.status !== "managed_by_plugin") {
|
|
45592
|
-
lines.push(`- next_action: ${formatMakerPluginUpdateAction(pluginDistribution)}`);
|
|
45593
|
-
}
|
|
45594
|
-
return lines.join("\n");
|
|
45595
|
-
}
|
|
45596
45509
|
function formatAuthNextStep(options) {
|
|
45597
45510
|
if (!options.hasTapAuth) {
|
|
45598
45511
|
if (options.hasPat) {
|
|
@@ -47541,10 +47454,10 @@ function indent2(value) {
|
|
|
47541
47454
|
|
|
47542
47455
|
// src/maker/cli/commands.ts
|
|
47543
47456
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
47544
|
-
import
|
|
47545
|
-
import
|
|
47546
|
-
import
|
|
47547
|
-
import
|
|
47457
|
+
import crypto3 from "node:crypto";
|
|
47458
|
+
import fs21 from "node:fs";
|
|
47459
|
+
import os6 from "node:os";
|
|
47460
|
+
import path22 from "node:path";
|
|
47548
47461
|
import readline from "node:readline/promises";
|
|
47549
47462
|
import { stdin as input, stdout as output } from "node:process";
|
|
47550
47463
|
import { pathToFileURL } from "node:url";
|
|
@@ -47969,7 +47882,6 @@ import { spawnSync as spawnSync7 } from "node:child_process";
|
|
|
47969
47882
|
import fs20 from "node:fs";
|
|
47970
47883
|
import os5 from "node:os";
|
|
47971
47884
|
import path21 from "node:path";
|
|
47972
|
-
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
47973
47885
|
|
|
47974
47886
|
// src/maker/cli/dshMcpConfig.ts
|
|
47975
47887
|
var import_yaml = __toESM(require_dist2());
|
|
@@ -48259,40 +48171,6 @@ function inspectMakerMcpClientConfig(options) {
|
|
|
48259
48171
|
const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
|
|
48260
48172
|
return { ide, status, entries };
|
|
48261
48173
|
}
|
|
48262
|
-
function resolveMakerMcpReportRuntime(options) {
|
|
48263
|
-
const pluginDistribution = resolveMakerPluginDistribution(options.distribution);
|
|
48264
|
-
if (!pluginDistribution) {
|
|
48265
|
-
return void 0;
|
|
48266
|
-
}
|
|
48267
|
-
if (!options.bundleUrl) {
|
|
48268
|
-
throw new Error(
|
|
48269
|
-
`${pluginDistribution.displayName} plugin diagnostics require the active Maker bundle URL.`
|
|
48270
|
-
);
|
|
48271
|
-
}
|
|
48272
|
-
const bundlePath = path21.resolve(fileURLToPath4(options.bundleUrl));
|
|
48273
|
-
const pluginRoot = path21.dirname(path21.dirname(bundlePath));
|
|
48274
|
-
const execPath = options.execPath ?? process.execPath;
|
|
48275
|
-
return {
|
|
48276
|
-
distribution: pluginDistribution.id,
|
|
48277
|
-
client: pluginDistribution.client,
|
|
48278
|
-
config_source: {
|
|
48279
|
-
format: "json",
|
|
48280
|
-
paths: [path21.join(pluginRoot, ".mcp.json")],
|
|
48281
|
-
mcp_name: "taptap-maker-plugin"
|
|
48282
|
-
},
|
|
48283
|
-
launcher: {
|
|
48284
|
-
kind: "self_runtime",
|
|
48285
|
-
command: execPath,
|
|
48286
|
-
args: [bundlePath],
|
|
48287
|
-
commandAndArgs: [execPath, bundlePath]
|
|
48288
|
-
},
|
|
48289
|
-
cwd: pluginRoot,
|
|
48290
|
-
env: {
|
|
48291
|
-
TAPTAP_MAKER_DISTRIBUTION: pluginDistribution.id,
|
|
48292
|
-
TAPTAP_MCP_CLIENT_IDE: pluginDistribution.client
|
|
48293
|
-
}
|
|
48294
|
-
};
|
|
48295
|
-
}
|
|
48296
48174
|
function buildMakerMcpIssue(options) {
|
|
48297
48175
|
const context = sanitizePublicValue(options.context, options.homeDir);
|
|
48298
48176
|
const diagnostics = sanitizePublicValue(
|
|
@@ -48325,7 +48203,7 @@ function buildMakerMcpIssue(options) {
|
|
|
48325
48203
|
return { title, body };
|
|
48326
48204
|
}
|
|
48327
48205
|
async function collectMakerMcpIssueDiagnostics(options) {
|
|
48328
|
-
var _a3
|
|
48206
|
+
var _a3;
|
|
48329
48207
|
const platform = options.platform || process.platform;
|
|
48330
48208
|
const homeDir = options.homeDir || os5.homedir();
|
|
48331
48209
|
const processCwd = path21.resolve(options.processCwd || process.cwd());
|
|
@@ -48342,7 +48220,7 @@ async function collectMakerMcpIssueDiagnostics(options) {
|
|
|
48342
48220
|
};
|
|
48343
48221
|
const client = (_a3 = options.ide) == null ? void 0 : _a3.trim().toLowerCase();
|
|
48344
48222
|
const environment = options.environment || process.env;
|
|
48345
|
-
const clientConfig = client ?
|
|
48223
|
+
const clientConfig = client ? inspectMakerMcpClientConfig({
|
|
48346
48224
|
ide: client,
|
|
48347
48225
|
homeDir,
|
|
48348
48226
|
platform,
|
|
@@ -48374,14 +48252,10 @@ async function collectMakerMcpIssueDiagnostics(options) {
|
|
|
48374
48252
|
http_proxy_configured: hasEnvironmentValue(environment, "HTTP_PROXY"),
|
|
48375
48253
|
https_proxy_configured: hasEnvironmentValue(environment, "HTTPS_PROXY"),
|
|
48376
48254
|
no_proxy_configured: hasEnvironmentValue(environment, "NO_PROXY")
|
|
48377
|
-
}
|
|
48378
|
-
...options.distribution ? { distribution: options.distribution } : {}
|
|
48255
|
+
}
|
|
48379
48256
|
};
|
|
48380
48257
|
if (client === "workbuddy") {
|
|
48381
|
-
diagnostics.workbuddy_trust = inspectWorkBuddyTrust(
|
|
48382
|
-
homeDir,
|
|
48383
|
-
((_b = options.configSource) == null ? void 0 : _b.mcp_name) || MAKER_MCP_NAME
|
|
48384
|
-
);
|
|
48258
|
+
diagnostics.workbuddy_trust = inspectWorkBuddyTrust(homeDir);
|
|
48385
48259
|
}
|
|
48386
48260
|
return diagnostics;
|
|
48387
48261
|
}
|
|
@@ -48439,12 +48313,10 @@ function getMcpConfigPaths(options) {
|
|
|
48439
48313
|
}
|
|
48440
48314
|
return void 0;
|
|
48441
48315
|
}
|
|
48442
|
-
function inspectMcpConfigFile(configPath, ide, mcpName
|
|
48316
|
+
function inspectMcpConfigFile(configPath, ide, mcpName) {
|
|
48443
48317
|
try {
|
|
48444
|
-
const
|
|
48445
|
-
|
|
48446
|
-
const server = resolvedFormat === "codex_toml" ? extractCodexMcpServerConfig(content, mcpName) : resolvedFormat === "dsh" ? extractDshMcpServerConfig(content, mcpName, configPath) : extractMakerMcpServerConfig(
|
|
48447
|
-
parseJsonConfig(content, resolvedFormat === "jsonc"),
|
|
48318
|
+
const server = ide === "codex" ? extractCodexMcpServerConfig(fs20.readFileSync(configPath, "utf8"), mcpName) : ide === "dsh" ? extractDshMcpServerConfig(fs20.readFileSync(configPath, "utf8"), mcpName, configPath) : extractMakerMcpServerConfig(
|
|
48319
|
+
parseJsonConfig(fs20.readFileSync(configPath, "utf8"), ide === "opencode"),
|
|
48448
48320
|
mcpName
|
|
48449
48321
|
);
|
|
48450
48322
|
return server ? { path: configPath, status: "found", server } : { path: configPath, status: "missing_entry" };
|
|
@@ -48452,11 +48324,6 @@ function inspectMcpConfigFile(configPath, ide, mcpName, format) {
|
|
|
48452
48324
|
return { path: configPath, status: "unreadable" };
|
|
48453
48325
|
}
|
|
48454
48326
|
}
|
|
48455
|
-
function inspectMakerMcpConfigSource(ide, source) {
|
|
48456
|
-
const entries = source.paths.filter((configPath) => fs20.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
|
|
48457
|
-
const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
|
|
48458
|
-
return { ide, status, entries };
|
|
48459
|
-
}
|
|
48460
48327
|
function extractDshMcpServerConfig(content, mcpName, source) {
|
|
48461
48328
|
const plugin = findDshMakerPluginEntry(content, mcpName, source);
|
|
48462
48329
|
if (!plugin) {
|
|
@@ -48662,7 +48529,7 @@ function runGitHubIssueCreate(args, input2) {
|
|
|
48662
48529
|
stderr: typeof result.stderr === "string" ? result.stderr : ""
|
|
48663
48530
|
};
|
|
48664
48531
|
}
|
|
48665
|
-
function inspectWorkBuddyTrust(homeDir
|
|
48532
|
+
function inspectWorkBuddyTrust(homeDir) {
|
|
48666
48533
|
const emptyCounts = {
|
|
48667
48534
|
accounts_checked: 0,
|
|
48668
48535
|
trusted_accounts: 0,
|
|
@@ -48696,9 +48563,9 @@ function inspectWorkBuddyTrust(homeDir, mcpName) {
|
|
|
48696
48563
|
counts.unreadable_accounts += 1;
|
|
48697
48564
|
continue;
|
|
48698
48565
|
}
|
|
48699
|
-
const enabled = asStringArray(state.enabled).includes(
|
|
48700
|
-
const userDisabled = asStringArray(state.userDisabled).includes(
|
|
48701
|
-
const everConnected = asStringArray(state.everConnected).includes(
|
|
48566
|
+
const enabled = asStringArray(state.enabled).includes(MAKER_MCP_NAME);
|
|
48567
|
+
const userDisabled = asStringArray(state.userDisabled).includes(MAKER_MCP_NAME);
|
|
48568
|
+
const everConnected = asStringArray(state.everConnected).includes(MAKER_MCP_NAME);
|
|
48702
48569
|
if (!enabled && !userDisabled && !everConnected) {
|
|
48703
48570
|
continue;
|
|
48704
48571
|
}
|
|
@@ -48863,16 +48730,16 @@ function sanitizeCommandArguments(args) {
|
|
|
48863
48730
|
});
|
|
48864
48731
|
}
|
|
48865
48732
|
function isSensitiveCliFlag(value) {
|
|
48866
|
-
return /^--(?:[a-z0-9]+[-_])*(?:pat|token|secret|
|
|
48733
|
+
return /^--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key)$/iu.test(
|
|
48867
48734
|
value
|
|
48868
48735
|
);
|
|
48869
48736
|
}
|
|
48870
48737
|
function redactReportText(value) {
|
|
48871
48738
|
return value.replace(
|
|
48872
|
-
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|
|
|
48739
|
+
/(^|[\s,;])(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key))\s+(?:"[^"]*"|'[^']*'|[^\s,;]+)/gimu,
|
|
48873
48740
|
"$1$2 <redacted>"
|
|
48874
48741
|
).replace(
|
|
48875
|
-
/(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|
|
|
48742
|
+
/(--(?:[a-z0-9]+[-_])*(?:pat|token|secret|authorization|cookie|password|passwd|passphrase|mac[-_]?key|api[-_]?key|auth[-_]?key|private[-_]?key)=)([^\s]+)/giu,
|
|
48876
48743
|
"$1<redacted>"
|
|
48877
48744
|
).replace(/\b([A-Za-z][A-Za-z0-9+.-]*:\/\/)([^@\s/]+)@/gu, "$1<redacted>@").replace(/\bgithub_pat_[A-Za-z0-9_]{20,}\b/gu, "<redacted>").replace(/\bgh[pousr]_[A-Za-z0-9]{20,}\b/gu, "<redacted>");
|
|
48878
48745
|
}
|
|
@@ -48883,1063 +48750,11 @@ function stripControlCharacters(value) {
|
|
|
48883
48750
|
}).join("");
|
|
48884
48751
|
}
|
|
48885
48752
|
|
|
48886
|
-
// src/maker/cli/pluginMigration.ts
|
|
48887
|
-
import fs22 from "node:fs";
|
|
48888
|
-
import os6 from "node:os";
|
|
48889
|
-
import path23 from "node:path";
|
|
48890
|
-
import crypto3 from "node:crypto";
|
|
48891
|
-
|
|
48892
|
-
// src/maker/cli/codexMcpConfig.ts
|
|
48893
|
-
function findCodexMcpTables(content, mcpName) {
|
|
48894
|
-
const mainPath = `mcp_servers.${mcpName}`;
|
|
48895
|
-
return findTomlTables(content).flatMap((table) => {
|
|
48896
|
-
const normalizedPath = normalizeCodexMcpTablePath(table.path, mcpName);
|
|
48897
|
-
if (!normalizedPath) {
|
|
48898
|
-
return [];
|
|
48899
|
-
}
|
|
48900
|
-
return [
|
|
48901
|
-
{
|
|
48902
|
-
headerStart: table.headerStart,
|
|
48903
|
-
bodyStart: table.bodyStart,
|
|
48904
|
-
bodyEnd: table.bodyEnd,
|
|
48905
|
-
normalizedPath,
|
|
48906
|
-
isMain: normalizedPath === mainPath
|
|
48907
|
-
}
|
|
48908
|
-
];
|
|
48909
|
-
});
|
|
48910
|
-
}
|
|
48911
|
-
function removeCodexMcpTables(content, mcpName) {
|
|
48912
|
-
const tables = findCodexMcpTables(content, mcpName);
|
|
48913
|
-
return [...tables].reverse().reduce(
|
|
48914
|
-
(updated, table) => `${updated.slice(0, table.headerStart)}${updated.slice(table.bodyEnd)}`,
|
|
48915
|
-
content
|
|
48916
|
-
);
|
|
48917
|
-
}
|
|
48918
|
-
function findCodexMcpTableDuplicates(text, mcpName) {
|
|
48919
|
-
const seen = /* @__PURE__ */ new Set();
|
|
48920
|
-
const duplicates = /* @__PURE__ */ new Set();
|
|
48921
|
-
for (const table of findCodexMcpTables(text, mcpName)) {
|
|
48922
|
-
if (seen.has(table.normalizedPath)) {
|
|
48923
|
-
duplicates.add(table.normalizedPath);
|
|
48924
|
-
} else {
|
|
48925
|
-
seen.add(table.normalizedPath);
|
|
48926
|
-
}
|
|
48927
|
-
}
|
|
48928
|
-
return Array.from(duplicates);
|
|
48929
|
-
}
|
|
48930
|
-
function findTomlBooleanAssignment(content, start, end, key) {
|
|
48931
|
-
const keyPattern = escapeRegExp3(key);
|
|
48932
|
-
let multiline;
|
|
48933
|
-
for (const line of splitTomlLines(content, start, end)) {
|
|
48934
|
-
if (!multiline) {
|
|
48935
|
-
const match = new RegExp(`^\\s*${keyPattern}\\s*=\\s*(true|false)\\s*(?:#.*)?$`).exec(
|
|
48936
|
-
line.text
|
|
48937
|
-
);
|
|
48938
|
-
if ((match == null ? void 0 : match.index) !== void 0) {
|
|
48939
|
-
const relativeValueStart = match.index + match[0].indexOf(match[1]);
|
|
48940
|
-
return {
|
|
48941
|
-
value: match[1] === "true",
|
|
48942
|
-
valueStart: line.start + relativeValueStart,
|
|
48943
|
-
valueEnd: line.start + relativeValueStart + match[1].length
|
|
48944
|
-
};
|
|
48945
|
-
}
|
|
48946
|
-
}
|
|
48947
|
-
multiline = scanTomlLine(line.text, multiline);
|
|
48948
|
-
}
|
|
48949
|
-
return void 0;
|
|
48950
|
-
}
|
|
48951
|
-
function escapeTomlString(value) {
|
|
48952
|
-
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
48953
|
-
}
|
|
48954
|
-
function findTomlTables(content) {
|
|
48955
|
-
const tables = [];
|
|
48956
|
-
let multiline;
|
|
48957
|
-
for (const line of splitTomlLines(content)) {
|
|
48958
|
-
if (!multiline) {
|
|
48959
|
-
const match = /^\s*\[([^\]]+)\]\s*(?:#.*)?$/.exec(line.text);
|
|
48960
|
-
if (match) {
|
|
48961
|
-
const previous = tables[tables.length - 1];
|
|
48962
|
-
if (previous) {
|
|
48963
|
-
previous.bodyEnd = line.start;
|
|
48964
|
-
}
|
|
48965
|
-
tables.push({
|
|
48966
|
-
headerStart: line.start,
|
|
48967
|
-
bodyStart: line.end,
|
|
48968
|
-
bodyEnd: content.length,
|
|
48969
|
-
path: match[1]
|
|
48970
|
-
});
|
|
48971
|
-
}
|
|
48972
|
-
}
|
|
48973
|
-
multiline = scanTomlLine(line.text, multiline);
|
|
48974
|
-
}
|
|
48975
|
-
return tables;
|
|
48976
|
-
}
|
|
48977
|
-
function splitTomlLines(content, start = 0, end = content.length) {
|
|
48978
|
-
const lines = [];
|
|
48979
|
-
let lineStart = start;
|
|
48980
|
-
while (lineStart < end) {
|
|
48981
|
-
const newline = content.indexOf("\n", lineStart);
|
|
48982
|
-
const nextLineStart = newline === -1 || newline >= end ? end : newline + 1;
|
|
48983
|
-
let lineEnd = newline === -1 || newline >= end ? end : newline;
|
|
48984
|
-
if (lineEnd > lineStart && content[lineEnd - 1] === "\r") {
|
|
48985
|
-
lineEnd -= 1;
|
|
48986
|
-
}
|
|
48987
|
-
lines.push({
|
|
48988
|
-
start: lineStart,
|
|
48989
|
-
end: lineEnd,
|
|
48990
|
-
text: content.slice(lineStart, lineEnd)
|
|
48991
|
-
});
|
|
48992
|
-
lineStart = nextLineStart;
|
|
48993
|
-
}
|
|
48994
|
-
return lines;
|
|
48995
|
-
}
|
|
48996
|
-
function scanTomlLine(line, initial) {
|
|
48997
|
-
let multiline = initial;
|
|
48998
|
-
let index = 0;
|
|
48999
|
-
while (index < line.length) {
|
|
49000
|
-
if (multiline === "basic") {
|
|
49001
|
-
const closing = findUnescapedTripleQuote(line, index, '"""');
|
|
49002
|
-
if (closing === -1) {
|
|
49003
|
-
return multiline;
|
|
49004
|
-
}
|
|
49005
|
-
multiline = void 0;
|
|
49006
|
-
index = closing + 3;
|
|
49007
|
-
continue;
|
|
49008
|
-
}
|
|
49009
|
-
if (multiline === "literal") {
|
|
49010
|
-
const closing = line.indexOf("'''", index);
|
|
49011
|
-
if (closing === -1) {
|
|
49012
|
-
return multiline;
|
|
49013
|
-
}
|
|
49014
|
-
multiline = void 0;
|
|
49015
|
-
index = closing + 3;
|
|
49016
|
-
continue;
|
|
49017
|
-
}
|
|
49018
|
-
const character = line[index];
|
|
49019
|
-
if (character === "#") {
|
|
49020
|
-
return void 0;
|
|
49021
|
-
}
|
|
49022
|
-
if (line.startsWith('"""', index)) {
|
|
49023
|
-
multiline = "basic";
|
|
49024
|
-
index += 3;
|
|
49025
|
-
continue;
|
|
49026
|
-
}
|
|
49027
|
-
if (line.startsWith("'''", index)) {
|
|
49028
|
-
multiline = "literal";
|
|
49029
|
-
index += 3;
|
|
49030
|
-
continue;
|
|
49031
|
-
}
|
|
49032
|
-
if (character === '"') {
|
|
49033
|
-
index = skipBasicString(line, index + 1);
|
|
49034
|
-
continue;
|
|
49035
|
-
}
|
|
49036
|
-
if (character === "'") {
|
|
49037
|
-
const closing = line.indexOf("'", index + 1);
|
|
49038
|
-
index = closing === -1 ? line.length : closing + 1;
|
|
49039
|
-
continue;
|
|
49040
|
-
}
|
|
49041
|
-
index += 1;
|
|
49042
|
-
}
|
|
49043
|
-
return multiline;
|
|
49044
|
-
}
|
|
49045
|
-
function findUnescapedTripleQuote(line, start, delimiter) {
|
|
49046
|
-
let match = line.indexOf(delimiter, start);
|
|
49047
|
-
while (match !== -1) {
|
|
49048
|
-
let backslashes = 0;
|
|
49049
|
-
for (let index = match - 1; index >= 0 && line[index] === "\\"; index -= 1) {
|
|
49050
|
-
backslashes += 1;
|
|
49051
|
-
}
|
|
49052
|
-
if (backslashes % 2 === 0) {
|
|
49053
|
-
return match;
|
|
49054
|
-
}
|
|
49055
|
-
match = line.indexOf(delimiter, match + delimiter.length);
|
|
49056
|
-
}
|
|
49057
|
-
return -1;
|
|
49058
|
-
}
|
|
49059
|
-
function skipBasicString(line, start) {
|
|
49060
|
-
let escaped = false;
|
|
49061
|
-
for (let index = start; index < line.length; index += 1) {
|
|
49062
|
-
if (escaped) {
|
|
49063
|
-
escaped = false;
|
|
49064
|
-
continue;
|
|
49065
|
-
}
|
|
49066
|
-
if (line[index] === "\\") {
|
|
49067
|
-
escaped = true;
|
|
49068
|
-
continue;
|
|
49069
|
-
}
|
|
49070
|
-
if (line[index] === '"') {
|
|
49071
|
-
return index + 1;
|
|
49072
|
-
}
|
|
49073
|
-
}
|
|
49074
|
-
return line.length;
|
|
49075
|
-
}
|
|
49076
|
-
function normalizeCodexMcpTablePath(tablePath, mcpName) {
|
|
49077
|
-
const keyPattern = createCodexMcpKeyPattern(mcpName);
|
|
49078
|
-
const match = new RegExp(`^mcp_servers\\.${keyPattern}(\\..+)?$`).exec(tablePath);
|
|
49079
|
-
if (!match) {
|
|
49080
|
-
return void 0;
|
|
49081
|
-
}
|
|
49082
|
-
return `mcp_servers.${mcpName}${match[1] || ""}`;
|
|
49083
|
-
}
|
|
49084
|
-
function createCodexMcpKeyPattern(mcpName) {
|
|
49085
|
-
const quotedKey = `"${escapeRegExp3(mcpName)}"`;
|
|
49086
|
-
if (!/^[A-Za-z0-9_-]+$/.test(mcpName)) {
|
|
49087
|
-
return quotedKey;
|
|
49088
|
-
}
|
|
49089
|
-
return `(?:${quotedKey}|${escapeRegExp3(mcpName)})`;
|
|
49090
|
-
}
|
|
49091
|
-
function escapeRegExp3(value) {
|
|
49092
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
49093
|
-
}
|
|
49094
|
-
|
|
49095
|
-
// src/maker/cli/configWrite.ts
|
|
49096
|
-
import fs21 from "node:fs";
|
|
49097
|
-
import path22 from "node:path";
|
|
49098
|
-
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
49099
|
-
const existed = fs21.existsSync(filePath);
|
|
49100
|
-
const previousContent = existed ? fs21.readFileSync(filePath, "utf8") : void 0;
|
|
49101
|
-
if (previousContent === nextContent) {
|
|
49102
|
-
return { changed: false };
|
|
49103
|
-
}
|
|
49104
|
-
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
49105
|
-
fs21.mkdirSync(path22.dirname(filePath), { recursive: true });
|
|
49106
|
-
if (previousContent !== void 0 && backupPath) {
|
|
49107
|
-
fs21.writeFileSync(backupPath, previousContent, "utf8");
|
|
49108
|
-
}
|
|
49109
|
-
try {
|
|
49110
|
-
fs21.writeFileSync(filePath, nextContent, "utf8");
|
|
49111
|
-
validate == null ? void 0 : validate(fs21.readFileSync(filePath, "utf8"));
|
|
49112
|
-
return { changed: true, backupPath };
|
|
49113
|
-
} catch (error2) {
|
|
49114
|
-
if (previousContent !== void 0) {
|
|
49115
|
-
fs21.writeFileSync(filePath, previousContent, "utf8");
|
|
49116
|
-
} else {
|
|
49117
|
-
fs21.rmSync(filePath, { force: true });
|
|
49118
|
-
}
|
|
49119
|
-
throw error2;
|
|
49120
|
-
}
|
|
49121
|
-
}
|
|
49122
|
-
|
|
49123
|
-
// src/maker/cli/pluginMigration.ts
|
|
49124
|
-
function inspectCodexLegacyMakerMcp(options = {}) {
|
|
49125
|
-
const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
|
|
49126
|
-
if (!fs22.existsSync(configPath)) {
|
|
49127
|
-
return createInspection(configPath, "not_found", 0);
|
|
49128
|
-
}
|
|
49129
|
-
const content = fs22.readFileSync(configPath, "utf8");
|
|
49130
|
-
const registrations = findCodexMakerMainTables(content);
|
|
49131
|
-
if (registrations.length === 0) {
|
|
49132
|
-
return createInspection(configPath, "not_found", 0);
|
|
49133
|
-
}
|
|
49134
|
-
if (registrations.length > 1) {
|
|
49135
|
-
return createInspection(configPath, "ambiguous", registrations.length);
|
|
49136
|
-
}
|
|
49137
|
-
const enabled = registrations[0].enabled;
|
|
49138
|
-
return {
|
|
49139
|
-
...createInspection(configPath, enabled ? "active" : "disabled", 1),
|
|
49140
|
-
enabled
|
|
49141
|
-
};
|
|
49142
|
-
}
|
|
49143
|
-
function migrateCodexLegacyMakerMcp(options = {}) {
|
|
49144
|
-
const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
|
|
49145
|
-
const makerHome = options.makerHome ?? getMakerHome();
|
|
49146
|
-
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
49147
|
-
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49148
|
-
if (inspection.status === "not_found") {
|
|
49149
|
-
return { ...inspection, action: "not_found", changed: false };
|
|
49150
|
-
}
|
|
49151
|
-
if (inspection.status === "ambiguous") {
|
|
49152
|
-
throw new Error(
|
|
49153
|
-
`Codex Maker MCP migration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before migrating.`
|
|
49154
|
-
);
|
|
49155
|
-
}
|
|
49156
|
-
if (inspection.status === "disabled") {
|
|
49157
|
-
const state2 = readMigrationState(statePath);
|
|
49158
|
-
const content = fs22.readFileSync(configPath, "utf8");
|
|
49159
|
-
const registration2 = findCodexMakerMainTables(content)[0];
|
|
49160
|
-
const owned = (state2 == null ? void 0 : state2.config_path) === configPath && sha256(readCodexMakerRegistration(content, registration2)) === state2.migrated_registration_sha256;
|
|
49161
|
-
return {
|
|
49162
|
-
...inspection,
|
|
49163
|
-
action: owned ? "already_migrated" : "already_disabled",
|
|
49164
|
-
changed: false,
|
|
49165
|
-
...owned ? { state_path: statePath } : {}
|
|
49166
|
-
};
|
|
49167
|
-
}
|
|
49168
|
-
if (!options.confirm) {
|
|
49169
|
-
throw new Error("Disabling the legacy Codex Maker MCP requires explicit confirmation.");
|
|
49170
|
-
}
|
|
49171
|
-
const previousContent = fs22.readFileSync(configPath, "utf8");
|
|
49172
|
-
const registration = findCodexMakerMainTables(previousContent)[0];
|
|
49173
|
-
const nextContent = disableCodexMakerRegistration(previousContent, registration);
|
|
49174
|
-
const state = {
|
|
49175
|
-
schema_version: 2,
|
|
49176
|
-
client: "codex",
|
|
49177
|
-
config_path: configPath,
|
|
49178
|
-
previous_enabled: registration.enabledExplicitly ? "true" : "implicit",
|
|
49179
|
-
original_registration_sha256: sha256(readCodexMakerRegistration(previousContent, registration)),
|
|
49180
|
-
migrated_registration_sha256: sha256(
|
|
49181
|
-
readCodexMakerRegistration(nextContent, findCodexMakerMainTables(nextContent)[0])
|
|
49182
|
-
),
|
|
49183
|
-
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
49184
|
-
};
|
|
49185
|
-
fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
|
|
49186
|
-
const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
|
|
49187
|
-
const migratedInspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49188
|
-
if (migratedInspection.status !== "disabled") {
|
|
49189
|
-
throw new Error("Codex Maker MCP migration validation did not find a disabled registration.");
|
|
49190
|
-
}
|
|
49191
|
-
fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
49192
|
-
`, "utf8");
|
|
49193
|
-
});
|
|
49194
|
-
return {
|
|
49195
|
-
...inspectCodexLegacyMakerMcp({ configPath }),
|
|
49196
|
-
action: "disabled",
|
|
49197
|
-
changed: write.changed,
|
|
49198
|
-
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49199
|
-
state_path: statePath
|
|
49200
|
-
};
|
|
49201
|
-
}
|
|
49202
|
-
function restoreCodexLegacyMakerMcp(options = {}) {
|
|
49203
|
-
const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
|
|
49204
|
-
const makerHome = options.makerHome ?? getMakerHome();
|
|
49205
|
-
const statePath = getCodexPluginMigrationStatePath(makerHome);
|
|
49206
|
-
const inspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49207
|
-
const state = readMigrationState(statePath);
|
|
49208
|
-
if (!state || state.config_path !== configPath) {
|
|
49209
|
-
return { ...inspection, action: "not_owned", changed: false };
|
|
49210
|
-
}
|
|
49211
|
-
if (!options.confirm) {
|
|
49212
|
-
throw new Error("Restoring the legacy Codex Maker MCP requires explicit confirmation.");
|
|
49213
|
-
}
|
|
49214
|
-
if (inspection.status === "ambiguous") {
|
|
49215
|
-
throw new Error(
|
|
49216
|
-
`Codex Maker MCP restoration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before restoring.`
|
|
49217
|
-
);
|
|
49218
|
-
}
|
|
49219
|
-
if (inspection.status === "not_found") {
|
|
49220
|
-
throw new Error(
|
|
49221
|
-
"The migrated Codex Maker MCP registration no longer exists and cannot be restored."
|
|
49222
|
-
);
|
|
49223
|
-
}
|
|
49224
|
-
const previousContent = fs22.readFileSync(configPath, "utf8");
|
|
49225
|
-
const registration = findCodexMakerMainTables(previousContent)[0];
|
|
49226
|
-
const registrationSha256 = sha256(readCodexMakerRegistration(previousContent, registration));
|
|
49227
|
-
if (inspection.status === "active") {
|
|
49228
|
-
if (registrationSha256 !== state.original_registration_sha256) {
|
|
49229
|
-
return { ...inspection, action: "not_owned", changed: false };
|
|
49230
|
-
}
|
|
49231
|
-
fs22.unlinkSync(statePath);
|
|
49232
|
-
return { ...inspection, action: "already_restored", changed: false };
|
|
49233
|
-
}
|
|
49234
|
-
if (registrationSha256 !== state.migrated_registration_sha256) {
|
|
49235
|
-
return { ...inspection, action: "not_owned", changed: false };
|
|
49236
|
-
}
|
|
49237
|
-
const nextContent = restoreCodexMakerRegistration(previousContent, registration, state);
|
|
49238
|
-
const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
|
|
49239
|
-
const restoredInspection = inspectCodexLegacyMakerMcp({ configPath });
|
|
49240
|
-
if (restoredInspection.status !== "active") {
|
|
49241
|
-
throw new Error(
|
|
49242
|
-
"Codex Maker MCP restoration validation did not find an active registration."
|
|
49243
|
-
);
|
|
49244
|
-
}
|
|
49245
|
-
const restoredContent = fs22.readFileSync(configPath, "utf8");
|
|
49246
|
-
const restoredRegistration = findCodexMakerMainTables(restoredContent)[0];
|
|
49247
|
-
if (sha256(readCodexMakerRegistration(restoredContent, restoredRegistration)) !== state.original_registration_sha256) {
|
|
49248
|
-
throw new Error("Codex Maker MCP restoration changed the migrated registration identity.");
|
|
49249
|
-
}
|
|
49250
|
-
fs22.unlinkSync(statePath);
|
|
49251
|
-
});
|
|
49252
|
-
return {
|
|
49253
|
-
...inspectCodexLegacyMakerMcp({ configPath }),
|
|
49254
|
-
action: "restored",
|
|
49255
|
-
changed: write.changed,
|
|
49256
|
-
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49257
|
-
state_path: statePath
|
|
49258
|
-
};
|
|
49259
|
-
}
|
|
49260
|
-
function findCodexMakerMainTables(content) {
|
|
49261
|
-
return findCodexMcpTables(content, "taptap-maker").filter((table) => table.isMain).map((table) => {
|
|
49262
|
-
const enabledAssignment = findTomlBooleanAssignment(
|
|
49263
|
-
content,
|
|
49264
|
-
table.bodyStart,
|
|
49265
|
-
table.bodyEnd,
|
|
49266
|
-
"enabled"
|
|
49267
|
-
);
|
|
49268
|
-
return {
|
|
49269
|
-
headerStart: table.headerStart,
|
|
49270
|
-
bodyStart: table.bodyStart,
|
|
49271
|
-
bodyEnd: table.bodyEnd,
|
|
49272
|
-
enabled: (enabledAssignment == null ? void 0 : enabledAssignment.value) !== false,
|
|
49273
|
-
enabledExplicitly: Boolean(enabledAssignment),
|
|
49274
|
-
...enabledAssignment ? {
|
|
49275
|
-
enabledValueStart: enabledAssignment.valueStart,
|
|
49276
|
-
enabledValueEnd: enabledAssignment.valueEnd
|
|
49277
|
-
} : {}
|
|
49278
|
-
};
|
|
49279
|
-
});
|
|
49280
|
-
}
|
|
49281
|
-
function disableCodexMakerRegistration(content, registration) {
|
|
49282
|
-
if (registration.enabledValueStart !== void 0 && registration.enabledValueEnd !== void 0) {
|
|
49283
|
-
return `${content.slice(0, registration.enabledValueStart)}false${content.slice(
|
|
49284
|
-
registration.enabledValueEnd
|
|
49285
|
-
)}`;
|
|
49286
|
-
}
|
|
49287
|
-
return `${content.slice(0, registration.bodyStart)}
|
|
49288
|
-
enabled = false${content.slice(
|
|
49289
|
-
registration.bodyStart
|
|
49290
|
-
)}`;
|
|
49291
|
-
}
|
|
49292
|
-
function restoreCodexMakerRegistration(content, registration, state) {
|
|
49293
|
-
if (state.previous_enabled === "true") {
|
|
49294
|
-
if (registration.enabledValueStart === void 0 || registration.enabledValueEnd === void 0) {
|
|
49295
|
-
throw new Error("The migrated Codex Maker MCP enabled value is missing.");
|
|
49296
|
-
}
|
|
49297
|
-
return `${content.slice(0, registration.enabledValueStart)}true${content.slice(
|
|
49298
|
-
registration.enabledValueEnd
|
|
49299
|
-
)}`;
|
|
49300
|
-
}
|
|
49301
|
-
const insertedLine = "\nenabled = false";
|
|
49302
|
-
if (!content.startsWith(insertedLine, registration.bodyStart)) {
|
|
49303
|
-
throw new Error("The plugin-owned Codex Maker MCP disabled marker was modified.");
|
|
49304
|
-
}
|
|
49305
|
-
return `${content.slice(0, registration.bodyStart)}${content.slice(
|
|
49306
|
-
registration.bodyStart + insertedLine.length
|
|
49307
|
-
)}`;
|
|
49308
|
-
}
|
|
49309
|
-
function readCodexMakerRegistration(content, registration) {
|
|
49310
|
-
return content.slice(registration.headerStart, registration.bodyEnd).trimEnd();
|
|
49311
|
-
}
|
|
49312
|
-
function getCodexPluginMigrationStatePath(makerHome) {
|
|
49313
|
-
return path23.join(makerHome, "plugin-migrations", "codex.json");
|
|
49314
|
-
}
|
|
49315
|
-
function readMigrationState(statePath) {
|
|
49316
|
-
if (!fs22.existsSync(statePath)) {
|
|
49317
|
-
return void 0;
|
|
49318
|
-
}
|
|
49319
|
-
try {
|
|
49320
|
-
const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
|
|
49321
|
-
return (state == null ? void 0 : state.schema_version) === 2 && state.client === "codex" ? state : void 0;
|
|
49322
|
-
} catch {
|
|
49323
|
-
return void 0;
|
|
49324
|
-
}
|
|
49325
|
-
}
|
|
49326
|
-
function sha256(content) {
|
|
49327
|
-
return crypto3.createHash("sha256").update(content).digest("hex");
|
|
49328
|
-
}
|
|
49329
|
-
function createInspection(configPath, status, registrationCount) {
|
|
49330
|
-
return {
|
|
49331
|
-
client: "codex",
|
|
49332
|
-
status,
|
|
49333
|
-
config_path: configPath,
|
|
49334
|
-
registration_count: registrationCount
|
|
49335
|
-
};
|
|
49336
|
-
}
|
|
49337
|
-
function inspectWorkBuddyLegacyMakerMcp(options = {}) {
|
|
49338
|
-
const configPaths = getWorkBuddyConfigPaths(options.configPaths);
|
|
49339
|
-
const registrations = findWorkBuddyMakerRegistrations(configPaths);
|
|
49340
|
-
const registrationPaths = registrations.map((entry) => entry.configPath);
|
|
49341
|
-
if (registrations.length === 0) {
|
|
49342
|
-
return createWorkBuddyInspection(configPaths[0], "not_found", []);
|
|
49343
|
-
}
|
|
49344
|
-
const activeRegistrations = registrations.filter((entry) => entry.registration.disabled !== true);
|
|
49345
|
-
if (activeRegistrations.length > 1) {
|
|
49346
|
-
return createWorkBuddyInspection(configPaths[0], "ambiguous", registrationPaths);
|
|
49347
|
-
}
|
|
49348
|
-
if (activeRegistrations.length === 0) {
|
|
49349
|
-
return {
|
|
49350
|
-
...createWorkBuddyInspection(registrations[0].configPath, "disabled", registrationPaths),
|
|
49351
|
-
enabled: false
|
|
49352
|
-
};
|
|
49353
|
-
}
|
|
49354
|
-
const active = activeRegistrations[0];
|
|
49355
|
-
return {
|
|
49356
|
-
...createWorkBuddyInspection(active.configPath, "active", registrationPaths),
|
|
49357
|
-
enabled: true
|
|
49358
|
-
};
|
|
49359
|
-
}
|
|
49360
|
-
function migrateWorkBuddyLegacyMakerMcp(options = {}) {
|
|
49361
|
-
const configPaths = getWorkBuddyConfigPaths(options.configPaths);
|
|
49362
|
-
const makerHome = options.makerHome ?? getMakerHome();
|
|
49363
|
-
const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
|
|
49364
|
-
const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49365
|
-
if (inspection.status === "not_found") {
|
|
49366
|
-
return { ...inspection, action: "not_found", changed: false };
|
|
49367
|
-
}
|
|
49368
|
-
if (inspection.status === "ambiguous") {
|
|
49369
|
-
throw new Error(
|
|
49370
|
-
`WorkBuddy Maker MCP migration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
|
|
49371
|
-
);
|
|
49372
|
-
}
|
|
49373
|
-
const registrations = findWorkBuddyMakerRegistrations(configPaths);
|
|
49374
|
-
if (inspection.status === "disabled") {
|
|
49375
|
-
const state2 = readWorkBuddyMigrationState(statePath);
|
|
49376
|
-
const current2 = state2 ? registrations.find((entry) => entry.configPath === state2.config_path) : registrations[0];
|
|
49377
|
-
const owned = Boolean(
|
|
49378
|
-
state2 && current2 && hashWorkBuddyRegistration(current2.registration) === state2.migrated_registration_sha256
|
|
49379
|
-
);
|
|
49380
|
-
return {
|
|
49381
|
-
...inspection,
|
|
49382
|
-
...owned && current2 ? { config_path: current2.configPath } : {},
|
|
49383
|
-
action: owned ? "already_migrated" : "already_disabled",
|
|
49384
|
-
changed: false,
|
|
49385
|
-
...owned ? { state_path: statePath } : {}
|
|
49386
|
-
};
|
|
49387
|
-
}
|
|
49388
|
-
if (!options.confirm) {
|
|
49389
|
-
throw new Error("Disabling the legacy WorkBuddy Maker MCP requires explicit confirmation.");
|
|
49390
|
-
}
|
|
49391
|
-
const current = registrations.find((entry) => entry.configPath === inspection.config_path);
|
|
49392
|
-
if (!current) {
|
|
49393
|
-
throw new Error("The active WorkBuddy Maker MCP registration could not be resolved.");
|
|
49394
|
-
}
|
|
49395
|
-
const originalRegistration = { ...current.registration };
|
|
49396
|
-
const previousDisabled = Object.prototype.hasOwnProperty.call(originalRegistration, "disabled") ? false : "missing";
|
|
49397
|
-
const migratedRegistration = { ...originalRegistration, disabled: true };
|
|
49398
|
-
setWorkBuddyMakerRegistration(current.config, migratedRegistration);
|
|
49399
|
-
const nextContent = `${JSON.stringify(current.config, null, 2)}
|
|
49400
|
-
`;
|
|
49401
|
-
const state = {
|
|
49402
|
-
schema_version: 1,
|
|
49403
|
-
client: "workbuddy",
|
|
49404
|
-
config_path: current.configPath,
|
|
49405
|
-
previous_disabled: previousDisabled,
|
|
49406
|
-
original_registration_sha256: hashWorkBuddyRegistration(originalRegistration),
|
|
49407
|
-
migrated_registration_sha256: hashWorkBuddyRegistration(migratedRegistration),
|
|
49408
|
-
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
49409
|
-
};
|
|
49410
|
-
fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
|
|
49411
|
-
const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
|
|
49412
|
-
const migrated = findWorkBuddyMakerRegistrations(configPaths).find(
|
|
49413
|
-
(entry) => entry.configPath === current.configPath
|
|
49414
|
-
);
|
|
49415
|
-
if (!migrated || hashWorkBuddyRegistration(migrated.registration) !== state.migrated_registration_sha256) {
|
|
49416
|
-
throw new Error(
|
|
49417
|
-
"WorkBuddy Maker MCP migration validation did not find the disabled registration."
|
|
49418
|
-
);
|
|
49419
|
-
}
|
|
49420
|
-
fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
49421
|
-
`, "utf8");
|
|
49422
|
-
});
|
|
49423
|
-
const migratedInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49424
|
-
return {
|
|
49425
|
-
...migratedInspection,
|
|
49426
|
-
config_path: current.configPath,
|
|
49427
|
-
action: "disabled",
|
|
49428
|
-
changed: write.changed,
|
|
49429
|
-
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49430
|
-
state_path: statePath
|
|
49431
|
-
};
|
|
49432
|
-
}
|
|
49433
|
-
function restoreWorkBuddyLegacyMakerMcp(options = {}) {
|
|
49434
|
-
const configPaths = getWorkBuddyConfigPaths(options.configPaths);
|
|
49435
|
-
const makerHome = options.makerHome ?? getMakerHome();
|
|
49436
|
-
const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
|
|
49437
|
-
const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49438
|
-
const state = readWorkBuddyMigrationState(statePath);
|
|
49439
|
-
if (!state) {
|
|
49440
|
-
return { ...inspection, action: "not_owned", changed: false };
|
|
49441
|
-
}
|
|
49442
|
-
if (!options.confirm) {
|
|
49443
|
-
throw new Error("Restoring the legacy WorkBuddy Maker MCP requires explicit confirmation.");
|
|
49444
|
-
}
|
|
49445
|
-
if (inspection.status === "ambiguous") {
|
|
49446
|
-
throw new Error(
|
|
49447
|
-
`WorkBuddy Maker MCP restoration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
|
|
49448
|
-
);
|
|
49449
|
-
}
|
|
49450
|
-
if (inspection.status === "not_found") {
|
|
49451
|
-
throw new Error(
|
|
49452
|
-
"The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
|
|
49453
|
-
);
|
|
49454
|
-
}
|
|
49455
|
-
const current = findWorkBuddyMakerRegistrations(configPaths).find(
|
|
49456
|
-
(entry) => entry.configPath === state.config_path
|
|
49457
|
-
);
|
|
49458
|
-
if (!current) {
|
|
49459
|
-
throw new Error(
|
|
49460
|
-
"The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
|
|
49461
|
-
);
|
|
49462
|
-
}
|
|
49463
|
-
const registrationSha256 = hashWorkBuddyRegistration(current.registration);
|
|
49464
|
-
const currentEnabled = current.registration.disabled !== true;
|
|
49465
|
-
if (currentEnabled) {
|
|
49466
|
-
if (registrationSha256 !== state.original_registration_sha256) {
|
|
49467
|
-
return {
|
|
49468
|
-
...inspection,
|
|
49469
|
-
config_path: current.configPath,
|
|
49470
|
-
action: "not_owned",
|
|
49471
|
-
changed: false
|
|
49472
|
-
};
|
|
49473
|
-
}
|
|
49474
|
-
fs22.unlinkSync(statePath);
|
|
49475
|
-
return {
|
|
49476
|
-
...inspection,
|
|
49477
|
-
config_path: current.configPath,
|
|
49478
|
-
action: "already_restored",
|
|
49479
|
-
changed: false
|
|
49480
|
-
};
|
|
49481
|
-
}
|
|
49482
|
-
if (registrationSha256 !== state.migrated_registration_sha256) {
|
|
49483
|
-
return { ...inspection, config_path: current.configPath, action: "not_owned", changed: false };
|
|
49484
|
-
}
|
|
49485
|
-
const restoredRegistration = { ...current.registration };
|
|
49486
|
-
if (state.previous_disabled === "missing") {
|
|
49487
|
-
delete restoredRegistration.disabled;
|
|
49488
|
-
} else {
|
|
49489
|
-
restoredRegistration.disabled = false;
|
|
49490
|
-
}
|
|
49491
|
-
setWorkBuddyMakerRegistration(current.config, restoredRegistration);
|
|
49492
|
-
const nextContent = `${JSON.stringify(current.config, null, 2)}
|
|
49493
|
-
`;
|
|
49494
|
-
const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
|
|
49495
|
-
const restoredInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
|
|
49496
|
-
if (restoredInspection.status !== "active") {
|
|
49497
|
-
throw new Error(
|
|
49498
|
-
"WorkBuddy Maker MCP restoration validation did not find an active registration."
|
|
49499
|
-
);
|
|
49500
|
-
}
|
|
49501
|
-
const restored = findWorkBuddyMakerRegistrations(configPaths).find(
|
|
49502
|
-
(entry) => entry.configPath === state.config_path
|
|
49503
|
-
);
|
|
49504
|
-
if (!restored || hashWorkBuddyRegistration(restored.registration) !== state.original_registration_sha256) {
|
|
49505
|
-
throw new Error("WorkBuddy Maker MCP restoration changed the registration identity.");
|
|
49506
|
-
}
|
|
49507
|
-
fs22.unlinkSync(statePath);
|
|
49508
|
-
});
|
|
49509
|
-
return {
|
|
49510
|
-
...inspectWorkBuddyLegacyMakerMcp({ configPaths }),
|
|
49511
|
-
config_path: current.configPath,
|
|
49512
|
-
action: "restored",
|
|
49513
|
-
changed: write.changed,
|
|
49514
|
-
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49515
|
-
state_path: statePath
|
|
49516
|
-
};
|
|
49517
|
-
}
|
|
49518
|
-
function getWorkBuddyConfigPaths(configPaths) {
|
|
49519
|
-
return configPaths ?? [
|
|
49520
|
-
path23.join(os6.homedir(), ".workbuddy", "mcp.json"),
|
|
49521
|
-
path23.join(os6.homedir(), ".workbuddy", ".mcp.json")
|
|
49522
|
-
];
|
|
49523
|
-
}
|
|
49524
|
-
function findWorkBuddyMakerRegistrations(configPaths) {
|
|
49525
|
-
const registrations = [];
|
|
49526
|
-
for (const configPath of configPaths) {
|
|
49527
|
-
if (!fs22.existsSync(configPath)) {
|
|
49528
|
-
continue;
|
|
49529
|
-
}
|
|
49530
|
-
let config2;
|
|
49531
|
-
try {
|
|
49532
|
-
config2 = JSON.parse(fs22.readFileSync(configPath, "utf8"));
|
|
49533
|
-
} catch (error2) {
|
|
49534
|
-
throw new Error(
|
|
49535
|
-
`Cannot parse WorkBuddy MCP config ${configPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
|
|
49536
|
-
);
|
|
49537
|
-
}
|
|
49538
|
-
if (!isRecord5(config2)) {
|
|
49539
|
-
throw new Error(`WorkBuddy MCP config must contain a JSON object: ${configPath}`);
|
|
49540
|
-
}
|
|
49541
|
-
const servers = config2.mcpServers;
|
|
49542
|
-
if (servers === void 0) {
|
|
49543
|
-
continue;
|
|
49544
|
-
}
|
|
49545
|
-
if (!isRecord5(servers)) {
|
|
49546
|
-
throw new Error(`WorkBuddy MCP config mcpServers must be an object: ${configPath}`);
|
|
49547
|
-
}
|
|
49548
|
-
const registration = servers["taptap-maker"];
|
|
49549
|
-
if (registration === void 0) {
|
|
49550
|
-
continue;
|
|
49551
|
-
}
|
|
49552
|
-
if (!isRecord5(registration)) {
|
|
49553
|
-
throw new Error(`WorkBuddy taptap-maker MCP registration must be an object: ${configPath}`);
|
|
49554
|
-
}
|
|
49555
|
-
registrations.push({ configPath, config: config2, registration });
|
|
49556
|
-
}
|
|
49557
|
-
return registrations;
|
|
49558
|
-
}
|
|
49559
|
-
function setWorkBuddyMakerRegistration(config2, registration) {
|
|
49560
|
-
const servers = config2.mcpServers;
|
|
49561
|
-
if (!isRecord5(servers)) {
|
|
49562
|
-
throw new Error("WorkBuddy MCP config mcpServers must be an object.");
|
|
49563
|
-
}
|
|
49564
|
-
servers["taptap-maker"] = registration;
|
|
49565
|
-
}
|
|
49566
|
-
function getWorkBuddyPluginMigrationStatePath(makerHome) {
|
|
49567
|
-
return path23.join(makerHome, "plugin-migrations", "workbuddy.json");
|
|
49568
|
-
}
|
|
49569
|
-
function readWorkBuddyMigrationState(statePath) {
|
|
49570
|
-
if (!fs22.existsSync(statePath)) {
|
|
49571
|
-
return void 0;
|
|
49572
|
-
}
|
|
49573
|
-
try {
|
|
49574
|
-
const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
|
|
49575
|
-
return (state == null ? void 0 : state.schema_version) === 1 && state.client === "workbuddy" ? state : void 0;
|
|
49576
|
-
} catch {
|
|
49577
|
-
return void 0;
|
|
49578
|
-
}
|
|
49579
|
-
}
|
|
49580
|
-
function hashWorkBuddyRegistration(registration) {
|
|
49581
|
-
return sha256(JSON.stringify(registration));
|
|
49582
|
-
}
|
|
49583
|
-
function createWorkBuddyInspection(configPath, status, configPaths) {
|
|
49584
|
-
return {
|
|
49585
|
-
client: "workbuddy",
|
|
49586
|
-
status,
|
|
49587
|
-
config_path: configPath,
|
|
49588
|
-
config_paths: configPaths,
|
|
49589
|
-
registration_count: configPaths.length
|
|
49590
|
-
};
|
|
49591
|
-
}
|
|
49592
|
-
function isRecord5(value) {
|
|
49593
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
49594
|
-
}
|
|
49595
|
-
|
|
49596
|
-
// src/maker/cli/dshPluginMigration.ts
|
|
49597
|
-
var import_yaml2 = __toESM(require_dist2());
|
|
49598
|
-
import fs23 from "node:fs";
|
|
49599
|
-
import os7 from "node:os";
|
|
49600
|
-
import path24 from "node:path";
|
|
49601
|
-
import crypto4 from "node:crypto";
|
|
49602
|
-
var DSH_MAKER_MCP_NAME = "taptap-maker";
|
|
49603
|
-
function inspectDshLegacyMakerMcp(options = {}) {
|
|
49604
|
-
const registrations = findDshMakerRegistrations(options.dshHome);
|
|
49605
|
-
const configPaths = unique(registrations.map((entry) => entry.configPath));
|
|
49606
|
-
if (registrations.length === 0) {
|
|
49607
|
-
return createDshInspection("not_found", [], configPaths);
|
|
49608
|
-
}
|
|
49609
|
-
if (registrations.length > 1) {
|
|
49610
|
-
return createDshInspection("ambiguous", configPaths, configPaths);
|
|
49611
|
-
}
|
|
49612
|
-
return createDshInspection("active", [registrations[0].configPath], configPaths);
|
|
49613
|
-
}
|
|
49614
|
-
function migrateDshLegacyMakerMcp(options = {}) {
|
|
49615
|
-
const makerHome = getMakerHome();
|
|
49616
|
-
const statePath = getDshPluginMigrationStatePath(makerHome);
|
|
49617
|
-
const registrations = findDshMakerRegistrations(options.dshHome);
|
|
49618
|
-
const inspection = inspectDshLegacyMakerMcp(options);
|
|
49619
|
-
if (inspection.status === "not_found") {
|
|
49620
|
-
return { ...inspection, action: "not_found", changed: false };
|
|
49621
|
-
}
|
|
49622
|
-
if (inspection.status === "ambiguous") {
|
|
49623
|
-
throw new Error(
|
|
49624
|
-
`DSH Maker MCP migration found ${inspection.registration_count} registrations in ${inspection.config_paths.join(", ")}; resolve the duplicates before migrating.`
|
|
49625
|
-
);
|
|
49626
|
-
}
|
|
49627
|
-
if (!options.confirm) {
|
|
49628
|
-
throw new Error(
|
|
49629
|
-
"Removing the legacy DSH Maker MCP registration requires explicit confirmation."
|
|
49630
|
-
);
|
|
49631
|
-
}
|
|
49632
|
-
const registration = registrations[0];
|
|
49633
|
-
const previousContent = fs23.readFileSync(registration.configPath, "utf8");
|
|
49634
|
-
const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
|
|
49635
|
-
if (document.errors.length > 0) {
|
|
49636
|
-
throw new Error(`Invalid YAML in ${registration.configPath}: ${document.errors[0].message}`);
|
|
49637
|
-
}
|
|
49638
|
-
removeDshMakerRegistration(document, registration);
|
|
49639
|
-
const nextContent = document.toString({ lineWidth: 0 });
|
|
49640
|
-
const state = {
|
|
49641
|
-
schema_version: 1,
|
|
49642
|
-
client: "dsh",
|
|
49643
|
-
config_path: registration.configPath,
|
|
49644
|
-
removed_registration: registration.registration,
|
|
49645
|
-
removed_registration_sha256: sha2562(JSON.stringify(registration.registration)),
|
|
49646
|
-
migrated_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
49647
|
-
};
|
|
49648
|
-
fs23.mkdirSync(path24.dirname(statePath), { recursive: true });
|
|
49649
|
-
const write = writeConfigWithTapTapBackupIfChanged(registration.configPath, nextContent, () => {
|
|
49650
|
-
const after = findDshMakerRegistrations(options.dshHome);
|
|
49651
|
-
if (after.some((entry) => entry.configPath === registration.configPath)) {
|
|
49652
|
-
throw new Error("DSH Maker MCP migration validation still found a registration.");
|
|
49653
|
-
}
|
|
49654
|
-
fs23.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
|
|
49655
|
-
`, "utf8");
|
|
49656
|
-
});
|
|
49657
|
-
return {
|
|
49658
|
-
...inspectDshLegacyMakerMcp(options),
|
|
49659
|
-
action: "removed",
|
|
49660
|
-
changed: write.changed,
|
|
49661
|
-
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49662
|
-
state_path: statePath
|
|
49663
|
-
};
|
|
49664
|
-
}
|
|
49665
|
-
function restoreDshLegacyMakerMcp(options = {}) {
|
|
49666
|
-
const makerHome = getMakerHome();
|
|
49667
|
-
const statePath = getDshPluginMigrationStatePath(makerHome);
|
|
49668
|
-
const inspection = inspectDshLegacyMakerMcp(options);
|
|
49669
|
-
const state = readDshMigrationState(statePath);
|
|
49670
|
-
if (!state) {
|
|
49671
|
-
return { ...inspection, action: "not_owned", changed: false };
|
|
49672
|
-
}
|
|
49673
|
-
if (!options.confirm) {
|
|
49674
|
-
throw new Error(
|
|
49675
|
-
"Restoring the legacy DSH Maker MCP registration requires explicit confirmation."
|
|
49676
|
-
);
|
|
49677
|
-
}
|
|
49678
|
-
if (inspection.status === "ambiguous") {
|
|
49679
|
-
throw new Error(
|
|
49680
|
-
`DSH Maker MCP restoration found ${inspection.registration_count} registrations; resolve the duplicates before restoring.`
|
|
49681
|
-
);
|
|
49682
|
-
}
|
|
49683
|
-
if (inspection.status === "active") {
|
|
49684
|
-
const current = findDshMakerRegistrations(options.dshHome)[0];
|
|
49685
|
-
const currentSha = sha2562(JSON.stringify(current.registration));
|
|
49686
|
-
if (currentSha === state.removed_registration_sha256) {
|
|
49687
|
-
fs23.rmSync(statePath, { force: true });
|
|
49688
|
-
return { ...inspection, action: "already_restored", changed: false, state_path: statePath };
|
|
49689
|
-
}
|
|
49690
|
-
return { ...inspection, action: "not_owned", changed: false };
|
|
49691
|
-
}
|
|
49692
|
-
const configPath = state.config_path;
|
|
49693
|
-
const previousContent = fs23.readFileSync(configPath, "utf8");
|
|
49694
|
-
const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
|
|
49695
|
-
if (document.errors.length > 0) {
|
|
49696
|
-
throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
|
|
49697
|
-
}
|
|
49698
|
-
reinsertDshMakerRegistration(document, state.removed_registration);
|
|
49699
|
-
const nextContent = document.toString({ lineWidth: 0 });
|
|
49700
|
-
const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
|
|
49701
|
-
const restored = findDshMakerRegistrations(options.dshHome);
|
|
49702
|
-
const match = restored.find((entry) => entry.configPath === configPath);
|
|
49703
|
-
if (!match || sha2562(JSON.stringify(match.registration)) !== state.removed_registration_sha256) {
|
|
49704
|
-
throw new Error("DSH Maker MCP restoration changed the registration identity.");
|
|
49705
|
-
}
|
|
49706
|
-
fs23.rmSync(statePath, { force: true });
|
|
49707
|
-
});
|
|
49708
|
-
return {
|
|
49709
|
-
...inspectDshLegacyMakerMcp(options),
|
|
49710
|
-
action: "restored",
|
|
49711
|
-
changed: write.changed,
|
|
49712
|
-
...write.backupPath ? { backup_path: write.backupPath } : {},
|
|
49713
|
-
state_path: statePath
|
|
49714
|
-
};
|
|
49715
|
-
}
|
|
49716
|
-
function findDshMakerRegistrations(dshHome) {
|
|
49717
|
-
const resolvedDshHome = dshHome || getDshHome();
|
|
49718
|
-
const configPaths = listDshMcpConfigPaths({ homeDir: os7.homedir(), dshHome: resolvedDshHome });
|
|
49719
|
-
const registrations = [];
|
|
49720
|
-
for (const configPath of configPaths) {
|
|
49721
|
-
if (!fs23.existsSync(configPath)) {
|
|
49722
|
-
continue;
|
|
49723
|
-
}
|
|
49724
|
-
const content = fs23.readFileSync(configPath, "utf8");
|
|
49725
|
-
const document = (0, import_yaml2.parseDocument)(content, { prettyErrors: true });
|
|
49726
|
-
if (document.errors.length > 0) {
|
|
49727
|
-
throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
|
|
49728
|
-
}
|
|
49729
|
-
const candidates = findDshMakerCandidates(document);
|
|
49730
|
-
for (const candidate of candidates) {
|
|
49731
|
-
registrations.push({ configPath, ...candidate });
|
|
49732
|
-
}
|
|
49733
|
-
}
|
|
49734
|
-
return registrations;
|
|
49735
|
-
}
|
|
49736
|
-
function findDshMakerCandidates(document) {
|
|
49737
|
-
const candidates = [];
|
|
49738
|
-
const top = document.contents;
|
|
49739
|
-
if (!(0, import_yaml2.isSeq)(top)) {
|
|
49740
|
-
return candidates;
|
|
49741
|
-
}
|
|
49742
|
-
top.items.forEach((rawPatch, patchIndex) => {
|
|
49743
|
-
const patchNode = rawPatch;
|
|
49744
|
-
const patch = patchNode.toJSON();
|
|
49745
|
-
if (Array.isArray(patch == null ? void 0 : patch.insert)) {
|
|
49746
|
-
const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
|
|
49747
|
-
if (!(0, import_yaml2.isSeq)(insertNode)) {
|
|
49748
|
-
return;
|
|
49749
|
-
}
|
|
49750
|
-
insertNode.items.forEach((rawRow, insertIndex) => {
|
|
49751
|
-
const rowNode = rawRow;
|
|
49752
|
-
const row = rowNode.toJSON();
|
|
49753
|
-
if (isDshMakerPluginCandidate(row)) {
|
|
49754
|
-
candidates.push({
|
|
49755
|
-
patchIndex,
|
|
49756
|
-
insertIndex,
|
|
49757
|
-
registration: row
|
|
49758
|
-
});
|
|
49759
|
-
}
|
|
49760
|
-
});
|
|
49761
|
-
return;
|
|
49762
|
-
}
|
|
49763
|
-
if (isDshMakerPluginCandidate(patch)) {
|
|
49764
|
-
candidates.push({
|
|
49765
|
-
patchIndex,
|
|
49766
|
-
registration: patch
|
|
49767
|
-
});
|
|
49768
|
-
}
|
|
49769
|
-
});
|
|
49770
|
-
return candidates;
|
|
49771
|
-
}
|
|
49772
|
-
function removeDshMakerRegistration(document, registration) {
|
|
49773
|
-
const top = document.contents;
|
|
49774
|
-
if (!(0, import_yaml2.isSeq)(top)) {
|
|
49775
|
-
throw new Error("DSH config top-level value must be a plugin array.");
|
|
49776
|
-
}
|
|
49777
|
-
if (registration.insertIndex !== void 0) {
|
|
49778
|
-
const patchNode = top.items[registration.patchIndex];
|
|
49779
|
-
const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
|
|
49780
|
-
if (!(0, import_yaml2.isSeq)(insertNode)) {
|
|
49781
|
-
throw new Error("Invalid DSH insert patch.");
|
|
49782
|
-
}
|
|
49783
|
-
insertNode.items.splice(registration.insertIndex, 1);
|
|
49784
|
-
if (insertNode.items.length === 0) {
|
|
49785
|
-
top.items.splice(registration.patchIndex, 1);
|
|
49786
|
-
}
|
|
49787
|
-
return;
|
|
49788
|
-
}
|
|
49789
|
-
top.items.splice(registration.patchIndex, 1);
|
|
49790
|
-
}
|
|
49791
|
-
function reinsertDshMakerRegistration(document, registration) {
|
|
49792
|
-
const top = document.contents;
|
|
49793
|
-
if (!(0, import_yaml2.isSeq)(top)) {
|
|
49794
|
-
throw new Error("DSH config top-level value must be a plugin array.");
|
|
49795
|
-
}
|
|
49796
|
-
top.items.push(document.createNode({ insert: [registration] }));
|
|
49797
|
-
}
|
|
49798
|
-
function isDshMakerPluginCandidate(value) {
|
|
49799
|
-
if (!isRecord6(value)) {
|
|
49800
|
-
return false;
|
|
49801
|
-
}
|
|
49802
|
-
if (value.id === DSH_MAKER_PLUGIN_ID) {
|
|
49803
|
-
return true;
|
|
49804
|
-
}
|
|
49805
|
-
const config2 = isRecord6(value.config) ? value.config : void 0;
|
|
49806
|
-
return value.name === DSH_MCP_PLUGIN_NAME && (config2 == null ? void 0 : config2.serverName) === DSH_MAKER_MCP_NAME;
|
|
49807
|
-
}
|
|
49808
|
-
function getDshPluginMigrationStatePath(makerHome) {
|
|
49809
|
-
return path24.join(makerHome, "plugin-migrations", "dsh.json");
|
|
49810
|
-
}
|
|
49811
|
-
function readDshMigrationState(statePath) {
|
|
49812
|
-
if (!fs23.existsSync(statePath)) {
|
|
49813
|
-
return void 0;
|
|
49814
|
-
}
|
|
49815
|
-
try {
|
|
49816
|
-
const state = JSON.parse(fs23.readFileSync(statePath, "utf8"));
|
|
49817
|
-
return (state == null ? void 0 : state.schema_version) === 1 && state.client === "dsh" ? state : void 0;
|
|
49818
|
-
} catch {
|
|
49819
|
-
return void 0;
|
|
49820
|
-
}
|
|
49821
|
-
}
|
|
49822
|
-
function createDshInspection(status, primaryPaths, allPaths) {
|
|
49823
|
-
return {
|
|
49824
|
-
client: "dsh",
|
|
49825
|
-
status,
|
|
49826
|
-
config_path: primaryPaths[0] ?? "",
|
|
49827
|
-
config_paths: allPaths,
|
|
49828
|
-
registration_count: primaryPaths.length
|
|
49829
|
-
};
|
|
49830
|
-
}
|
|
49831
|
-
function sha2562(content) {
|
|
49832
|
-
return crypto4.createHash("sha256").update(content).digest("hex");
|
|
49833
|
-
}
|
|
49834
|
-
function isRecord6(value) {
|
|
49835
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
49836
|
-
}
|
|
49837
|
-
function unique(values) {
|
|
49838
|
-
return [...new Set(values)];
|
|
49839
|
-
}
|
|
49840
|
-
|
|
49841
|
-
// src/maker/cli/workBuddyProjectSkills.ts
|
|
49842
|
-
import fs24 from "node:fs";
|
|
49843
|
-
import path25 from "node:path";
|
|
49844
|
-
function syncWorkBuddyProjectSkills(targetDir, options = {}) {
|
|
49845
|
-
const platform = options.platform ?? process.platform;
|
|
49846
|
-
const projectDir = path25.resolve(targetDir);
|
|
49847
|
-
const sourceDir = path25.join(projectDir, ".installer", "skills");
|
|
49848
|
-
const workBuddySkillsDir = path25.join(projectDir, ".workbuddy", "skills");
|
|
49849
|
-
const result = {
|
|
49850
|
-
status: "skipped",
|
|
49851
|
-
sourceDir,
|
|
49852
|
-
targetDir: workBuddySkillsDir,
|
|
49853
|
-
installedSkills: [],
|
|
49854
|
-
skippedSkills: []
|
|
49855
|
-
};
|
|
49856
|
-
if (!isDirectory(sourceDir)) {
|
|
49857
|
-
result.reason = "source_not_found";
|
|
49858
|
-
return result;
|
|
49859
|
-
}
|
|
49860
|
-
const sourceSkills = fs24.readdirSync(sourceDir, { withFileTypes: true }).filter(
|
|
49861
|
-
(entry) => entry.isDirectory() && fs24.existsSync(path25.join(sourceDir, entry.name, "SKILL.md"))
|
|
49862
|
-
).map((entry) => entry.name).sort();
|
|
49863
|
-
for (const sourceSkillName of sourceSkills) {
|
|
49864
|
-
const workBuddySkillName = `taptap-maker-${sourceSkillName}`;
|
|
49865
|
-
const workBuddySkillDir = path25.join(workBuddySkillsDir, workBuddySkillName);
|
|
49866
|
-
if (pathEntryExists(workBuddySkillDir)) {
|
|
49867
|
-
result.skippedSkills.push(workBuddySkillName);
|
|
49868
|
-
continue;
|
|
49869
|
-
}
|
|
49870
|
-
fs24.mkdirSync(workBuddySkillsDir, { recursive: true });
|
|
49871
|
-
installSkillContents(path25.join(sourceDir, sourceSkillName), workBuddySkillDir, platform);
|
|
49872
|
-
result.installedSkills.push(workBuddySkillName);
|
|
49873
|
-
}
|
|
49874
|
-
if (result.installedSkills.length > 0) {
|
|
49875
|
-
result.status = "installed";
|
|
49876
|
-
}
|
|
49877
|
-
return result;
|
|
49878
|
-
}
|
|
49879
|
-
function installSkillContents(sourceDir, targetDir, platform) {
|
|
49880
|
-
fs24.mkdirSync(targetDir);
|
|
49881
|
-
try {
|
|
49882
|
-
for (const entry of fs24.readdirSync(sourceDir)) {
|
|
49883
|
-
linkOrCopyEntry(path25.join(sourceDir, entry), path25.join(targetDir, entry), platform);
|
|
49884
|
-
}
|
|
49885
|
-
} catch (error2) {
|
|
49886
|
-
fs24.rmSync(targetDir, { recursive: true, force: true });
|
|
49887
|
-
throw error2;
|
|
49888
|
-
}
|
|
49889
|
-
}
|
|
49890
|
-
function linkOrCopyEntry(source, target, platform) {
|
|
49891
|
-
const stat = fs24.statSync(source);
|
|
49892
|
-
if (platform === "win32" && stat.isFile()) {
|
|
49893
|
-
fs24.copyFileSync(source, target);
|
|
49894
|
-
return;
|
|
49895
|
-
}
|
|
49896
|
-
try {
|
|
49897
|
-
const linkTarget = platform === "win32" ? source : path25.relative(path25.dirname(target), source);
|
|
49898
|
-
const linkType = stat.isDirectory() ? platform === "win32" ? "junction" : "dir" : "file";
|
|
49899
|
-
fs24.symlinkSync(linkTarget, target, linkType);
|
|
49900
|
-
} catch (error2) {
|
|
49901
|
-
try {
|
|
49902
|
-
fs24.cpSync(source, target, { recursive: stat.isDirectory() });
|
|
49903
|
-
} catch (copyError) {
|
|
49904
|
-
throw new Error(
|
|
49905
|
-
`Failed to install WorkBuddy project skill entry ${source}: ${formatError3(error2)}; copy fallback: ${formatError3(copyError)}`
|
|
49906
|
-
);
|
|
49907
|
-
}
|
|
49908
|
-
}
|
|
49909
|
-
}
|
|
49910
|
-
function isDirectory(value) {
|
|
49911
|
-
try {
|
|
49912
|
-
return fs24.statSync(value).isDirectory();
|
|
49913
|
-
} catch {
|
|
49914
|
-
return false;
|
|
49915
|
-
}
|
|
49916
|
-
}
|
|
49917
|
-
function pathEntryExists(value) {
|
|
49918
|
-
try {
|
|
49919
|
-
fs24.lstatSync(value);
|
|
49920
|
-
return true;
|
|
49921
|
-
} catch {
|
|
49922
|
-
return false;
|
|
49923
|
-
}
|
|
49924
|
-
}
|
|
49925
|
-
function formatError3(error2) {
|
|
49926
|
-
return error2 instanceof Error ? error2.message : String(error2);
|
|
49927
|
-
}
|
|
49928
|
-
|
|
49929
48753
|
// src/maker/cli/commands.ts
|
|
49930
|
-
var VERSION2 = true ? "0.0.
|
|
48754
|
+
var VERSION2 = true ? "0.0.32-beta.1" : "dev";
|
|
49931
48755
|
var DEFAULT_MCP_NAME = "taptap-maker";
|
|
49932
48756
|
var MAKER_NPM_PACKAGE = "@taptap/maker";
|
|
49933
|
-
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
|
|
49934
|
-
"pat",
|
|
49935
|
-
"mcp",
|
|
49936
|
-
"dev-kit",
|
|
49937
|
-
"logs",
|
|
49938
|
-
"python",
|
|
49939
|
-
"lua-lsp",
|
|
49940
|
-
"agents",
|
|
49941
|
-
"plugin"
|
|
49942
|
-
]);
|
|
48757
|
+
var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
|
|
49943
48758
|
var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
49944
48759
|
"json",
|
|
49945
48760
|
"skip_confirm",
|
|
@@ -49950,7 +48765,6 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
49950
48765
|
"all",
|
|
49951
48766
|
"create",
|
|
49952
48767
|
"consent",
|
|
49953
|
-
"confirm",
|
|
49954
48768
|
"context_stdin",
|
|
49955
48769
|
"h",
|
|
49956
48770
|
"help"
|
|
@@ -50009,10 +48823,6 @@ async function runMakerCli(argv) {
|
|
|
50009
48823
|
await runAgentsUpdate(parsed, ctx);
|
|
50010
48824
|
return;
|
|
50011
48825
|
}
|
|
50012
|
-
if (command === "plugin") {
|
|
50013
|
-
runPluginLifecycle(parsed, ctx);
|
|
50014
|
-
return;
|
|
50015
|
-
}
|
|
50016
48826
|
if (command === "upgrade") {
|
|
50017
48827
|
await runUpgrade(parsed, ctx);
|
|
50018
48828
|
return;
|
|
@@ -50035,57 +48845,6 @@ async function runMakerCli(argv) {
|
|
|
50035
48845
|
}
|
|
50036
48846
|
throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
|
|
50037
48847
|
}
|
|
50038
|
-
function runPluginLifecycle(parsed, ctx) {
|
|
50039
|
-
const subcommand = parsed.command[1];
|
|
50040
|
-
const client = stringOption(parsed, "client") || "codex";
|
|
50041
|
-
if (client !== "codex" && client !== "workbuddy" && client !== "dsh") {
|
|
50042
|
-
throw new Error(
|
|
50043
|
-
`Unsupported Maker plugin client: ${client}. Supported clients: codex, workbuddy, dsh.`
|
|
50044
|
-
);
|
|
50045
|
-
}
|
|
50046
|
-
if (subcommand === "inspect") {
|
|
50047
|
-
writePluginLifecycleResult(
|
|
50048
|
-
ctx,
|
|
50049
|
-
client === "codex" ? inspectCodexLegacyMakerMcp() : client === "workbuddy" ? inspectWorkBuddyLegacyMakerMcp() : inspectDshLegacyMakerMcp()
|
|
50050
|
-
);
|
|
50051
|
-
return;
|
|
50052
|
-
}
|
|
50053
|
-
if (subcommand === "migrate") {
|
|
50054
|
-
writePluginLifecycleResult(
|
|
50055
|
-
ctx,
|
|
50056
|
-
client === "codex" ? migrateCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? migrateWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : migrateDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
|
|
50057
|
-
);
|
|
50058
|
-
return;
|
|
50059
|
-
}
|
|
50060
|
-
if (subcommand === "restore") {
|
|
50061
|
-
writePluginLifecycleResult(
|
|
50062
|
-
ctx,
|
|
50063
|
-
client === "codex" ? restoreCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? restoreWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : restoreDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
|
|
50064
|
-
);
|
|
50065
|
-
return;
|
|
50066
|
-
}
|
|
50067
|
-
throw new Error("Unknown Maker plugin command. Use inspect, migrate, or restore.");
|
|
50068
|
-
}
|
|
50069
|
-
function writePluginLifecycleResult(ctx, result) {
|
|
50070
|
-
if (ctx.json) {
|
|
50071
|
-
writeJson(result);
|
|
50072
|
-
return;
|
|
50073
|
-
}
|
|
50074
|
-
process.stdout.write(
|
|
50075
|
-
[
|
|
50076
|
-
"TapTap Maker plugin migration",
|
|
50077
|
-
"",
|
|
50078
|
-
`- client: ${result.client}`,
|
|
50079
|
-
`- legacy_mcp_status: ${result.status}`,
|
|
50080
|
-
`- config_path: ${result.config_path}`,
|
|
50081
|
-
..."config_paths" in result && result.config_paths.length > 1 ? [`- config_paths: ${result.config_paths.join(", ")}`] : [],
|
|
50082
|
-
`- registration_count: ${result.registration_count}`,
|
|
50083
|
-
..."action" in result ? [`- action: ${result.action}`, `- changed: ${result.changed}`] : [],
|
|
50084
|
-
..."backup_path" in result && result.backup_path ? [`- backup_path: ${result.backup_path}`] : [],
|
|
50085
|
-
""
|
|
50086
|
-
].join("\n")
|
|
50087
|
-
);
|
|
50088
|
-
}
|
|
50089
48848
|
function parseArgs(argv) {
|
|
50090
48849
|
const command = [];
|
|
50091
48850
|
const positionals = [];
|
|
@@ -50133,7 +48892,7 @@ function toOptionKey(value) {
|
|
|
50133
48892
|
}
|
|
50134
48893
|
async function runInit(parsed, ctx) {
|
|
50135
48894
|
rejectPackageOption(parsed);
|
|
50136
|
-
const targetDir =
|
|
48895
|
+
const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
50137
48896
|
const env = makerEnvOption(parsed);
|
|
50138
48897
|
const skipConfirm = booleanOption(parsed, "skip_confirm");
|
|
50139
48898
|
const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
|
|
@@ -50248,7 +49007,7 @@ async function runInit(parsed, ctx) {
|
|
|
50248
49007
|
}
|
|
50249
49008
|
async function runDoctor(parsed, ctx) {
|
|
50250
49009
|
var _a3, _b;
|
|
50251
|
-
const targetDir =
|
|
49010
|
+
const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
50252
49011
|
const env = makerEnvOption(parsed);
|
|
50253
49012
|
const git = checkGitEnvironment();
|
|
50254
49013
|
const python = checkMakerPythonEnvironment();
|
|
@@ -50339,8 +49098,8 @@ async function runDoctor(parsed, ctx) {
|
|
|
50339
49098
|
);
|
|
50340
49099
|
}
|
|
50341
49100
|
function inspectMakerDoctorExecutionContext(options) {
|
|
50342
|
-
const doctorCwd =
|
|
50343
|
-
const makerProjectDir = options.makerProjectDir ?
|
|
49101
|
+
const doctorCwd = path22.resolve(process.cwd());
|
|
49102
|
+
const makerProjectDir = options.makerProjectDir ? path22.resolve(options.makerProjectDir) : void 0;
|
|
50344
49103
|
if (!makerProjectDir) {
|
|
50345
49104
|
return {
|
|
50346
49105
|
active_client_session: "not_checked",
|
|
@@ -50375,9 +49134,9 @@ function samePath2(left, right) {
|
|
|
50375
49134
|
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
50376
49135
|
}
|
|
50377
49136
|
function normalizePathForCompare3(value) {
|
|
50378
|
-
const resolved =
|
|
49137
|
+
const resolved = path22.resolve(value);
|
|
50379
49138
|
try {
|
|
50380
|
-
return
|
|
49139
|
+
return fs21.realpathSync.native(resolved);
|
|
50381
49140
|
} catch {
|
|
50382
49141
|
return resolved;
|
|
50383
49142
|
}
|
|
@@ -50695,7 +49454,7 @@ async function runPatSet(parsed, ctx) {
|
|
|
50695
49454
|
}
|
|
50696
49455
|
async function resolvePatSet(parsed, ctx) {
|
|
50697
49456
|
if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
|
|
50698
|
-
const pat =
|
|
49457
|
+
const pat = fs21.readFileSync(0, "utf8").trim();
|
|
50699
49458
|
if (!pat) {
|
|
50700
49459
|
throw new Error("No PAT found on stdin.");
|
|
50701
49460
|
}
|
|
@@ -50750,17 +49509,17 @@ async function prepareMcpLauncher(options) {
|
|
|
50750
49509
|
if (options.mode === "self") {
|
|
50751
49510
|
launcher = materializeMakerSelfLauncher({
|
|
50752
49511
|
version: VERSION2,
|
|
50753
|
-
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(
|
|
49512
|
+
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(path22.resolve(process.cwd(), "dist", "maker.js")).href,
|
|
50754
49513
|
makerHome: getMakerHome()
|
|
50755
49514
|
});
|
|
50756
49515
|
} else {
|
|
50757
49516
|
const packageSpec = resolveMakerPackageSpec(MAKER_NPM_PACKAGE, VERSION2);
|
|
50758
49517
|
launcher = resolveMakerMcpLauncher({ packageName: packageSpec });
|
|
50759
49518
|
const configuredCache = process.env.npm_config_cache || process.env.NPM_CONFIG_CACHE;
|
|
50760
|
-
const npmCacheDir =
|
|
50761
|
-
configuredCache ||
|
|
49519
|
+
const npmCacheDir = path22.resolve(
|
|
49520
|
+
configuredCache || path22.join(getMakerHome(), "cache", "npm")
|
|
50762
49521
|
);
|
|
50763
|
-
|
|
49522
|
+
fs21.mkdirSync(npmCacheDir, { recursive: true });
|
|
50764
49523
|
launcherEnv = { npm_config_cache: npmCacheDir };
|
|
50765
49524
|
}
|
|
50766
49525
|
} catch (error2) {
|
|
@@ -50893,37 +49652,14 @@ ${indent3(payload.stderr)}` : "",
|
|
|
50893
49652
|
}
|
|
50894
49653
|
async function runMcpReport(parsed, ctx) {
|
|
50895
49654
|
rejectPackageOption(parsed);
|
|
50896
|
-
const targetDir =
|
|
49655
|
+
const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
50897
49656
|
const contextInput = booleanOption(parsed, "context_stdin") ? await readStdinText() : "";
|
|
50898
49657
|
const context = parseMakerMcpReportContext(contextInput);
|
|
50899
|
-
const reportRuntime = resolveMakerMcpReportRuntime({
|
|
50900
|
-
distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
|
|
50901
|
-
bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : void 0
|
|
50902
|
-
});
|
|
50903
49658
|
const diagnostics = await collectMakerMcpIssueDiagnostics({
|
|
50904
|
-
ide: stringOption(parsed, "ide")
|
|
49659
|
+
ide: stringOption(parsed, "ide"),
|
|
50905
49660
|
targetDir,
|
|
50906
49661
|
makerVersion: VERSION2,
|
|
50907
|
-
configSource: reportRuntime == null ? void 0 : reportRuntime.config_source,
|
|
50908
|
-
distribution: reportRuntime == null ? void 0 : reportRuntime.distribution,
|
|
50909
49662
|
verify: async () => {
|
|
50910
|
-
if (reportRuntime) {
|
|
50911
|
-
const verification = await verifyMakerMcpLauncher(reportRuntime.launcher, {
|
|
50912
|
-
cwd: reportRuntime.cwd,
|
|
50913
|
-
env: reportRuntime.env,
|
|
50914
|
-
timeoutMs: 15e3
|
|
50915
|
-
});
|
|
50916
|
-
return {
|
|
50917
|
-
ok: verification.ok,
|
|
50918
|
-
stage: verification.stage,
|
|
50919
|
-
launcher_kind: verification.launcherKind,
|
|
50920
|
-
command: verification.command,
|
|
50921
|
-
tools: verification.toolNames,
|
|
50922
|
-
stderr: verification.stderr,
|
|
50923
|
-
error: verification.error,
|
|
50924
|
-
failure_type: verification.failureType
|
|
50925
|
-
};
|
|
50926
|
-
}
|
|
50927
49663
|
const prepared = await prepareMcpLauncher({
|
|
50928
49664
|
env: makerEnvOption(parsed),
|
|
50929
49665
|
mode: "self"
|
|
@@ -50946,7 +49682,7 @@ async function runMcpReport(parsed, ctx) {
|
|
|
50946
49682
|
const issue3 = buildMakerMcpIssue({
|
|
50947
49683
|
context,
|
|
50948
49684
|
diagnostics,
|
|
50949
|
-
homeDir:
|
|
49685
|
+
homeDir: os6.homedir()
|
|
50950
49686
|
});
|
|
50951
49687
|
const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
|
|
50952
49688
|
status: "consent_required",
|
|
@@ -50973,7 +49709,7 @@ async function runMcpReport(parsed, ctx) {
|
|
|
50973
49709
|
);
|
|
50974
49710
|
}
|
|
50975
49711
|
async function runAgentsUpdate(parsed, ctx) {
|
|
50976
|
-
const targetDir =
|
|
49712
|
+
const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
50977
49713
|
const result = updateMakerAgentsPolicy(targetDir);
|
|
50978
49714
|
if (ctx.json) {
|
|
50979
49715
|
writeJson(result);
|
|
@@ -50992,25 +49728,21 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
50992
49728
|
async function runUpgrade(parsed, ctx) {
|
|
50993
49729
|
rejectPackageOption(parsed);
|
|
50994
49730
|
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
50995
|
-
const targetDir =
|
|
49731
|
+
const targetDir = path22.resolve(explicitTargetDir || process.cwd());
|
|
50996
49732
|
const env = makerEnvOption(parsed);
|
|
50997
49733
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
50998
|
-
const
|
|
50999
|
-
|
|
51000
|
-
|
|
51001
|
-
|
|
51002
|
-
if (!prepared.ok) {
|
|
51003
|
-
writeMcpLauncherFailure(ctx, prepared);
|
|
51004
|
-
return;
|
|
51005
|
-
}
|
|
51006
|
-
installResults = installMcpConfigs({
|
|
51007
|
-
ides: ides.length > 0 ? ides : getDefaultMcpInstallIdes(),
|
|
51008
|
-
env: makerMcpConfigEnvOption(parsed),
|
|
51009
|
-
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
51010
|
-
launcher: prepared.launcher,
|
|
51011
|
-
launcherEnv: prepared.launcherEnv
|
|
51012
|
-
});
|
|
49734
|
+
const prepared = await prepareMcpLauncher({ env, mode: mcpLauncherOption(parsed) });
|
|
49735
|
+
if (!prepared.ok) {
|
|
49736
|
+
writeMcpLauncherFailure(ctx, prepared);
|
|
49737
|
+
return;
|
|
51013
49738
|
}
|
|
49739
|
+
const installResults = installMcpConfigs({
|
|
49740
|
+
ides: ides.length > 0 ? ides : getDefaultMcpInstallIdes(),
|
|
49741
|
+
env: makerMcpConfigEnvOption(parsed),
|
|
49742
|
+
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
49743
|
+
launcher: prepared.launcher,
|
|
49744
|
+
launcherEnv: prepared.launcherEnv
|
|
49745
|
+
});
|
|
51014
49746
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
51015
49747
|
const agentsResult = identify.projectRoot ? updateMakerAgentsPolicy(identify.projectRoot) : void 0;
|
|
51016
49748
|
const payload = {
|
|
@@ -51021,8 +49753,7 @@ async function runUpgrade(parsed, ctx) {
|
|
|
51021
49753
|
agents_policy: agentsResult,
|
|
51022
49754
|
restart_required: false,
|
|
51023
49755
|
apply_mode: "next_mcp_start",
|
|
51024
|
-
current_session: "preserved"
|
|
51025
|
-
plugin_distribution: pluginDistribution == null ? void 0 : pluginDistribution.id
|
|
49756
|
+
current_session: "preserved"
|
|
51026
49757
|
};
|
|
51027
49758
|
if (!payload.ok) {
|
|
51028
49759
|
process.exitCode = 1;
|
|
@@ -51033,9 +49764,9 @@ async function runUpgrade(parsed, ctx) {
|
|
|
51033
49764
|
}
|
|
51034
49765
|
process.stdout.write(
|
|
51035
49766
|
[
|
|
51036
|
-
|
|
49767
|
+
payload.ok ? "TapTap Maker upgrade completed" : "TapTap Maker upgrade completed with errors",
|
|
51037
49768
|
"",
|
|
51038
|
-
...
|
|
49769
|
+
...installResults.map((result) => result.message),
|
|
51039
49770
|
"",
|
|
51040
49771
|
agentsResult ? [
|
|
51041
49772
|
agentsResult.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
|
|
@@ -51043,8 +49774,8 @@ async function runUpgrade(parsed, ctx) {
|
|
|
51043
49774
|
`- previous_status: ${agentsResult.previousStatus}`
|
|
51044
49775
|
].join("\n") : "AGENTS.md managed policy skipped: current directory is not bound to a Maker project.",
|
|
51045
49776
|
"",
|
|
51046
|
-
|
|
51047
|
-
|
|
49777
|
+
"Current MCP session remains unchanged and continues using the existing version.",
|
|
49778
|
+
"The updated package and AGENTS.md will take effect on the next MCP start or user-requested reconnect.",
|
|
51048
49779
|
""
|
|
51049
49780
|
].join("\n")
|
|
51050
49781
|
);
|
|
@@ -51081,20 +49812,19 @@ function getMcpVerifyNextSteps(mode, commandText) {
|
|
|
51081
49812
|
];
|
|
51082
49813
|
}
|
|
51083
49814
|
async function runDevKitUpdate(parsed, ctx) {
|
|
51084
|
-
const targetDir =
|
|
49815
|
+
const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
51085
49816
|
const result = await installAiDevKit({
|
|
51086
49817
|
targetDir,
|
|
51087
49818
|
preserveExisting: false,
|
|
51088
49819
|
replaceManagedEntries: true,
|
|
51089
49820
|
environment: makerEnvOption(parsed)
|
|
51090
49821
|
});
|
|
51091
|
-
syncWorkBuddyDevKitSkills(targetDir, ctx);
|
|
51092
49822
|
finalizeStagedDevKitGitignore(targetDir);
|
|
51093
49823
|
emit(ctx, "dev_kit", formatDevKitInstallMessage("AI dev kit updated", result), result);
|
|
51094
49824
|
emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
|
|
51095
49825
|
}
|
|
51096
49826
|
async function runLogsWatch(parsed, ctx) {
|
|
51097
|
-
const targetDir =
|
|
49827
|
+
const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
51098
49828
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
51099
49829
|
const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
51100
49830
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
@@ -51104,9 +49834,9 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
51104
49834
|
serverUrl: stringOption(parsed, "server_url"),
|
|
51105
49835
|
env: makerEnvOption(parsed)
|
|
51106
49836
|
});
|
|
51107
|
-
const runtimeDir =
|
|
51108
|
-
const runtimeLog =
|
|
51109
|
-
const pidFile =
|
|
49837
|
+
const runtimeDir = path22.join(proxy.projectRoot, ".maker", "logs", "runtime");
|
|
49838
|
+
const runtimeLog = path22.join(runtimeDir, "runtime.log");
|
|
49839
|
+
const pidFile = path22.join(runtimeDir, "watcher.pid");
|
|
51110
49840
|
const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
|
|
51111
49841
|
const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
|
|
51112
49842
|
emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
|
|
@@ -51151,10 +49881,10 @@ async function runLogsWatch(parsed, ctx) {
|
|
|
51151
49881
|
}
|
|
51152
49882
|
}
|
|
51153
49883
|
function registerRuntimeLogWatcherProcess(pidFile) {
|
|
51154
|
-
|
|
49884
|
+
fs21.mkdirSync(path22.dirname(pidFile), { recursive: true });
|
|
51155
49885
|
const existingPid = readPidFile(pidFile);
|
|
51156
49886
|
const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
|
|
51157
|
-
|
|
49887
|
+
fs21.writeFileSync(
|
|
51158
49888
|
pidFile,
|
|
51159
49889
|
`${JSON.stringify(
|
|
51160
49890
|
{
|
|
@@ -51172,10 +49902,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
|
|
|
51172
49902
|
return previous;
|
|
51173
49903
|
}
|
|
51174
49904
|
function readPidFile(pidFile) {
|
|
51175
|
-
if (!
|
|
49905
|
+
if (!fs21.existsSync(pidFile)) {
|
|
51176
49906
|
return void 0;
|
|
51177
49907
|
}
|
|
51178
|
-
const raw =
|
|
49908
|
+
const raw = fs21.readFileSync(pidFile, "utf8").trim();
|
|
51179
49909
|
let pid = Number(raw);
|
|
51180
49910
|
if (!Number.isInteger(pid) || pid <= 0) {
|
|
51181
49911
|
try {
|
|
@@ -51195,7 +49925,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
|
|
|
51195
49925
|
}
|
|
51196
49926
|
cleaned = true;
|
|
51197
49927
|
if (readPidFile(pidFile) === process.pid) {
|
|
51198
|
-
|
|
49928
|
+
fs21.rmSync(pidFile, { force: true });
|
|
51199
49929
|
}
|
|
51200
49930
|
};
|
|
51201
49931
|
process.once("exit", cleanup);
|
|
@@ -51346,10 +50076,9 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
51346
50076
|
onStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
51347
50077
|
});
|
|
51348
50078
|
writeDevKitStagedGitignore(
|
|
51349
|
-
|
|
50079
|
+
path22.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
51350
50080
|
listPresentDevKitManagedEntries(targetDir)
|
|
51351
50081
|
);
|
|
51352
|
-
syncWorkBuddyDevKitSkills(targetDir, ctx);
|
|
51353
50082
|
if (options.finalizeGitignore) {
|
|
51354
50083
|
finalizeStagedDevKitGitignore(targetDir);
|
|
51355
50084
|
}
|
|
@@ -51364,7 +50093,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
|
|
|
51364
50093
|
);
|
|
51365
50094
|
} catch (error2) {
|
|
51366
50095
|
writeDevKitStagedGitignore(
|
|
51367
|
-
|
|
50096
|
+
path22.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
|
|
51368
50097
|
listPresentDevKitManagedEntries(targetDir)
|
|
51369
50098
|
);
|
|
51370
50099
|
if (options.finalizeGitignore) {
|
|
@@ -51385,7 +50114,6 @@ ${detail}`, {
|
|
|
51385
50114
|
environment: options.environment,
|
|
51386
50115
|
onSkillInstallerStart: (event) => emitSkillInstallerStart(ctx, event)
|
|
51387
50116
|
});
|
|
51388
|
-
syncWorkBuddyDevKitSkills(targetDir, ctx);
|
|
51389
50117
|
if (options.finalizeGitignore) {
|
|
51390
50118
|
finalizeStagedDevKitGitignore(targetDir);
|
|
51391
50119
|
}
|
|
@@ -51403,38 +50131,6 @@ ${detail}`, {
|
|
|
51403
50131
|
});
|
|
51404
50132
|
}
|
|
51405
50133
|
}
|
|
51406
|
-
function syncWorkBuddyDevKitSkills(targetDir, ctx) {
|
|
51407
|
-
var _a3;
|
|
51408
|
-
if (((_a3 = resolveMakerPluginDistribution()) == null ? void 0 : _a3.client) !== "workbuddy") {
|
|
51409
|
-
return;
|
|
51410
|
-
}
|
|
51411
|
-
try {
|
|
51412
|
-
const result = syncWorkBuddyProjectSkills(targetDir);
|
|
51413
|
-
const managedSkillPaths = [...result.installedSkills, ...result.skippedSkills].map(
|
|
51414
|
-
(skillName) => path26.join(".workbuddy", "skills", skillName)
|
|
51415
|
-
);
|
|
51416
|
-
if (managedSkillPaths.length > 0) {
|
|
51417
|
-
writeDevKitStagedGitignore(path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
|
|
51418
|
-
...listPresentDevKitManagedEntries(targetDir),
|
|
51419
|
-
...managedSkillPaths
|
|
51420
|
-
]);
|
|
51421
|
-
}
|
|
51422
|
-
if (result.installedSkills.length > 0) {
|
|
51423
|
-
emit(
|
|
51424
|
-
ctx,
|
|
51425
|
-
"dev_kit",
|
|
51426
|
-
`WorkBuddy project skills installed: ${result.installedSkills.length}`,
|
|
51427
|
-
result
|
|
51428
|
-
);
|
|
51429
|
-
}
|
|
51430
|
-
} catch (error2) {
|
|
51431
|
-
const detail = error2 instanceof Error ? error2.message : String(error2);
|
|
51432
|
-
emit(ctx, "dev_kit_warning", `WorkBuddy project skills install failed
|
|
51433
|
-
${detail}`, {
|
|
51434
|
-
error: detail
|
|
51435
|
-
});
|
|
51436
|
-
}
|
|
51437
|
-
}
|
|
51438
50134
|
function formatDevKitInstallMessage(message, result) {
|
|
51439
50135
|
if (!result.skillInstaller) {
|
|
51440
50136
|
return message;
|
|
@@ -51491,12 +50187,12 @@ function installMcpConfig(ide, options) {
|
|
|
51491
50187
|
}
|
|
51492
50188
|
function installMcpConfigUnsafe(ide, options) {
|
|
51493
50189
|
if (ide === "codex") {
|
|
51494
|
-
const configPath =
|
|
50190
|
+
const configPath = path22.join(os6.homedir(), ".codex", "config.toml");
|
|
51495
50191
|
const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
|
|
51496
50192
|
return [createMcpInstallResult(ide, "Codex", configPath, write)];
|
|
51497
50193
|
}
|
|
51498
50194
|
if (ide === "cursor") {
|
|
51499
|
-
const configPath =
|
|
50195
|
+
const configPath = path22.join(os6.homedir(), ".cursor", "mcp.json");
|
|
51500
50196
|
const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
|
|
51501
50197
|
return [createMcpInstallResult(ide, "Cursor", configPath, write)];
|
|
51502
50198
|
}
|
|
@@ -51513,7 +50209,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
51513
50209
|
}
|
|
51514
50210
|
];
|
|
51515
50211
|
}
|
|
51516
|
-
const configPath =
|
|
50212
|
+
const configPath = path22.join(os6.homedir(), ".claude.json");
|
|
51517
50213
|
const write = mergeJsonMcpConfig(configPath, claudeOptions);
|
|
51518
50214
|
return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
|
|
51519
50215
|
}
|
|
@@ -51527,7 +50223,7 @@ function installMcpConfigUnsafe(ide, options) {
|
|
|
51527
50223
|
}
|
|
51528
50224
|
if (ide === "opencode") {
|
|
51529
50225
|
const configPath = getOpenCodeMcpConfigPath();
|
|
51530
|
-
if (!
|
|
50226
|
+
if (!fs21.existsSync(configPath)) {
|
|
51531
50227
|
return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
|
|
51532
50228
|
}
|
|
51533
50229
|
const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
|
|
@@ -51610,13 +50306,13 @@ function getDefaultMcpInstallIdes() {
|
|
|
51610
50306
|
if (getTraeMcpInstallPaths().length > 0) {
|
|
51611
50307
|
ides.push("trae");
|
|
51612
50308
|
}
|
|
51613
|
-
if (
|
|
50309
|
+
if (fs21.existsSync(getOpenCodeMcpConfigPath())) {
|
|
51614
50310
|
ides.push("opencode");
|
|
51615
50311
|
}
|
|
51616
50312
|
if (getWorkBuddyMcpInstallPaths().length > 0) {
|
|
51617
50313
|
ides.push("workbuddy");
|
|
51618
50314
|
}
|
|
51619
|
-
if (
|
|
50315
|
+
if (fs21.existsSync(getDshHome())) {
|
|
51620
50316
|
ides.push("dsh");
|
|
51621
50317
|
}
|
|
51622
50318
|
return ides;
|
|
@@ -51630,7 +50326,7 @@ function getExistingTraeUserConfigPaths(paths) {
|
|
|
51630
50326
|
const seen = /* @__PURE__ */ new Set();
|
|
51631
50327
|
return paths.filter((configPath) => {
|
|
51632
50328
|
const key = normalizeConfigPathKey(configPath);
|
|
51633
|
-
if (seen.has(key) || !
|
|
50329
|
+
if (seen.has(key) || !fs21.existsSync(path22.dirname(configPath))) {
|
|
51634
50330
|
return false;
|
|
51635
50331
|
}
|
|
51636
50332
|
seen.add(key);
|
|
@@ -51641,7 +50337,7 @@ function getExistingConfigPaths(paths) {
|
|
|
51641
50337
|
const seen = /* @__PURE__ */ new Set();
|
|
51642
50338
|
return paths.filter((configPath) => {
|
|
51643
50339
|
const key = normalizeConfigPathKey(configPath);
|
|
51644
|
-
if (seen.has(key) || !
|
|
50340
|
+
if (seen.has(key) || !fs21.existsSync(configPath)) {
|
|
51645
50341
|
return false;
|
|
51646
50342
|
}
|
|
51647
50343
|
seen.add(key);
|
|
@@ -51649,62 +50345,62 @@ function getExistingConfigPaths(paths) {
|
|
|
51649
50345
|
});
|
|
51650
50346
|
}
|
|
51651
50347
|
function normalizeConfigPathKey(configPath) {
|
|
51652
|
-
const resolved =
|
|
50348
|
+
const resolved = path22.resolve(configPath);
|
|
51653
50349
|
return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
|
|
51654
50350
|
}
|
|
51655
50351
|
function getTraeSoloMcpConfigPaths() {
|
|
51656
50352
|
if (process.platform === "win32") {
|
|
51657
|
-
const roaming = process.env.APPDATA ||
|
|
50353
|
+
const roaming = process.env.APPDATA || path22.join(os6.homedir(), "AppData", "Roaming");
|
|
51658
50354
|
return [
|
|
51659
|
-
|
|
51660
|
-
|
|
50355
|
+
path22.join(roaming, "TRAE SOLO", "User", "mcp.json"),
|
|
50356
|
+
path22.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
|
|
51661
50357
|
];
|
|
51662
50358
|
}
|
|
51663
|
-
const appSupport =
|
|
50359
|
+
const appSupport = path22.join(os6.homedir(), "Library", "Application Support");
|
|
51664
50360
|
return [
|
|
51665
|
-
|
|
51666
|
-
|
|
50361
|
+
path22.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
|
|
50362
|
+
path22.join(appSupport, "TRAE SOLO", "User", "mcp.json")
|
|
51667
50363
|
];
|
|
51668
50364
|
}
|
|
51669
50365
|
function getTraeUnverifiedMcpConfigPaths() {
|
|
51670
50366
|
if (process.platform === "win32") {
|
|
51671
|
-
const roaming = process.env.APPDATA ||
|
|
50367
|
+
const roaming = process.env.APPDATA || path22.join(os6.homedir(), "AppData", "Roaming");
|
|
51672
50368
|
return [
|
|
51673
|
-
|
|
51674
|
-
|
|
51675
|
-
|
|
50369
|
+
path22.join(roaming, "Trae", "User", "mcp.json"),
|
|
50370
|
+
path22.join(roaming, "TRAE", "User", "mcp.json"),
|
|
50371
|
+
path22.join(roaming, "Trae CN", "User", "mcp.json")
|
|
51676
50372
|
];
|
|
51677
50373
|
}
|
|
51678
|
-
const appSupport =
|
|
50374
|
+
const appSupport = path22.join(os6.homedir(), "Library", "Application Support");
|
|
51679
50375
|
return [
|
|
51680
|
-
|
|
51681
|
-
|
|
51682
|
-
|
|
50376
|
+
path22.join(appSupport, "Trae", "User", "mcp.json"),
|
|
50377
|
+
path22.join(appSupport, "TRAE", "User", "mcp.json"),
|
|
50378
|
+
path22.join(appSupport, "Trae CN", "User", "mcp.json")
|
|
51683
50379
|
];
|
|
51684
50380
|
}
|
|
51685
50381
|
function getOpenCodeMcpConfigPath() {
|
|
51686
|
-
return
|
|
50382
|
+
return path22.join(os6.homedir(), ".config", "opencode", "opencode.jsonc");
|
|
51687
50383
|
}
|
|
51688
50384
|
function getWorkBuddyHome() {
|
|
51689
|
-
return
|
|
50385
|
+
return path22.join(os6.homedir(), ".workbuddy");
|
|
51690
50386
|
}
|
|
51691
50387
|
function getWorkBuddyMcpInstallPaths(options = {}) {
|
|
51692
|
-
const primary =
|
|
51693
|
-
if (
|
|
50388
|
+
const primary = path22.join(getWorkBuddyHome(), "mcp.json");
|
|
50389
|
+
if (fs21.existsSync(primary) || options.createPrimary) {
|
|
51694
50390
|
return [primary];
|
|
51695
50391
|
}
|
|
51696
|
-
const legacy =
|
|
51697
|
-
if (
|
|
50392
|
+
const legacy = path22.join(getWorkBuddyHome(), ".mcp.json");
|
|
50393
|
+
if (fs21.existsSync(legacy)) {
|
|
51698
50394
|
return [legacy];
|
|
51699
50395
|
}
|
|
51700
50396
|
return [];
|
|
51701
50397
|
}
|
|
51702
50398
|
function inspectWorkBuddyTrustState(mcpName) {
|
|
51703
50399
|
const workbuddyHome = getWorkBuddyHome();
|
|
51704
|
-
const connectorsDir =
|
|
50400
|
+
const connectorsDir = path22.join(workbuddyHome, "connectors");
|
|
51705
50401
|
const accounts = [];
|
|
51706
50402
|
const stateFiles = [];
|
|
51707
|
-
if (!
|
|
50403
|
+
if (!fs21.existsSync(connectorsDir)) {
|
|
51708
50404
|
return {
|
|
51709
50405
|
status: "not_found",
|
|
51710
50406
|
mcp_name: mcpName,
|
|
@@ -51714,12 +50410,12 @@ function inspectWorkBuddyTrustState(mcpName) {
|
|
|
51714
50410
|
accounts
|
|
51715
50411
|
};
|
|
51716
50412
|
}
|
|
51717
|
-
for (const entry of
|
|
50413
|
+
for (const entry of fs21.readdirSync(connectorsDir, { withFileTypes: true })) {
|
|
51718
50414
|
if (!entry.isDirectory()) {
|
|
51719
50415
|
continue;
|
|
51720
50416
|
}
|
|
51721
|
-
const statePath =
|
|
51722
|
-
if (!
|
|
50417
|
+
const statePath = path22.join(connectorsDir, entry.name, "connector-states.json");
|
|
50418
|
+
if (!fs21.existsSync(statePath)) {
|
|
51723
50419
|
continue;
|
|
51724
50420
|
}
|
|
51725
50421
|
stateFiles.push(statePath);
|
|
@@ -51798,7 +50494,7 @@ function mergeJsonMcpConfig(configPath, options) {
|
|
|
51798
50494
|
);
|
|
51799
50495
|
}
|
|
51800
50496
|
function mergeOpenCodeMcpConfig(configPath, options) {
|
|
51801
|
-
const rawContent =
|
|
50497
|
+
const rawContent = fs21.readFileSync(configPath, "utf8");
|
|
51802
50498
|
const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
|
|
51803
50499
|
const existing = readJsonObject(configPath, { jsonc: true });
|
|
51804
50500
|
const mcp = asObject(existing.mcp);
|
|
@@ -51830,21 +50526,20 @@ function mergeOpenCodeMcpConfig(configPath, options) {
|
|
|
51830
50526
|
return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
|
|
51831
50527
|
}
|
|
51832
50528
|
function mergeCodexMcpConfig(configPath, options) {
|
|
51833
|
-
const existing =
|
|
51834
|
-
const
|
|
50529
|
+
const existing = fs21.existsSync(configPath) ? fs21.readFileSync(configPath, "utf8") : "";
|
|
50530
|
+
const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
|
|
50531
|
+
const withoutOld = existing.replace(sectionPattern, "").trimEnd();
|
|
51835
50532
|
const launch = options.launcher;
|
|
51836
50533
|
const envValues = createMcpEnvironmentValues(options.env, options.clientIde, options.launcherEnv);
|
|
51837
50534
|
const envSection = Object.keys(envValues).length === 0 ? [] : [
|
|
51838
50535
|
"",
|
|
51839
50536
|
`[mcp_servers."${options.mcpName}".env]`,
|
|
51840
|
-
...Object.entries(envValues).map(
|
|
51841
|
-
([key, value]) => `${key} = "${escapeTomlString(value)}"`
|
|
51842
|
-
)
|
|
50537
|
+
...Object.entries(envValues).map(([key, value]) => `${key} = "${escapeToml(value)}"`)
|
|
51843
50538
|
];
|
|
51844
50539
|
const section = [
|
|
51845
50540
|
`[mcp_servers."${options.mcpName}"]`,
|
|
51846
|
-
`command = "${
|
|
51847
|
-
`args = [${launch.args.map((arg) => `"${
|
|
50541
|
+
`command = "${escapeToml(launch.command)}"`,
|
|
50542
|
+
`args = [${launch.args.map((arg) => `"${escapeToml(arg)}"`).join(", ")}]`,
|
|
51848
50543
|
...envSection,
|
|
51849
50544
|
""
|
|
51850
50545
|
].join("\n");
|
|
@@ -51863,8 +50558,48 @@ function mergeCodexMcpConfig(configPath, options) {
|
|
|
51863
50558
|
}
|
|
51864
50559
|
);
|
|
51865
50560
|
}
|
|
50561
|
+
function createCodexMcpSectionPattern(mcpName) {
|
|
50562
|
+
const keyPattern = createCodexMcpKeyPattern(mcpName);
|
|
50563
|
+
return new RegExp(
|
|
50564
|
+
`\\n?\\[mcp_servers\\.${keyPattern}(?:\\.[^\\]]+)?\\][\\s\\S]*?(?=\\n\\[(?!mcp_servers\\.${keyPattern}(?:\\.|\\]))|$)`,
|
|
50565
|
+
"g"
|
|
50566
|
+
);
|
|
50567
|
+
}
|
|
50568
|
+
function createCodexMcpKeyPattern(mcpName) {
|
|
50569
|
+
const quotedKey = `"${escapeRegExp3(mcpName)}"`;
|
|
50570
|
+
if (!isTomlBareKey(mcpName)) {
|
|
50571
|
+
return quotedKey;
|
|
50572
|
+
}
|
|
50573
|
+
return `(?:${quotedKey}|${escapeRegExp3(mcpName)})`;
|
|
50574
|
+
}
|
|
50575
|
+
function findCodexMcpTableDuplicates(text, mcpName) {
|
|
50576
|
+
const seen = /* @__PURE__ */ new Set();
|
|
50577
|
+
const duplicates = /* @__PURE__ */ new Set();
|
|
50578
|
+
const headerPattern = /^\s*\[([^\]]+)\]\s*$/gm;
|
|
50579
|
+
let match;
|
|
50580
|
+
while ((match = headerPattern.exec(text)) !== null) {
|
|
50581
|
+
const normalized = normalizeCodexMcpTablePath(match[1], mcpName);
|
|
50582
|
+
if (!normalized) {
|
|
50583
|
+
continue;
|
|
50584
|
+
}
|
|
50585
|
+
if (seen.has(normalized)) {
|
|
50586
|
+
duplicates.add(normalized);
|
|
50587
|
+
continue;
|
|
50588
|
+
}
|
|
50589
|
+
seen.add(normalized);
|
|
50590
|
+
}
|
|
50591
|
+
return Array.from(duplicates);
|
|
50592
|
+
}
|
|
50593
|
+
function normalizeCodexMcpTablePath(tablePath, mcpName) {
|
|
50594
|
+
const keyPattern = createCodexMcpKeyPattern(mcpName);
|
|
50595
|
+
const match = new RegExp(`^mcp_servers\\.${keyPattern}(\\..+)?$`).exec(tablePath);
|
|
50596
|
+
if (!match) {
|
|
50597
|
+
return void 0;
|
|
50598
|
+
}
|
|
50599
|
+
return `mcp_servers.${mcpName}${match[1] || ""}`;
|
|
50600
|
+
}
|
|
51866
50601
|
function tryClaudeMcpAdd(options) {
|
|
51867
|
-
const configPath =
|
|
50602
|
+
const configPath = path22.join(os6.homedir(), ".claude.json");
|
|
51868
50603
|
try {
|
|
51869
50604
|
const existing = readJsonObject(configPath);
|
|
51870
50605
|
const server = asObject(asObject(existing.mcpServers)[options.mcpName]);
|
|
@@ -51957,10 +50692,10 @@ function rejectPackageOption(parsed) {
|
|
|
51957
50692
|
}
|
|
51958
50693
|
}
|
|
51959
50694
|
function readJsonObject(filePath, options = {}) {
|
|
51960
|
-
if (!
|
|
50695
|
+
if (!fs21.existsSync(filePath)) {
|
|
51961
50696
|
return {};
|
|
51962
50697
|
}
|
|
51963
|
-
const raw =
|
|
50698
|
+
const raw = fs21.readFileSync(filePath, "utf8");
|
|
51964
50699
|
try {
|
|
51965
50700
|
const normalized = normalizeJsonConfigContent(raw, options);
|
|
51966
50701
|
const parsed = JSON.parse(normalized);
|
|
@@ -51979,6 +50714,30 @@ function asObject(value) {
|
|
|
51979
50714
|
}
|
|
51980
50715
|
return {};
|
|
51981
50716
|
}
|
|
50717
|
+
function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
|
|
50718
|
+
const existed = fs21.existsSync(filePath);
|
|
50719
|
+
const previousContent = existed ? fs21.readFileSync(filePath, "utf8") : void 0;
|
|
50720
|
+
if (previousContent === nextContent) {
|
|
50721
|
+
return { changed: false };
|
|
50722
|
+
}
|
|
50723
|
+
const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
|
|
50724
|
+
fs21.mkdirSync(path22.dirname(filePath), { recursive: true });
|
|
50725
|
+
if (previousContent !== void 0 && backupPath) {
|
|
50726
|
+
fs21.writeFileSync(backupPath, previousContent, "utf8");
|
|
50727
|
+
}
|
|
50728
|
+
try {
|
|
50729
|
+
fs21.writeFileSync(filePath, nextContent, "utf8");
|
|
50730
|
+
validate == null ? void 0 : validate(fs21.readFileSync(filePath, "utf8"));
|
|
50731
|
+
return { changed: true, backupPath };
|
|
50732
|
+
} catch (error2) {
|
|
50733
|
+
if (previousContent !== void 0) {
|
|
50734
|
+
fs21.writeFileSync(filePath, previousContent, "utf8");
|
|
50735
|
+
} else {
|
|
50736
|
+
fs21.rmSync(filePath, { force: true });
|
|
50737
|
+
}
|
|
50738
|
+
throw error2;
|
|
50739
|
+
}
|
|
50740
|
+
}
|
|
51982
50741
|
function validateJsonMcpServersConfig(content, options) {
|
|
51983
50742
|
const parsed = parseGeneratedJsonObject(content);
|
|
51984
50743
|
const server = asObject(asObject(parsed.mcpServers)[options.mcpName]);
|
|
@@ -52132,10 +50891,10 @@ function formatMcpInstallMessage(label, configPath, write) {
|
|
|
52132
50891
|
].filter(Boolean).join("\n");
|
|
52133
50892
|
}
|
|
52134
50893
|
function saveInitState(targetDir, state) {
|
|
52135
|
-
|
|
52136
|
-
const key =
|
|
52137
|
-
|
|
52138
|
-
|
|
50894
|
+
fs21.mkdirSync(getMakerHome(), { recursive: true });
|
|
50895
|
+
const key = crypto3.createHash("sha256").update(path22.resolve(targetDir)).digest("hex").slice(0, 16);
|
|
50896
|
+
fs21.writeFileSync(
|
|
50897
|
+
path22.join(getMakerHome(), `init-state-${key}.json`),
|
|
52139
50898
|
`${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
|
|
52140
50899
|
`,
|
|
52141
50900
|
"utf8"
|
|
@@ -52283,7 +51042,7 @@ function makerEnvOption(parsed) {
|
|
|
52283
51042
|
return env;
|
|
52284
51043
|
}
|
|
52285
51044
|
const targetDir = stringOption(parsed, "target_dir");
|
|
52286
|
-
return getMakerEnvironment(void 0, targetDir ?
|
|
51045
|
+
return getMakerEnvironment(void 0, targetDir ? path22.resolve(targetDir) : process.cwd());
|
|
52287
51046
|
}
|
|
52288
51047
|
function makerMcpConfigEnvOption(parsed) {
|
|
52289
51048
|
return stringOption(parsed, "env") === "rnd" ? "rnd" : "production";
|
|
@@ -52314,6 +51073,15 @@ function mask(value) {
|
|
|
52314
51073
|
}
|
|
52315
51074
|
return `${value.slice(0, 6)}...${value.slice(-4)}`;
|
|
52316
51075
|
}
|
|
51076
|
+
function escapeRegExp3(value) {
|
|
51077
|
+
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
51078
|
+
}
|
|
51079
|
+
function escapeToml(value) {
|
|
51080
|
+
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
51081
|
+
}
|
|
51082
|
+
function isTomlBareKey(value) {
|
|
51083
|
+
return /^[A-Za-z0-9_-]+$/.test(value);
|
|
51084
|
+
}
|
|
52317
51085
|
function indent3(value) {
|
|
52318
51086
|
return value.split("\n").map((line) => ` ${line}`).join("\n");
|
|
52319
51087
|
}
|
|
@@ -52355,9 +51123,6 @@ function printHelp() {
|
|
|
52355
51123
|
" [--context-stdin] [--consent] [--json]",
|
|
52356
51124
|
" # Run only after the user agrees to submit",
|
|
52357
51125
|
" taptap-maker agents update [--target-dir DIR] [--json]",
|
|
52358
|
-
" taptap-maker plugin inspect --client codex|workbuddy|dsh [--json]",
|
|
52359
|
-
" taptap-maker plugin migrate --client codex|workbuddy|dsh --confirm [--json]",
|
|
52360
|
-
" taptap-maker plugin restore --client codex|workbuddy|dsh --confirm [--json]",
|
|
52361
51126
|
" taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
|
|
52362
51127
|
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
52363
51128
|
" taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
|
|
@@ -52427,13 +51192,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
|
|
|
52427
51192
|
}
|
|
52428
51193
|
|
|
52429
51194
|
// node_modules/pkce-challenge/dist/index.node.js
|
|
52430
|
-
var
|
|
51195
|
+
var crypto4;
|
|
52431
51196
|
var _a2;
|
|
52432
|
-
|
|
51197
|
+
crypto4 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
|
|
52433
51198
|
globalThis.crypto ?? // Node.js >18
|
|
52434
51199
|
import("node:crypto").then((m) => m.webcrypto);
|
|
52435
51200
|
async function getRandomValues(size) {
|
|
52436
|
-
return (await
|
|
51201
|
+
return (await crypto4).getRandomValues(new Uint8Array(size));
|
|
52437
51202
|
}
|
|
52438
51203
|
async function random(size) {
|
|
52439
51204
|
const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
|
|
@@ -52449,7 +51214,7 @@ async function generateVerifier(length) {
|
|
|
52449
51214
|
return await random(length);
|
|
52450
51215
|
}
|
|
52451
51216
|
async function generateChallenge(code_verifier) {
|
|
52452
|
-
const buffer = await (await
|
|
51217
|
+
const buffer = await (await crypto4).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
|
|
52453
51218
|
return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
|
|
52454
51219
|
}
|
|
52455
51220
|
async function pkceChallenge(length) {
|
|
@@ -53804,8 +52569,8 @@ var StreamableHTTPClientTransport = class {
|
|
|
53804
52569
|
};
|
|
53805
52570
|
|
|
53806
52571
|
// src/mcp-proxy/proxy.ts
|
|
53807
|
-
import * as
|
|
53808
|
-
import * as
|
|
52572
|
+
import * as path24 from "node:path";
|
|
52573
|
+
import * as crypto6 from "node:crypto";
|
|
53809
52574
|
|
|
53810
52575
|
// src/mcp-proxy/cookieJar.ts
|
|
53811
52576
|
var CookieJar = class {
|
|
@@ -53986,9 +52751,9 @@ function createCookieFetch(cookieJar) {
|
|
|
53986
52751
|
}
|
|
53987
52752
|
|
|
53988
52753
|
// src/core/utils/logWriter.ts
|
|
53989
|
-
import * as
|
|
53990
|
-
import * as
|
|
53991
|
-
import * as
|
|
52754
|
+
import * as fs22 from "node:fs";
|
|
52755
|
+
import * as path23 from "node:path";
|
|
52756
|
+
import * as crypto5 from "node:crypto";
|
|
53992
52757
|
|
|
53993
52758
|
// src/core/types/log.ts
|
|
53994
52759
|
var LOG_LEVEL_PRIORITY = {
|
|
@@ -54028,7 +52793,7 @@ var LogWriter = class {
|
|
|
54028
52793
|
return;
|
|
54029
52794
|
}
|
|
54030
52795
|
try {
|
|
54031
|
-
await
|
|
52796
|
+
await fs22.promises.mkdir(this.config.logDir, { recursive: true });
|
|
54032
52797
|
await this.cleanupOldLogs();
|
|
54033
52798
|
this.initialized = true;
|
|
54034
52799
|
} catch (error2) {
|
|
@@ -54051,7 +52816,7 @@ var LogWriter = class {
|
|
|
54051
52816
|
*/
|
|
54052
52817
|
getLogFilePath(date5) {
|
|
54053
52818
|
const d = date5 || this.getCurrentDate();
|
|
54054
|
-
return
|
|
52819
|
+
return path23.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
|
|
54055
52820
|
}
|
|
54056
52821
|
/**
|
|
54057
52822
|
* 获取或创建写入流
|
|
@@ -54066,7 +52831,7 @@ var LogWriter = class {
|
|
|
54066
52831
|
}
|
|
54067
52832
|
this.currentDate = date5;
|
|
54068
52833
|
try {
|
|
54069
|
-
this.writeStream =
|
|
52834
|
+
this.writeStream = fs22.createWriteStream(this.getLogFilePath(date5), {
|
|
54070
52835
|
flags: "a",
|
|
54071
52836
|
encoding: "utf8"
|
|
54072
52837
|
});
|
|
@@ -54118,11 +52883,11 @@ var LogWriter = class {
|
|
|
54118
52883
|
if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
|
|
54119
52884
|
try {
|
|
54120
52885
|
const filePath = this.getLogFilePath();
|
|
54121
|
-
const dir =
|
|
54122
|
-
if (!
|
|
54123
|
-
|
|
52886
|
+
const dir = path23.dirname(filePath);
|
|
52887
|
+
if (!fs22.existsSync(dir)) {
|
|
52888
|
+
fs22.mkdirSync(dir, { recursive: true });
|
|
54124
52889
|
}
|
|
54125
|
-
|
|
52890
|
+
fs22.appendFileSync(filePath, message, "utf8");
|
|
54126
52891
|
} catch {
|
|
54127
52892
|
}
|
|
54128
52893
|
}
|
|
@@ -54133,7 +52898,7 @@ var LogWriter = class {
|
|
|
54133
52898
|
async cleanupOldLogs() {
|
|
54134
52899
|
if (this.config.maxDays <= 0) return;
|
|
54135
52900
|
try {
|
|
54136
|
-
const files = await
|
|
52901
|
+
const files = await fs22.promises.readdir(this.config.logDir);
|
|
54137
52902
|
const cutoffDate = /* @__PURE__ */ new Date();
|
|
54138
52903
|
cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
|
|
54139
52904
|
const prefix = this.config.prefix;
|
|
@@ -54148,7 +52913,7 @@ var LogWriter = class {
|
|
|
54148
52913
|
if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
|
|
54149
52914
|
const fileDate = new Date(year, month - 1, day);
|
|
54150
52915
|
if (fileDate < cutoffDate) {
|
|
54151
|
-
await
|
|
52916
|
+
await fs22.promises.unlink(path23.join(this.config.logDir, file2));
|
|
54152
52917
|
process.stderr.write(`[LogWriter] Deleted old log: ${file2}
|
|
54153
52918
|
`);
|
|
54154
52919
|
}
|
|
@@ -54192,7 +52957,7 @@ function convertMcpApplicationErrorToToolResult(error2) {
|
|
|
54192
52957
|
return void 0;
|
|
54193
52958
|
}
|
|
54194
52959
|
const data = error2.data;
|
|
54195
|
-
if (!
|
|
52960
|
+
if (!isRecord5(data) || !("remote_result" in data) || data.remote_result === void 0) {
|
|
54196
52961
|
return void 0;
|
|
54197
52962
|
}
|
|
54198
52963
|
return {
|
|
@@ -54209,7 +52974,7 @@ function convertMcpApplicationErrorToToolResult(error2) {
|
|
|
54209
52974
|
]
|
|
54210
52975
|
};
|
|
54211
52976
|
}
|
|
54212
|
-
function
|
|
52977
|
+
function isRecord5(value) {
|
|
54213
52978
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
54214
52979
|
}
|
|
54215
52980
|
function formatProxyDiagnosticValue(value) {
|
|
@@ -54269,10 +53034,10 @@ var TapTapMCPProxy = class {
|
|
|
54269
53034
|
const { user_id, project_id } = this.config.tenant;
|
|
54270
53035
|
let logDir;
|
|
54271
53036
|
if (user_id && project_id) {
|
|
54272
|
-
logDir =
|
|
53037
|
+
logDir = path24.join(logRoot, "proxy", user_id, project_id);
|
|
54273
53038
|
} else {
|
|
54274
|
-
const kidHash =
|
|
54275
|
-
logDir =
|
|
53039
|
+
const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
|
|
53040
|
+
logDir = path24.join(logRoot, "proxy", kidHash);
|
|
54276
53041
|
}
|
|
54277
53042
|
return new LogWriter({
|
|
54278
53043
|
logDir,
|
|
@@ -54994,9 +53759,6 @@ function printHelp2() {
|
|
|
54994
53759
|
" [--context-stdin] [--consent] [--json]",
|
|
54995
53760
|
" # Run only after the user agrees to submit",
|
|
54996
53761
|
" taptap-maker agents update [--target-dir DIR] [--json]",
|
|
54997
|
-
" taptap-maker plugin inspect --client codex|workbuddy [--json]",
|
|
54998
|
-
" taptap-maker plugin migrate --client codex|workbuddy --confirm [--json]",
|
|
54999
|
-
" taptap-maker plugin restore --client codex|workbuddy --confirm [--json]",
|
|
55000
53762
|
" taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
|
|
55001
53763
|
" taptap-maker dev-kit update [--target-dir DIR] [--json]",
|
|
55002
53764
|
" taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
|