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