@taptap/maker 0.0.30 → 0.0.31-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/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.31-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(path25) {
3237
- let input2 = path25;
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 [path25, query] = wsComponent.resourceName.split("?");
3437
- wsComponent.path = path25 && path25 !== "/" ? path25 : void 0;
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, fs23, exportName) {
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, fs23[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 fs23 = __require("fs");
12513
- function checkPathExt(path25, options) {
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 && path25.substr(-p.length).toLowerCase() === 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, path25, options) {
12531
+ function checkStat(stat, path29, options) {
12531
12532
  if (!stat.isSymbolicLink() && !stat.isFile()) {
12532
12533
  return false;
12533
12534
  }
12534
- return checkPathExt(path25, options);
12535
+ return checkPathExt(path29, options);
12535
12536
  }
12536
- function isexe(path25, options, cb) {
12537
- fs23.stat(path25, function(er, stat) {
12538
- cb(er, er ? false : checkStat(stat, path25, options));
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(path25, options) {
12542
- return checkStat(fs23.statSync(path25), path25, options);
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 fs23 = __require("fs");
12553
- function isexe(path25, options, cb) {
12554
- fs23.stat(path25, function(er, stat) {
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(path25, options) {
12559
- return checkStat(fs23.statSync(path25), options);
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 fs23 = __require("fs");
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(path25, options, cb) {
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(path25, options || {}, function(er, is) {
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(path25, options || {}, function(er, is) {
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(path25, options) {
12622
+ function sync(path29, options) {
12622
12623
  try {
12623
- return core.sync(path25, options || {});
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 path25 = __require("path");
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 = path25.join(pathPart, cmd);
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 = path25.join(pathPart, cmd);
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 path25 = __require("path");
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 ? path25.delimiter : void 0
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 = path25.resolve(hasCustomCwd ? parsed.options.cwd : "", 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 [path25, argument] = match[0].replace(/#! ?/, "").split(" ");
12834
- const binary = path25.split("/").pop();
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 fs23 = __require("fs");
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 = fs23.openSync(command, "r");
12855
- fs23.readSync(fd, buffer, 0, size, 0);
12856
- fs23.closeSync(fd);
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 path25 = __require("path");
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 = path25.normalize(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 isMap2 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === MAP;
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 isSeq2 = (node) => !!node && typeof node === "object" && node[NODE_TYPE] === SEQ;
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 = isMap2;
13054
+ exports.isMap = isMap3;
13054
13055
  exports.isNode = isNode;
13055
13056
  exports.isPair = isPair;
13056
13057
  exports.isScalar = isScalar;
13057
- exports.isSeq = isSeq2;
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, path25) {
13082
- const ctrl = callVisitor(key, node, visitor, path25);
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, path25, ctrl);
13085
- return visit_(key, ctrl, visitor, path25);
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
- path25 = Object.freeze(path25.concat(node));
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, path25);
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
- path25 = Object.freeze(path25.concat(node));
13103
- const ck = visit_("key", node.key, visitor, path25);
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, path25);
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, path25) {
13130
- const ctrl = await callVisitor(key, node, visitor, path25);
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, path25, ctrl);
13133
- return visitAsync_(key, ctrl, visitor, path25);
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
- path25 = Object.freeze(path25.concat(node));
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, path25);
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
- path25 = Object.freeze(path25.concat(node));
13151
- const ck = await visitAsync_("key", node.key, visitor, path25);
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, path25);
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, path25) {
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, path25);
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, path25);
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, path25);
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, path25);
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, path25);
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, path25);
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, path25, node) {
13200
- const parent = path25[path25.length - 1];
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, path25, value) {
13813
+ function collectionFromPath(schema, path29, value) {
13813
13814
  let v = value;
13814
- for (let i = path25.length - 1; i >= 0; --i) {
13815
- const k = path25[i];
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 = (path25) => path25 == null || typeof path25 === "object" && !!path25[Symbol.iterator]().next().done;
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(path25, value) {
13865
- if (isEmptyPath(path25))
13865
+ addIn(path29, value) {
13866
+ if (isEmptyPath(path29))
13866
13867
  this.add(value);
13867
13868
  else {
13868
- const [key, ...rest] = path25;
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(path25) {
13883
- const [key, ...rest] = path25;
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(path25, keepScalar) {
13898
- const [key, ...rest] = path25;
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(path25) {
13917
- const [key, ...rest] = path25;
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(path25, value) {
13928
- const [key, ...rest] = path25;
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(path25, value) {
16443
+ addIn(path29, value) {
16443
16444
  if (assertCollection(this.contents))
16444
- this.contents.addIn(path25, value);
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(path25) {
16520
- if (Collection.isEmptyPath(path25)) {
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(path25) : false;
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(path25, keepScalar) {
16542
- if (Collection.isEmptyPath(path25))
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(path25, keepScalar) : void 0;
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(path25) {
16556
- if (Collection.isEmptyPath(path25))
16556
+ hasIn(path29) {
16557
+ if (Collection.isEmptyPath(path29))
16557
16558
  return this.contents !== void 0;
16558
- return identity.isCollection(this.contents) ? this.contents.hasIn(path25) : false;
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(path25, value) {
16576
- if (Collection.isEmptyPath(path25)) {
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(path25), value);
16580
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path29), value);
16580
16581
  } else if (assertCollection(this.contents)) {
16581
- this.contents.setIn(path25, value);
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 isMap2 = fc.start.source === "{";
17168
- const fcName = isMap2 ? "flow map" : "flow sequence";
17169
- const NodeClass = (tag == null ? void 0 : tag.nodeClass) ?? (isMap2 ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq);
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 (!isMap2 && ctx.options.strict && utilContainsNewline.containsNewline(key))
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 (!isMap2 && !sep && !props.found) {
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 (!isMap2 && !props.found && ctx.options.strict) {
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 (isMap2) {
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 = isMap2 ? "}" : "]";
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, path25) => {
18545
+ visit.itemAtPath = (cst, path29) => {
18545
18546
  let item = cst;
18546
- for (const [field, index] of path25) {
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, path25) => {
18556
- const parent = visit.itemAtPath(cst, path25.slice(0, -1));
18557
- const field = path25[path25.length - 1][0];
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(path25, item, visitor) {
18564
- let ctrl = visitor(item, path25);
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(path25.concat([[field, i]])), token.items[i], visitor);
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, path25);
18583
+ ctrl = ctrl(item, path29);
18583
18584
  }
18584
18585
  }
18585
- return typeof ctrl === "function" ? ctrl(item, path25) : ctrl;
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 fs23 = this.flowScalar(this.type);
19873
+ const fs27 = this.flowScalar(this.type);
19873
19874
  if (atNextItem || it.value) {
19874
- map2.items.push({ start, key: fs23, sep: [] });
19875
+ map2.items.push({ start, key: fs27, sep: [] });
19875
19876
  this.onKeyLine = true;
19876
19877
  } else if (it.sep) {
19877
- this.stack.push(fs23);
19878
+ this.stack.push(fs27);
19878
19879
  } else {
19879
- Object.assign(it, { key: fs23, sep: [] });
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 fs23 = this.flowScalar(this.type);
20009
+ const fs27 = this.flowScalar(this.type);
20009
20010
  if (!it || it.value)
20010
- fc.items.push({ start: [], key: fs23, sep: [] });
20011
+ fc.items.push({ start: [], key: fs27, sep: [] });
20011
20012
  else if (it.sep)
20012
- this.stack.push(fs23);
20013
+ this.stack.push(fs27);
20013
20014
  else
20014
- Object.assign(it, { key: fs23, sep: [] });
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 parseDocument2(source, options = {}) {
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 = parseDocument2(src, options);
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 = parseDocument2;
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: path25, errorMaps, issueData } = params;
20688
- const fullPath = [...path25, ...issueData.path || []];
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, path25, key) {
20804
+ constructor(parent, value, path29, key) {
20804
20805
  this._cachedPath = [];
20805
20806
  this.parent = parent;
20806
20807
  this.data = value;
20807
- this._path = path25;
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, path25) {
24457
- if (!path25)
24457
+ function getElementAtPath(obj, path29) {
24458
+ if (!path29)
24458
24459
  return obj;
24459
- return path25.reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
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(path25, issues) {
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(path25);
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.30 taptap-maker mcp report ...`.",
36685
+ " `npx -y --package @taptap/maker@0.0.31-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 unique = new Set(files);
37893
+ const unique2 = new Set(files);
37893
37894
  const changedFiles = parseGitStatusFiles(readGitSync(["-C", cwd, "status", "--porcelain", "-z"]));
37894
37895
  if (changedFiles.includes(".gitignore")) {
37895
- unique.add(".gitignore");
37896
+ unique2.add(".gitignore");
37896
37897
  }
37897
- return [...unique];
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 skillDocuments = BUNDLED_SKILLS.map((skill) => ({
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.";
@@ -44352,7 +44419,7 @@ function applyDefaults(config2) {
44352
44419
  var MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
44353
44420
  var MAKER_MCP_TRACKING_SOURCE = "local_mcp";
44354
44421
  var MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
44355
- var MAKER_MCP_VERSION = "0.0.30".trim() ? "0.0.30".trim() : "dev";
44422
+ var MAKER_MCP_VERSION = "0.0.31-beta.2".trim() ? "0.0.31-beta.2".trim() : "dev";
44356
44423
  var TRACKING_ERROR_MAX_LENGTH = 500;
44357
44424
  function buildMakerMcpTrackingPayload(event) {
44358
44425
  var _a3, _b, _c;
@@ -44665,7 +44732,7 @@ function createMakerRemoteProxyManager(options = {}) {
44665
44732
  }
44666
44733
 
44667
44734
  // src/maker/server/mcp.ts
44668
- var VERSION = true ? "0.0.30" : "dev";
44735
+ var VERSION = true ? "0.0.31-beta.2" : "dev";
44669
44736
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
44670
44737
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
44671
44738
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -45352,6 +45419,8 @@ function installMakerServerExitHandlers(remoteProxyManager) {
45352
45419
  async function formatStatus(options = {}) {
45353
45420
  var _a3;
45354
45421
  const detail = options.detail === true;
45422
+ const distribution = process.env.TAPTAP_MAKER_DISTRIBUTION;
45423
+ const pluginDistribution = resolveMakerPluginDistribution(distribution);
45355
45424
  const projectContext = await resolveMakerProjectContext({
45356
45425
  targetDir: options.targetDir,
45357
45426
  listClientRoots: options.listClientRoots,
@@ -45374,7 +45443,7 @@ async function formatStatus(options = {}) {
45374
45443
  allowRemoteFetch: false,
45375
45444
  ...detail ? {} : { backgroundRefresh: false }
45376
45445
  });
45377
- const packageUpdateText = detail ? formatMakerPackageUpdateStatus(packageUpdateStatus) : "";
45446
+ const packageUpdateText = detail ? formatMakerPackageUpdateStatusForDistribution(packageUpdateStatus, distribution) : "";
45378
45447
  const projectInitialization = identify.projectRoot ? inspectMakerProjectInitialization(identify.projectRoot) : void 0;
45379
45448
  const projectHealth = identify.projectRoot ? inspectMakerProjectHealth(identify.projectRoot, "status") : void 0;
45380
45449
  const projectInitializationText = projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "";
@@ -45410,8 +45479,9 @@ async function formatStatus(options = {}) {
45410
45479
  `- lua_lsp: ${luaLsp.status}`,
45411
45480
  "Maker MCP package update",
45412
45481
  `- status: ${packageUpdateStatus.status}`,
45482
+ pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
45413
45483
  packageUpdateStatus.target_version ? `- target_version: ${packageUpdateStatus.target_version}` : "",
45414
- packageUpdateStatus.next_action ? `- next_action: ${packageUpdateStatus.next_action}` : "",
45484
+ pluginDistribution && packageUpdateStatus.status !== "managed_by_plugin" ? `- next_action: ${formatMakerPluginUpdateAction(pluginDistribution)}` : packageUpdateStatus.next_action ? `- next_action: ${packageUpdateStatus.next_action}` : "",
45415
45485
  projectInitialization ? `- project_initialization: ${projectInitialization.status}` : "",
45416
45486
  projectHealth ? `- project_health: ${projectHealth.status}` : "",
45417
45487
  formatMakerClientRootsSummary(projectContext.roots),
@@ -45437,6 +45507,7 @@ async function formatStatus(options = {}) {
45437
45507
  "TapTap Maker MCP status",
45438
45508
  "",
45439
45509
  `- version: ${VERSION}`,
45510
+ pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
45440
45511
  `- env: ${env}`,
45441
45512
  `- project_context_source: ${projectContext.source}`,
45442
45513
  summaryText
@@ -45446,6 +45517,7 @@ async function formatStatus(options = {}) {
45446
45517
  "TapTap Maker MCP status",
45447
45518
  "",
45448
45519
  `- version: ${VERSION}`,
45520
+ pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
45449
45521
  `- env: ${env}`,
45450
45522
  `- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
45451
45523
  `- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
@@ -45506,6 +45578,21 @@ async function formatStatus(options = {}) {
45506
45578
  projectSection
45507
45579
  ].filter(Boolean).join("\n");
45508
45580
  }
45581
+ function formatMakerPackageUpdateStatusForDistribution(status, distribution) {
45582
+ const formatted = formatMakerPackageUpdateStatus(status);
45583
+ const pluginDistribution = resolveMakerPluginDistribution(distribution);
45584
+ if (!pluginDistribution) {
45585
+ return formatted;
45586
+ }
45587
+ const lines = [
45588
+ ...formatted.split("\n").filter((line) => !line.startsWith("- next_action:")),
45589
+ `- distribution: ${pluginDistribution.id}`
45590
+ ];
45591
+ if (status.status !== "managed_by_plugin") {
45592
+ lines.push(`- next_action: ${formatMakerPluginUpdateAction(pluginDistribution)}`);
45593
+ }
45594
+ return lines.join("\n");
45595
+ }
45509
45596
  function formatAuthNextStep(options) {
45510
45597
  if (!options.hasTapAuth) {
45511
45598
  if (options.hasPat) {
@@ -47454,10 +47541,10 @@ function indent2(value) {
47454
47541
 
47455
47542
  // src/maker/cli/commands.ts
47456
47543
  import { spawnSync as spawnSync8 } from "node:child_process";
47457
- import crypto3 from "node:crypto";
47458
- import fs21 from "node:fs";
47459
- import os6 from "node:os";
47460
- import path22 from "node:path";
47544
+ import crypto5 from "node:crypto";
47545
+ import fs25 from "node:fs";
47546
+ import os8 from "node:os";
47547
+ import path26 from "node:path";
47461
47548
  import readline from "node:readline/promises";
47462
47549
  import { stdin as input, stdout as output } from "node:process";
47463
47550
  import { pathToFileURL } from "node:url";
@@ -47882,6 +47969,7 @@ import { spawnSync as spawnSync7 } from "node:child_process";
47882
47969
  import fs20 from "node:fs";
47883
47970
  import os5 from "node:os";
47884
47971
  import path21 from "node:path";
47972
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
47885
47973
 
47886
47974
  // src/maker/cli/dshMcpConfig.ts
47887
47975
  var import_yaml = __toESM(require_dist2());
@@ -48171,6 +48259,40 @@ function inspectMakerMcpClientConfig(options) {
48171
48259
  const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
48172
48260
  return { ide, status, entries };
48173
48261
  }
48262
+ function resolveMakerMcpReportRuntime(options) {
48263
+ const pluginDistribution = resolveMakerPluginDistribution(options.distribution);
48264
+ if (!pluginDistribution) {
48265
+ return void 0;
48266
+ }
48267
+ if (!options.bundleUrl) {
48268
+ throw new Error(
48269
+ `${pluginDistribution.displayName} plugin diagnostics require the active Maker bundle URL.`
48270
+ );
48271
+ }
48272
+ const bundlePath = path21.resolve(fileURLToPath4(options.bundleUrl));
48273
+ const pluginRoot = path21.dirname(path21.dirname(bundlePath));
48274
+ const execPath = options.execPath ?? process.execPath;
48275
+ return {
48276
+ distribution: pluginDistribution.id,
48277
+ client: pluginDistribution.client,
48278
+ config_source: {
48279
+ format: "json",
48280
+ paths: [path21.join(pluginRoot, ".mcp.json")],
48281
+ mcp_name: "taptap-maker-plugin"
48282
+ },
48283
+ launcher: {
48284
+ kind: "self_runtime",
48285
+ command: execPath,
48286
+ args: [bundlePath],
48287
+ commandAndArgs: [execPath, bundlePath]
48288
+ },
48289
+ cwd: pluginRoot,
48290
+ env: {
48291
+ TAPTAP_MAKER_DISTRIBUTION: pluginDistribution.id,
48292
+ TAPTAP_MCP_CLIENT_IDE: pluginDistribution.client
48293
+ }
48294
+ };
48295
+ }
48174
48296
  function buildMakerMcpIssue(options) {
48175
48297
  const context = sanitizePublicValue(options.context, options.homeDir);
48176
48298
  const diagnostics = sanitizePublicValue(
@@ -48203,7 +48325,7 @@ function buildMakerMcpIssue(options) {
48203
48325
  return { title, body };
48204
48326
  }
48205
48327
  async function collectMakerMcpIssueDiagnostics(options) {
48206
- var _a3;
48328
+ var _a3, _b;
48207
48329
  const platform = options.platform || process.platform;
48208
48330
  const homeDir = options.homeDir || os5.homedir();
48209
48331
  const processCwd = path21.resolve(options.processCwd || process.cwd());
@@ -48220,7 +48342,7 @@ async function collectMakerMcpIssueDiagnostics(options) {
48220
48342
  };
48221
48343
  const client = (_a3 = options.ide) == null ? void 0 : _a3.trim().toLowerCase();
48222
48344
  const environment = options.environment || process.env;
48223
- const clientConfig = client ? inspectMakerMcpClientConfig({
48345
+ const clientConfig = client ? options.configSource ? inspectMakerMcpConfigSource(client, options.configSource) : inspectMakerMcpClientConfig({
48224
48346
  ide: client,
48225
48347
  homeDir,
48226
48348
  platform,
@@ -48252,10 +48374,14 @@ async function collectMakerMcpIssueDiagnostics(options) {
48252
48374
  http_proxy_configured: hasEnvironmentValue(environment, "HTTP_PROXY"),
48253
48375
  https_proxy_configured: hasEnvironmentValue(environment, "HTTPS_PROXY"),
48254
48376
  no_proxy_configured: hasEnvironmentValue(environment, "NO_PROXY")
48255
- }
48377
+ },
48378
+ ...options.distribution ? { distribution: options.distribution } : {}
48256
48379
  };
48257
48380
  if (client === "workbuddy") {
48258
- diagnostics.workbuddy_trust = inspectWorkBuddyTrust(homeDir);
48381
+ diagnostics.workbuddy_trust = inspectWorkBuddyTrust(
48382
+ homeDir,
48383
+ ((_b = options.configSource) == null ? void 0 : _b.mcp_name) || MAKER_MCP_NAME
48384
+ );
48259
48385
  }
48260
48386
  return diagnostics;
48261
48387
  }
@@ -48313,10 +48439,12 @@ function getMcpConfigPaths(options) {
48313
48439
  }
48314
48440
  return void 0;
48315
48441
  }
48316
- function inspectMcpConfigFile(configPath, ide, mcpName) {
48442
+ function inspectMcpConfigFile(configPath, ide, mcpName, format) {
48317
48443
  try {
48318
- const server = ide === "codex" ? extractCodexMcpServerConfig(fs20.readFileSync(configPath, "utf8"), mcpName) : ide === "dsh" ? extractDshMcpServerConfig(fs20.readFileSync(configPath, "utf8"), mcpName, configPath) : extractMakerMcpServerConfig(
48319
- parseJsonConfig(fs20.readFileSync(configPath, "utf8"), ide === "opencode"),
48444
+ const resolvedFormat = format ?? (ide === "codex" ? "codex_toml" : ide === "dsh" ? "dsh" : ide === "opencode" ? "jsonc" : "json");
48445
+ const content = fs20.readFileSync(configPath, "utf8");
48446
+ const server = resolvedFormat === "codex_toml" ? extractCodexMcpServerConfig(content, mcpName) : resolvedFormat === "dsh" ? extractDshMcpServerConfig(content, mcpName, configPath) : extractMakerMcpServerConfig(
48447
+ parseJsonConfig(content, resolvedFormat === "jsonc"),
48320
48448
  mcpName
48321
48449
  );
48322
48450
  return server ? { path: configPath, status: "found", server } : { path: configPath, status: "missing_entry" };
@@ -48324,6 +48452,11 @@ function inspectMcpConfigFile(configPath, ide, mcpName) {
48324
48452
  return { path: configPath, status: "unreadable" };
48325
48453
  }
48326
48454
  }
48455
+ function inspectMakerMcpConfigSource(ide, source) {
48456
+ const entries = source.paths.filter((configPath) => fs20.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
48457
+ const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
48458
+ return { ide, status, entries };
48459
+ }
48327
48460
  function extractDshMcpServerConfig(content, mcpName, source) {
48328
48461
  const plugin = findDshMakerPluginEntry(content, mcpName, source);
48329
48462
  if (!plugin) {
@@ -48529,7 +48662,7 @@ function runGitHubIssueCreate(args, input2) {
48529
48662
  stderr: typeof result.stderr === "string" ? result.stderr : ""
48530
48663
  };
48531
48664
  }
48532
- function inspectWorkBuddyTrust(homeDir) {
48665
+ function inspectWorkBuddyTrust(homeDir, mcpName) {
48533
48666
  const emptyCounts = {
48534
48667
  accounts_checked: 0,
48535
48668
  trusted_accounts: 0,
@@ -48563,9 +48696,9 @@ function inspectWorkBuddyTrust(homeDir) {
48563
48696
  counts.unreadable_accounts += 1;
48564
48697
  continue;
48565
48698
  }
48566
- const enabled = asStringArray(state.enabled).includes(MAKER_MCP_NAME);
48567
- const userDisabled = asStringArray(state.userDisabled).includes(MAKER_MCP_NAME);
48568
- const everConnected = asStringArray(state.everConnected).includes(MAKER_MCP_NAME);
48699
+ const enabled = asStringArray(state.enabled).includes(mcpName);
48700
+ const userDisabled = asStringArray(state.userDisabled).includes(mcpName);
48701
+ const everConnected = asStringArray(state.everConnected).includes(mcpName);
48569
48702
  if (!enabled && !userDisabled && !everConnected) {
48570
48703
  continue;
48571
48704
  }
@@ -48750,11 +48883,1063 @@ function stripControlCharacters(value) {
48750
48883
  }).join("");
48751
48884
  }
48752
48885
 
48886
+ // src/maker/cli/pluginMigration.ts
48887
+ import fs22 from "node:fs";
48888
+ import os6 from "node:os";
48889
+ import path23 from "node:path";
48890
+ import crypto3 from "node:crypto";
48891
+
48892
+ // src/maker/cli/codexMcpConfig.ts
48893
+ function findCodexMcpTables(content, mcpName) {
48894
+ const mainPath = `mcp_servers.${mcpName}`;
48895
+ return findTomlTables(content).flatMap((table) => {
48896
+ const normalizedPath = normalizeCodexMcpTablePath(table.path, mcpName);
48897
+ if (!normalizedPath) {
48898
+ return [];
48899
+ }
48900
+ return [
48901
+ {
48902
+ headerStart: table.headerStart,
48903
+ bodyStart: table.bodyStart,
48904
+ bodyEnd: table.bodyEnd,
48905
+ normalizedPath,
48906
+ isMain: normalizedPath === mainPath
48907
+ }
48908
+ ];
48909
+ });
48910
+ }
48911
+ function removeCodexMcpTables(content, mcpName) {
48912
+ const tables = findCodexMcpTables(content, mcpName);
48913
+ return [...tables].reverse().reduce(
48914
+ (updated, table) => `${updated.slice(0, table.headerStart)}${updated.slice(table.bodyEnd)}`,
48915
+ content
48916
+ );
48917
+ }
48918
+ function findCodexMcpTableDuplicates(text, mcpName) {
48919
+ const seen = /* @__PURE__ */ new Set();
48920
+ const duplicates = /* @__PURE__ */ new Set();
48921
+ for (const table of findCodexMcpTables(text, mcpName)) {
48922
+ if (seen.has(table.normalizedPath)) {
48923
+ duplicates.add(table.normalizedPath);
48924
+ } else {
48925
+ seen.add(table.normalizedPath);
48926
+ }
48927
+ }
48928
+ return Array.from(duplicates);
48929
+ }
48930
+ function findTomlBooleanAssignment(content, start, end, key) {
48931
+ const keyPattern = escapeRegExp3(key);
48932
+ let multiline;
48933
+ for (const line of splitTomlLines(content, start, end)) {
48934
+ if (!multiline) {
48935
+ const match = new RegExp(`^\\s*${keyPattern}\\s*=\\s*(true|false)\\s*(?:#.*)?$`).exec(
48936
+ line.text
48937
+ );
48938
+ if ((match == null ? void 0 : match.index) !== void 0) {
48939
+ const relativeValueStart = match.index + match[0].indexOf(match[1]);
48940
+ return {
48941
+ value: match[1] === "true",
48942
+ valueStart: line.start + relativeValueStart,
48943
+ valueEnd: line.start + relativeValueStart + match[1].length
48944
+ };
48945
+ }
48946
+ }
48947
+ multiline = scanTomlLine(line.text, multiline);
48948
+ }
48949
+ return void 0;
48950
+ }
48951
+ function escapeTomlString(value) {
48952
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
48953
+ }
48954
+ function findTomlTables(content) {
48955
+ const tables = [];
48956
+ let multiline;
48957
+ for (const line of splitTomlLines(content)) {
48958
+ if (!multiline) {
48959
+ const match = /^\s*\[([^\]]+)\]\s*(?:#.*)?$/.exec(line.text);
48960
+ if (match) {
48961
+ const previous = tables[tables.length - 1];
48962
+ if (previous) {
48963
+ previous.bodyEnd = line.start;
48964
+ }
48965
+ tables.push({
48966
+ headerStart: line.start,
48967
+ bodyStart: line.end,
48968
+ bodyEnd: content.length,
48969
+ path: match[1]
48970
+ });
48971
+ }
48972
+ }
48973
+ multiline = scanTomlLine(line.text, multiline);
48974
+ }
48975
+ return tables;
48976
+ }
48977
+ function splitTomlLines(content, start = 0, end = content.length) {
48978
+ const lines = [];
48979
+ let lineStart = start;
48980
+ while (lineStart < end) {
48981
+ const newline = content.indexOf("\n", lineStart);
48982
+ const nextLineStart = newline === -1 || newline >= end ? end : newline + 1;
48983
+ let lineEnd = newline === -1 || newline >= end ? end : newline;
48984
+ if (lineEnd > lineStart && content[lineEnd - 1] === "\r") {
48985
+ lineEnd -= 1;
48986
+ }
48987
+ lines.push({
48988
+ start: lineStart,
48989
+ end: lineEnd,
48990
+ text: content.slice(lineStart, lineEnd)
48991
+ });
48992
+ lineStart = nextLineStart;
48993
+ }
48994
+ return lines;
48995
+ }
48996
+ function scanTomlLine(line, initial) {
48997
+ let multiline = initial;
48998
+ let index = 0;
48999
+ while (index < line.length) {
49000
+ if (multiline === "basic") {
49001
+ const closing = findUnescapedTripleQuote(line, index, '"""');
49002
+ if (closing === -1) {
49003
+ return multiline;
49004
+ }
49005
+ multiline = void 0;
49006
+ index = closing + 3;
49007
+ continue;
49008
+ }
49009
+ if (multiline === "literal") {
49010
+ const closing = line.indexOf("'''", index);
49011
+ if (closing === -1) {
49012
+ return multiline;
49013
+ }
49014
+ multiline = void 0;
49015
+ index = closing + 3;
49016
+ continue;
49017
+ }
49018
+ const character = line[index];
49019
+ if (character === "#") {
49020
+ return void 0;
49021
+ }
49022
+ if (line.startsWith('"""', index)) {
49023
+ multiline = "basic";
49024
+ index += 3;
49025
+ continue;
49026
+ }
49027
+ if (line.startsWith("'''", index)) {
49028
+ multiline = "literal";
49029
+ index += 3;
49030
+ continue;
49031
+ }
49032
+ if (character === '"') {
49033
+ index = skipBasicString(line, index + 1);
49034
+ continue;
49035
+ }
49036
+ if (character === "'") {
49037
+ const closing = line.indexOf("'", index + 1);
49038
+ index = closing === -1 ? line.length : closing + 1;
49039
+ continue;
49040
+ }
49041
+ index += 1;
49042
+ }
49043
+ return multiline;
49044
+ }
49045
+ function findUnescapedTripleQuote(line, start, delimiter) {
49046
+ let match = line.indexOf(delimiter, start);
49047
+ while (match !== -1) {
49048
+ let backslashes = 0;
49049
+ for (let index = match - 1; index >= 0 && line[index] === "\\"; index -= 1) {
49050
+ backslashes += 1;
49051
+ }
49052
+ if (backslashes % 2 === 0) {
49053
+ return match;
49054
+ }
49055
+ match = line.indexOf(delimiter, match + delimiter.length);
49056
+ }
49057
+ return -1;
49058
+ }
49059
+ function skipBasicString(line, start) {
49060
+ let escaped = false;
49061
+ for (let index = start; index < line.length; index += 1) {
49062
+ if (escaped) {
49063
+ escaped = false;
49064
+ continue;
49065
+ }
49066
+ if (line[index] === "\\") {
49067
+ escaped = true;
49068
+ continue;
49069
+ }
49070
+ if (line[index] === '"') {
49071
+ return index + 1;
49072
+ }
49073
+ }
49074
+ return line.length;
49075
+ }
49076
+ function normalizeCodexMcpTablePath(tablePath, mcpName) {
49077
+ const keyPattern = createCodexMcpKeyPattern(mcpName);
49078
+ const match = new RegExp(`^mcp_servers\\.${keyPattern}(\\..+)?$`).exec(tablePath);
49079
+ if (!match) {
49080
+ return void 0;
49081
+ }
49082
+ return `mcp_servers.${mcpName}${match[1] || ""}`;
49083
+ }
49084
+ function createCodexMcpKeyPattern(mcpName) {
49085
+ const quotedKey = `"${escapeRegExp3(mcpName)}"`;
49086
+ if (!/^[A-Za-z0-9_-]+$/.test(mcpName)) {
49087
+ return quotedKey;
49088
+ }
49089
+ return `(?:${quotedKey}|${escapeRegExp3(mcpName)})`;
49090
+ }
49091
+ function escapeRegExp3(value) {
49092
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
49093
+ }
49094
+
49095
+ // src/maker/cli/configWrite.ts
49096
+ import fs21 from "node:fs";
49097
+ import path22 from "node:path";
49098
+ function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
49099
+ const existed = fs21.existsSync(filePath);
49100
+ const previousContent = existed ? fs21.readFileSync(filePath, "utf8") : void 0;
49101
+ if (previousContent === nextContent) {
49102
+ return { changed: false };
49103
+ }
49104
+ const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
49105
+ fs21.mkdirSync(path22.dirname(filePath), { recursive: true });
49106
+ if (previousContent !== void 0 && backupPath) {
49107
+ fs21.writeFileSync(backupPath, previousContent, "utf8");
49108
+ }
49109
+ try {
49110
+ fs21.writeFileSync(filePath, nextContent, "utf8");
49111
+ validate == null ? void 0 : validate(fs21.readFileSync(filePath, "utf8"));
49112
+ return { changed: true, backupPath };
49113
+ } catch (error2) {
49114
+ if (previousContent !== void 0) {
49115
+ fs21.writeFileSync(filePath, previousContent, "utf8");
49116
+ } else {
49117
+ fs21.rmSync(filePath, { force: true });
49118
+ }
49119
+ throw error2;
49120
+ }
49121
+ }
49122
+
49123
+ // src/maker/cli/pluginMigration.ts
49124
+ function inspectCodexLegacyMakerMcp(options = {}) {
49125
+ const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
49126
+ if (!fs22.existsSync(configPath)) {
49127
+ return createInspection(configPath, "not_found", 0);
49128
+ }
49129
+ const content = fs22.readFileSync(configPath, "utf8");
49130
+ const registrations = findCodexMakerMainTables(content);
49131
+ if (registrations.length === 0) {
49132
+ return createInspection(configPath, "not_found", 0);
49133
+ }
49134
+ if (registrations.length > 1) {
49135
+ return createInspection(configPath, "ambiguous", registrations.length);
49136
+ }
49137
+ const enabled = registrations[0].enabled;
49138
+ return {
49139
+ ...createInspection(configPath, enabled ? "active" : "disabled", 1),
49140
+ enabled
49141
+ };
49142
+ }
49143
+ function migrateCodexLegacyMakerMcp(options = {}) {
49144
+ const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
49145
+ const makerHome = options.makerHome ?? getMakerHome();
49146
+ const statePath = getCodexPluginMigrationStatePath(makerHome);
49147
+ const inspection = inspectCodexLegacyMakerMcp({ configPath });
49148
+ if (inspection.status === "not_found") {
49149
+ return { ...inspection, action: "not_found", changed: false };
49150
+ }
49151
+ if (inspection.status === "ambiguous") {
49152
+ throw new Error(
49153
+ `Codex Maker MCP migration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before migrating.`
49154
+ );
49155
+ }
49156
+ if (inspection.status === "disabled") {
49157
+ const state2 = readMigrationState(statePath);
49158
+ const content = fs22.readFileSync(configPath, "utf8");
49159
+ const registration2 = findCodexMakerMainTables(content)[0];
49160
+ const owned = (state2 == null ? void 0 : state2.config_path) === configPath && sha256(readCodexMakerRegistration(content, registration2)) === state2.migrated_registration_sha256;
49161
+ return {
49162
+ ...inspection,
49163
+ action: owned ? "already_migrated" : "already_disabled",
49164
+ changed: false,
49165
+ ...owned ? { state_path: statePath } : {}
49166
+ };
49167
+ }
49168
+ if (!options.confirm) {
49169
+ throw new Error("Disabling the legacy Codex Maker MCP requires explicit confirmation.");
49170
+ }
49171
+ const previousContent = fs22.readFileSync(configPath, "utf8");
49172
+ const registration = findCodexMakerMainTables(previousContent)[0];
49173
+ const nextContent = disableCodexMakerRegistration(previousContent, registration);
49174
+ const state = {
49175
+ schema_version: 2,
49176
+ client: "codex",
49177
+ config_path: configPath,
49178
+ previous_enabled: registration.enabledExplicitly ? "true" : "implicit",
49179
+ original_registration_sha256: sha256(readCodexMakerRegistration(previousContent, registration)),
49180
+ migrated_registration_sha256: sha256(
49181
+ readCodexMakerRegistration(nextContent, findCodexMakerMainTables(nextContent)[0])
49182
+ ),
49183
+ migrated_at: (/* @__PURE__ */ new Date()).toISOString()
49184
+ };
49185
+ fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
49186
+ const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
49187
+ const migratedInspection = inspectCodexLegacyMakerMcp({ configPath });
49188
+ if (migratedInspection.status !== "disabled") {
49189
+ throw new Error("Codex Maker MCP migration validation did not find a disabled registration.");
49190
+ }
49191
+ fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
49192
+ `, "utf8");
49193
+ });
49194
+ return {
49195
+ ...inspectCodexLegacyMakerMcp({ configPath }),
49196
+ action: "disabled",
49197
+ changed: write.changed,
49198
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49199
+ state_path: statePath
49200
+ };
49201
+ }
49202
+ function restoreCodexLegacyMakerMcp(options = {}) {
49203
+ const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
49204
+ const makerHome = options.makerHome ?? getMakerHome();
49205
+ const statePath = getCodexPluginMigrationStatePath(makerHome);
49206
+ const inspection = inspectCodexLegacyMakerMcp({ configPath });
49207
+ const state = readMigrationState(statePath);
49208
+ if (!state || state.config_path !== configPath) {
49209
+ return { ...inspection, action: "not_owned", changed: false };
49210
+ }
49211
+ if (!options.confirm) {
49212
+ throw new Error("Restoring the legacy Codex Maker MCP requires explicit confirmation.");
49213
+ }
49214
+ if (inspection.status === "ambiguous") {
49215
+ throw new Error(
49216
+ `Codex Maker MCP restoration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before restoring.`
49217
+ );
49218
+ }
49219
+ if (inspection.status === "not_found") {
49220
+ throw new Error(
49221
+ "The migrated Codex Maker MCP registration no longer exists and cannot be restored."
49222
+ );
49223
+ }
49224
+ const previousContent = fs22.readFileSync(configPath, "utf8");
49225
+ const registration = findCodexMakerMainTables(previousContent)[0];
49226
+ const registrationSha256 = sha256(readCodexMakerRegistration(previousContent, registration));
49227
+ if (inspection.status === "active") {
49228
+ if (registrationSha256 !== state.original_registration_sha256) {
49229
+ return { ...inspection, action: "not_owned", changed: false };
49230
+ }
49231
+ fs22.unlinkSync(statePath);
49232
+ return { ...inspection, action: "already_restored", changed: false };
49233
+ }
49234
+ if (registrationSha256 !== state.migrated_registration_sha256) {
49235
+ return { ...inspection, action: "not_owned", changed: false };
49236
+ }
49237
+ const nextContent = restoreCodexMakerRegistration(previousContent, registration, state);
49238
+ const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
49239
+ const restoredInspection = inspectCodexLegacyMakerMcp({ configPath });
49240
+ if (restoredInspection.status !== "active") {
49241
+ throw new Error(
49242
+ "Codex Maker MCP restoration validation did not find an active registration."
49243
+ );
49244
+ }
49245
+ const restoredContent = fs22.readFileSync(configPath, "utf8");
49246
+ const restoredRegistration = findCodexMakerMainTables(restoredContent)[0];
49247
+ if (sha256(readCodexMakerRegistration(restoredContent, restoredRegistration)) !== state.original_registration_sha256) {
49248
+ throw new Error("Codex Maker MCP restoration changed the migrated registration identity.");
49249
+ }
49250
+ fs22.unlinkSync(statePath);
49251
+ });
49252
+ return {
49253
+ ...inspectCodexLegacyMakerMcp({ configPath }),
49254
+ action: "restored",
49255
+ changed: write.changed,
49256
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49257
+ state_path: statePath
49258
+ };
49259
+ }
49260
+ function findCodexMakerMainTables(content) {
49261
+ return findCodexMcpTables(content, "taptap-maker").filter((table) => table.isMain).map((table) => {
49262
+ const enabledAssignment = findTomlBooleanAssignment(
49263
+ content,
49264
+ table.bodyStart,
49265
+ table.bodyEnd,
49266
+ "enabled"
49267
+ );
49268
+ return {
49269
+ headerStart: table.headerStart,
49270
+ bodyStart: table.bodyStart,
49271
+ bodyEnd: table.bodyEnd,
49272
+ enabled: (enabledAssignment == null ? void 0 : enabledAssignment.value) !== false,
49273
+ enabledExplicitly: Boolean(enabledAssignment),
49274
+ ...enabledAssignment ? {
49275
+ enabledValueStart: enabledAssignment.valueStart,
49276
+ enabledValueEnd: enabledAssignment.valueEnd
49277
+ } : {}
49278
+ };
49279
+ });
49280
+ }
49281
+ function disableCodexMakerRegistration(content, registration) {
49282
+ if (registration.enabledValueStart !== void 0 && registration.enabledValueEnd !== void 0) {
49283
+ return `${content.slice(0, registration.enabledValueStart)}false${content.slice(
49284
+ registration.enabledValueEnd
49285
+ )}`;
49286
+ }
49287
+ return `${content.slice(0, registration.bodyStart)}
49288
+ enabled = false${content.slice(
49289
+ registration.bodyStart
49290
+ )}`;
49291
+ }
49292
+ function restoreCodexMakerRegistration(content, registration, state) {
49293
+ if (state.previous_enabled === "true") {
49294
+ if (registration.enabledValueStart === void 0 || registration.enabledValueEnd === void 0) {
49295
+ throw new Error("The migrated Codex Maker MCP enabled value is missing.");
49296
+ }
49297
+ return `${content.slice(0, registration.enabledValueStart)}true${content.slice(
49298
+ registration.enabledValueEnd
49299
+ )}`;
49300
+ }
49301
+ const insertedLine = "\nenabled = false";
49302
+ if (!content.startsWith(insertedLine, registration.bodyStart)) {
49303
+ throw new Error("The plugin-owned Codex Maker MCP disabled marker was modified.");
49304
+ }
49305
+ return `${content.slice(0, registration.bodyStart)}${content.slice(
49306
+ registration.bodyStart + insertedLine.length
49307
+ )}`;
49308
+ }
49309
+ function readCodexMakerRegistration(content, registration) {
49310
+ return content.slice(registration.headerStart, registration.bodyEnd).trimEnd();
49311
+ }
49312
+ function getCodexPluginMigrationStatePath(makerHome) {
49313
+ return path23.join(makerHome, "plugin-migrations", "codex.json");
49314
+ }
49315
+ function readMigrationState(statePath) {
49316
+ if (!fs22.existsSync(statePath)) {
49317
+ return void 0;
49318
+ }
49319
+ try {
49320
+ const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
49321
+ return (state == null ? void 0 : state.schema_version) === 2 && state.client === "codex" ? state : void 0;
49322
+ } catch {
49323
+ return void 0;
49324
+ }
49325
+ }
49326
+ function sha256(content) {
49327
+ return crypto3.createHash("sha256").update(content).digest("hex");
49328
+ }
49329
+ function createInspection(configPath, status, registrationCount) {
49330
+ return {
49331
+ client: "codex",
49332
+ status,
49333
+ config_path: configPath,
49334
+ registration_count: registrationCount
49335
+ };
49336
+ }
49337
+ function inspectWorkBuddyLegacyMakerMcp(options = {}) {
49338
+ const configPaths = getWorkBuddyConfigPaths(options.configPaths);
49339
+ const registrations = findWorkBuddyMakerRegistrations(configPaths);
49340
+ const registrationPaths = registrations.map((entry) => entry.configPath);
49341
+ if (registrations.length === 0) {
49342
+ return createWorkBuddyInspection(configPaths[0], "not_found", []);
49343
+ }
49344
+ const activeRegistrations = registrations.filter((entry) => entry.registration.disabled !== true);
49345
+ if (activeRegistrations.length > 1) {
49346
+ return createWorkBuddyInspection(configPaths[0], "ambiguous", registrationPaths);
49347
+ }
49348
+ if (activeRegistrations.length === 0) {
49349
+ return {
49350
+ ...createWorkBuddyInspection(registrations[0].configPath, "disabled", registrationPaths),
49351
+ enabled: false
49352
+ };
49353
+ }
49354
+ const active = activeRegistrations[0];
49355
+ return {
49356
+ ...createWorkBuddyInspection(active.configPath, "active", registrationPaths),
49357
+ enabled: true
49358
+ };
49359
+ }
49360
+ function migrateWorkBuddyLegacyMakerMcp(options = {}) {
49361
+ const configPaths = getWorkBuddyConfigPaths(options.configPaths);
49362
+ const makerHome = options.makerHome ?? getMakerHome();
49363
+ const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
49364
+ const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49365
+ if (inspection.status === "not_found") {
49366
+ return { ...inspection, action: "not_found", changed: false };
49367
+ }
49368
+ if (inspection.status === "ambiguous") {
49369
+ throw new Error(
49370
+ `WorkBuddy Maker MCP migration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
49371
+ );
49372
+ }
49373
+ const registrations = findWorkBuddyMakerRegistrations(configPaths);
49374
+ if (inspection.status === "disabled") {
49375
+ const state2 = readWorkBuddyMigrationState(statePath);
49376
+ const current2 = state2 ? registrations.find((entry) => entry.configPath === state2.config_path) : registrations[0];
49377
+ const owned = Boolean(
49378
+ state2 && current2 && hashWorkBuddyRegistration(current2.registration) === state2.migrated_registration_sha256
49379
+ );
49380
+ return {
49381
+ ...inspection,
49382
+ ...owned && current2 ? { config_path: current2.configPath } : {},
49383
+ action: owned ? "already_migrated" : "already_disabled",
49384
+ changed: false,
49385
+ ...owned ? { state_path: statePath } : {}
49386
+ };
49387
+ }
49388
+ if (!options.confirm) {
49389
+ throw new Error("Disabling the legacy WorkBuddy Maker MCP requires explicit confirmation.");
49390
+ }
49391
+ const current = registrations.find((entry) => entry.configPath === inspection.config_path);
49392
+ if (!current) {
49393
+ throw new Error("The active WorkBuddy Maker MCP registration could not be resolved.");
49394
+ }
49395
+ const originalRegistration = { ...current.registration };
49396
+ const previousDisabled = Object.prototype.hasOwnProperty.call(originalRegistration, "disabled") ? false : "missing";
49397
+ const migratedRegistration = { ...originalRegistration, disabled: true };
49398
+ setWorkBuddyMakerRegistration(current.config, migratedRegistration);
49399
+ const nextContent = `${JSON.stringify(current.config, null, 2)}
49400
+ `;
49401
+ const state = {
49402
+ schema_version: 1,
49403
+ client: "workbuddy",
49404
+ config_path: current.configPath,
49405
+ previous_disabled: previousDisabled,
49406
+ original_registration_sha256: hashWorkBuddyRegistration(originalRegistration),
49407
+ migrated_registration_sha256: hashWorkBuddyRegistration(migratedRegistration),
49408
+ migrated_at: (/* @__PURE__ */ new Date()).toISOString()
49409
+ };
49410
+ fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
49411
+ const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
49412
+ const migrated = findWorkBuddyMakerRegistrations(configPaths).find(
49413
+ (entry) => entry.configPath === current.configPath
49414
+ );
49415
+ if (!migrated || hashWorkBuddyRegistration(migrated.registration) !== state.migrated_registration_sha256) {
49416
+ throw new Error(
49417
+ "WorkBuddy Maker MCP migration validation did not find the disabled registration."
49418
+ );
49419
+ }
49420
+ fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
49421
+ `, "utf8");
49422
+ });
49423
+ const migratedInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49424
+ return {
49425
+ ...migratedInspection,
49426
+ config_path: current.configPath,
49427
+ action: "disabled",
49428
+ changed: write.changed,
49429
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49430
+ state_path: statePath
49431
+ };
49432
+ }
49433
+ function restoreWorkBuddyLegacyMakerMcp(options = {}) {
49434
+ const configPaths = getWorkBuddyConfigPaths(options.configPaths);
49435
+ const makerHome = options.makerHome ?? getMakerHome();
49436
+ const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
49437
+ const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49438
+ const state = readWorkBuddyMigrationState(statePath);
49439
+ if (!state) {
49440
+ return { ...inspection, action: "not_owned", changed: false };
49441
+ }
49442
+ if (!options.confirm) {
49443
+ throw new Error("Restoring the legacy WorkBuddy Maker MCP requires explicit confirmation.");
49444
+ }
49445
+ if (inspection.status === "ambiguous") {
49446
+ throw new Error(
49447
+ `WorkBuddy Maker MCP restoration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
49448
+ );
49449
+ }
49450
+ if (inspection.status === "not_found") {
49451
+ throw new Error(
49452
+ "The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
49453
+ );
49454
+ }
49455
+ const current = findWorkBuddyMakerRegistrations(configPaths).find(
49456
+ (entry) => entry.configPath === state.config_path
49457
+ );
49458
+ if (!current) {
49459
+ throw new Error(
49460
+ "The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
49461
+ );
49462
+ }
49463
+ const registrationSha256 = hashWorkBuddyRegistration(current.registration);
49464
+ const currentEnabled = current.registration.disabled !== true;
49465
+ if (currentEnabled) {
49466
+ if (registrationSha256 !== state.original_registration_sha256) {
49467
+ return {
49468
+ ...inspection,
49469
+ config_path: current.configPath,
49470
+ action: "not_owned",
49471
+ changed: false
49472
+ };
49473
+ }
49474
+ fs22.unlinkSync(statePath);
49475
+ return {
49476
+ ...inspection,
49477
+ config_path: current.configPath,
49478
+ action: "already_restored",
49479
+ changed: false
49480
+ };
49481
+ }
49482
+ if (registrationSha256 !== state.migrated_registration_sha256) {
49483
+ return { ...inspection, config_path: current.configPath, action: "not_owned", changed: false };
49484
+ }
49485
+ const restoredRegistration = { ...current.registration };
49486
+ if (state.previous_disabled === "missing") {
49487
+ delete restoredRegistration.disabled;
49488
+ } else {
49489
+ restoredRegistration.disabled = false;
49490
+ }
49491
+ setWorkBuddyMakerRegistration(current.config, restoredRegistration);
49492
+ const nextContent = `${JSON.stringify(current.config, null, 2)}
49493
+ `;
49494
+ const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
49495
+ const restoredInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49496
+ if (restoredInspection.status !== "active") {
49497
+ throw new Error(
49498
+ "WorkBuddy Maker MCP restoration validation did not find an active registration."
49499
+ );
49500
+ }
49501
+ const restored = findWorkBuddyMakerRegistrations(configPaths).find(
49502
+ (entry) => entry.configPath === state.config_path
49503
+ );
49504
+ if (!restored || hashWorkBuddyRegistration(restored.registration) !== state.original_registration_sha256) {
49505
+ throw new Error("WorkBuddy Maker MCP restoration changed the registration identity.");
49506
+ }
49507
+ fs22.unlinkSync(statePath);
49508
+ });
49509
+ return {
49510
+ ...inspectWorkBuddyLegacyMakerMcp({ configPaths }),
49511
+ config_path: current.configPath,
49512
+ action: "restored",
49513
+ changed: write.changed,
49514
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49515
+ state_path: statePath
49516
+ };
49517
+ }
49518
+ function getWorkBuddyConfigPaths(configPaths) {
49519
+ return configPaths ?? [
49520
+ path23.join(os6.homedir(), ".workbuddy", "mcp.json"),
49521
+ path23.join(os6.homedir(), ".workbuddy", ".mcp.json")
49522
+ ];
49523
+ }
49524
+ function findWorkBuddyMakerRegistrations(configPaths) {
49525
+ const registrations = [];
49526
+ for (const configPath of configPaths) {
49527
+ if (!fs22.existsSync(configPath)) {
49528
+ continue;
49529
+ }
49530
+ let config2;
49531
+ try {
49532
+ config2 = JSON.parse(fs22.readFileSync(configPath, "utf8"));
49533
+ } catch (error2) {
49534
+ throw new Error(
49535
+ `Cannot parse WorkBuddy MCP config ${configPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
49536
+ );
49537
+ }
49538
+ if (!isRecord5(config2)) {
49539
+ throw new Error(`WorkBuddy MCP config must contain a JSON object: ${configPath}`);
49540
+ }
49541
+ const servers = config2.mcpServers;
49542
+ if (servers === void 0) {
49543
+ continue;
49544
+ }
49545
+ if (!isRecord5(servers)) {
49546
+ throw new Error(`WorkBuddy MCP config mcpServers must be an object: ${configPath}`);
49547
+ }
49548
+ const registration = servers["taptap-maker"];
49549
+ if (registration === void 0) {
49550
+ continue;
49551
+ }
49552
+ if (!isRecord5(registration)) {
49553
+ throw new Error(`WorkBuddy taptap-maker MCP registration must be an object: ${configPath}`);
49554
+ }
49555
+ registrations.push({ configPath, config: config2, registration });
49556
+ }
49557
+ return registrations;
49558
+ }
49559
+ function setWorkBuddyMakerRegistration(config2, registration) {
49560
+ const servers = config2.mcpServers;
49561
+ if (!isRecord5(servers)) {
49562
+ throw new Error("WorkBuddy MCP config mcpServers must be an object.");
49563
+ }
49564
+ servers["taptap-maker"] = registration;
49565
+ }
49566
+ function getWorkBuddyPluginMigrationStatePath(makerHome) {
49567
+ return path23.join(makerHome, "plugin-migrations", "workbuddy.json");
49568
+ }
49569
+ function readWorkBuddyMigrationState(statePath) {
49570
+ if (!fs22.existsSync(statePath)) {
49571
+ return void 0;
49572
+ }
49573
+ try {
49574
+ const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
49575
+ return (state == null ? void 0 : state.schema_version) === 1 && state.client === "workbuddy" ? state : void 0;
49576
+ } catch {
49577
+ return void 0;
49578
+ }
49579
+ }
49580
+ function hashWorkBuddyRegistration(registration) {
49581
+ return sha256(JSON.stringify(registration));
49582
+ }
49583
+ function createWorkBuddyInspection(configPath, status, configPaths) {
49584
+ return {
49585
+ client: "workbuddy",
49586
+ status,
49587
+ config_path: configPath,
49588
+ config_paths: configPaths,
49589
+ registration_count: configPaths.length
49590
+ };
49591
+ }
49592
+ function isRecord5(value) {
49593
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
49594
+ }
49595
+
49596
+ // src/maker/cli/dshPluginMigration.ts
49597
+ var import_yaml2 = __toESM(require_dist2());
49598
+ import fs23 from "node:fs";
49599
+ import os7 from "node:os";
49600
+ import path24 from "node:path";
49601
+ import crypto4 from "node:crypto";
49602
+ var DSH_MAKER_MCP_NAME = "taptap-maker";
49603
+ function inspectDshLegacyMakerMcp(options = {}) {
49604
+ const registrations = findDshMakerRegistrations(options.dshHome);
49605
+ const configPaths = unique(registrations.map((entry) => entry.configPath));
49606
+ if (registrations.length === 0) {
49607
+ return createDshInspection("not_found", [], configPaths);
49608
+ }
49609
+ if (registrations.length > 1) {
49610
+ return createDshInspection("ambiguous", configPaths, configPaths);
49611
+ }
49612
+ return createDshInspection("active", [registrations[0].configPath], configPaths);
49613
+ }
49614
+ function migrateDshLegacyMakerMcp(options = {}) {
49615
+ const makerHome = getMakerHome();
49616
+ const statePath = getDshPluginMigrationStatePath(makerHome);
49617
+ const registrations = findDshMakerRegistrations(options.dshHome);
49618
+ const inspection = inspectDshLegacyMakerMcp(options);
49619
+ if (inspection.status === "not_found") {
49620
+ return { ...inspection, action: "not_found", changed: false };
49621
+ }
49622
+ if (inspection.status === "ambiguous") {
49623
+ throw new Error(
49624
+ `DSH Maker MCP migration found ${inspection.registration_count} registrations in ${inspection.config_paths.join(", ")}; resolve the duplicates before migrating.`
49625
+ );
49626
+ }
49627
+ if (!options.confirm) {
49628
+ throw new Error(
49629
+ "Removing the legacy DSH Maker MCP registration requires explicit confirmation."
49630
+ );
49631
+ }
49632
+ const registration = registrations[0];
49633
+ const previousContent = fs23.readFileSync(registration.configPath, "utf8");
49634
+ const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
49635
+ if (document.errors.length > 0) {
49636
+ throw new Error(`Invalid YAML in ${registration.configPath}: ${document.errors[0].message}`);
49637
+ }
49638
+ removeDshMakerRegistration(document, registration);
49639
+ const nextContent = document.toString({ lineWidth: 0 });
49640
+ const state = {
49641
+ schema_version: 1,
49642
+ client: "dsh",
49643
+ config_path: registration.configPath,
49644
+ removed_registration: registration.registration,
49645
+ removed_registration_sha256: sha2562(JSON.stringify(registration.registration)),
49646
+ migrated_at: (/* @__PURE__ */ new Date()).toISOString()
49647
+ };
49648
+ fs23.mkdirSync(path24.dirname(statePath), { recursive: true });
49649
+ const write = writeConfigWithTapTapBackupIfChanged(registration.configPath, nextContent, () => {
49650
+ const after = findDshMakerRegistrations(options.dshHome);
49651
+ if (after.some((entry) => entry.configPath === registration.configPath)) {
49652
+ throw new Error("DSH Maker MCP migration validation still found a registration.");
49653
+ }
49654
+ fs23.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
49655
+ `, "utf8");
49656
+ });
49657
+ return {
49658
+ ...inspectDshLegacyMakerMcp(options),
49659
+ action: "removed",
49660
+ changed: write.changed,
49661
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49662
+ state_path: statePath
49663
+ };
49664
+ }
49665
+ function restoreDshLegacyMakerMcp(options = {}) {
49666
+ const makerHome = getMakerHome();
49667
+ const statePath = getDshPluginMigrationStatePath(makerHome);
49668
+ const inspection = inspectDshLegacyMakerMcp(options);
49669
+ const state = readDshMigrationState(statePath);
49670
+ if (!state) {
49671
+ return { ...inspection, action: "not_owned", changed: false };
49672
+ }
49673
+ if (!options.confirm) {
49674
+ throw new Error(
49675
+ "Restoring the legacy DSH Maker MCP registration requires explicit confirmation."
49676
+ );
49677
+ }
49678
+ if (inspection.status === "ambiguous") {
49679
+ throw new Error(
49680
+ `DSH Maker MCP restoration found ${inspection.registration_count} registrations; resolve the duplicates before restoring.`
49681
+ );
49682
+ }
49683
+ if (inspection.status === "active") {
49684
+ const current = findDshMakerRegistrations(options.dshHome)[0];
49685
+ const currentSha = sha2562(JSON.stringify(current.registration));
49686
+ if (currentSha === state.removed_registration_sha256) {
49687
+ fs23.rmSync(statePath, { force: true });
49688
+ return { ...inspection, action: "already_restored", changed: false, state_path: statePath };
49689
+ }
49690
+ return { ...inspection, action: "not_owned", changed: false };
49691
+ }
49692
+ const configPath = state.config_path;
49693
+ const previousContent = fs23.readFileSync(configPath, "utf8");
49694
+ const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
49695
+ if (document.errors.length > 0) {
49696
+ throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
49697
+ }
49698
+ reinsertDshMakerRegistration(document, state.removed_registration);
49699
+ const nextContent = document.toString({ lineWidth: 0 });
49700
+ const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
49701
+ const restored = findDshMakerRegistrations(options.dshHome);
49702
+ const match = restored.find((entry) => entry.configPath === configPath);
49703
+ if (!match || sha2562(JSON.stringify(match.registration)) !== state.removed_registration_sha256) {
49704
+ throw new Error("DSH Maker MCP restoration changed the registration identity.");
49705
+ }
49706
+ fs23.rmSync(statePath, { force: true });
49707
+ });
49708
+ return {
49709
+ ...inspectDshLegacyMakerMcp(options),
49710
+ action: "restored",
49711
+ changed: write.changed,
49712
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49713
+ state_path: statePath
49714
+ };
49715
+ }
49716
+ function findDshMakerRegistrations(dshHome) {
49717
+ const resolvedDshHome = dshHome || getDshHome();
49718
+ const configPaths = listDshMcpConfigPaths({ homeDir: os7.homedir(), dshHome: resolvedDshHome });
49719
+ const registrations = [];
49720
+ for (const configPath of configPaths) {
49721
+ if (!fs23.existsSync(configPath)) {
49722
+ continue;
49723
+ }
49724
+ const content = fs23.readFileSync(configPath, "utf8");
49725
+ const document = (0, import_yaml2.parseDocument)(content, { prettyErrors: true });
49726
+ if (document.errors.length > 0) {
49727
+ throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
49728
+ }
49729
+ const candidates = findDshMakerCandidates(document);
49730
+ for (const candidate of candidates) {
49731
+ registrations.push({ configPath, ...candidate });
49732
+ }
49733
+ }
49734
+ return registrations;
49735
+ }
49736
+ function findDshMakerCandidates(document) {
49737
+ const candidates = [];
49738
+ const top = document.contents;
49739
+ if (!(0, import_yaml2.isSeq)(top)) {
49740
+ return candidates;
49741
+ }
49742
+ top.items.forEach((rawPatch, patchIndex) => {
49743
+ const patchNode = rawPatch;
49744
+ const patch = patchNode.toJSON();
49745
+ if (Array.isArray(patch == null ? void 0 : patch.insert)) {
49746
+ const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
49747
+ if (!(0, import_yaml2.isSeq)(insertNode)) {
49748
+ return;
49749
+ }
49750
+ insertNode.items.forEach((rawRow, insertIndex) => {
49751
+ const rowNode = rawRow;
49752
+ const row = rowNode.toJSON();
49753
+ if (isDshMakerPluginCandidate(row)) {
49754
+ candidates.push({
49755
+ patchIndex,
49756
+ insertIndex,
49757
+ registration: row
49758
+ });
49759
+ }
49760
+ });
49761
+ return;
49762
+ }
49763
+ if (isDshMakerPluginCandidate(patch)) {
49764
+ candidates.push({
49765
+ patchIndex,
49766
+ registration: patch
49767
+ });
49768
+ }
49769
+ });
49770
+ return candidates;
49771
+ }
49772
+ function removeDshMakerRegistration(document, registration) {
49773
+ const top = document.contents;
49774
+ if (!(0, import_yaml2.isSeq)(top)) {
49775
+ throw new Error("DSH config top-level value must be a plugin array.");
49776
+ }
49777
+ if (registration.insertIndex !== void 0) {
49778
+ const patchNode = top.items[registration.patchIndex];
49779
+ const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
49780
+ if (!(0, import_yaml2.isSeq)(insertNode)) {
49781
+ throw new Error("Invalid DSH insert patch.");
49782
+ }
49783
+ insertNode.items.splice(registration.insertIndex, 1);
49784
+ if (insertNode.items.length === 0) {
49785
+ top.items.splice(registration.patchIndex, 1);
49786
+ }
49787
+ return;
49788
+ }
49789
+ top.items.splice(registration.patchIndex, 1);
49790
+ }
49791
+ function reinsertDshMakerRegistration(document, registration) {
49792
+ const top = document.contents;
49793
+ if (!(0, import_yaml2.isSeq)(top)) {
49794
+ throw new Error("DSH config top-level value must be a plugin array.");
49795
+ }
49796
+ top.items.push(document.createNode({ insert: [registration] }));
49797
+ }
49798
+ function isDshMakerPluginCandidate(value) {
49799
+ if (!isRecord6(value)) {
49800
+ return false;
49801
+ }
49802
+ if (value.id === DSH_MAKER_PLUGIN_ID) {
49803
+ return true;
49804
+ }
49805
+ const config2 = isRecord6(value.config) ? value.config : void 0;
49806
+ return value.name === DSH_MCP_PLUGIN_NAME && (config2 == null ? void 0 : config2.serverName) === DSH_MAKER_MCP_NAME;
49807
+ }
49808
+ function getDshPluginMigrationStatePath(makerHome) {
49809
+ return path24.join(makerHome, "plugin-migrations", "dsh.json");
49810
+ }
49811
+ function readDshMigrationState(statePath) {
49812
+ if (!fs23.existsSync(statePath)) {
49813
+ return void 0;
49814
+ }
49815
+ try {
49816
+ const state = JSON.parse(fs23.readFileSync(statePath, "utf8"));
49817
+ return (state == null ? void 0 : state.schema_version) === 1 && state.client === "dsh" ? state : void 0;
49818
+ } catch {
49819
+ return void 0;
49820
+ }
49821
+ }
49822
+ function createDshInspection(status, primaryPaths, allPaths) {
49823
+ return {
49824
+ client: "dsh",
49825
+ status,
49826
+ config_path: primaryPaths[0] ?? "",
49827
+ config_paths: allPaths,
49828
+ registration_count: primaryPaths.length
49829
+ };
49830
+ }
49831
+ function sha2562(content) {
49832
+ return crypto4.createHash("sha256").update(content).digest("hex");
49833
+ }
49834
+ function isRecord6(value) {
49835
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
49836
+ }
49837
+ function unique(values) {
49838
+ return [...new Set(values)];
49839
+ }
49840
+
49841
+ // src/maker/cli/workBuddyProjectSkills.ts
49842
+ import fs24 from "node:fs";
49843
+ import path25 from "node:path";
49844
+ function syncWorkBuddyProjectSkills(targetDir, options = {}) {
49845
+ const platform = options.platform ?? process.platform;
49846
+ const projectDir = path25.resolve(targetDir);
49847
+ const sourceDir = path25.join(projectDir, ".installer", "skills");
49848
+ const workBuddySkillsDir = path25.join(projectDir, ".workbuddy", "skills");
49849
+ const result = {
49850
+ status: "skipped",
49851
+ sourceDir,
49852
+ targetDir: workBuddySkillsDir,
49853
+ installedSkills: [],
49854
+ skippedSkills: []
49855
+ };
49856
+ if (!isDirectory(sourceDir)) {
49857
+ result.reason = "source_not_found";
49858
+ return result;
49859
+ }
49860
+ const sourceSkills = fs24.readdirSync(sourceDir, { withFileTypes: true }).filter(
49861
+ (entry) => entry.isDirectory() && fs24.existsSync(path25.join(sourceDir, entry.name, "SKILL.md"))
49862
+ ).map((entry) => entry.name).sort();
49863
+ for (const sourceSkillName of sourceSkills) {
49864
+ const workBuddySkillName = `taptap-maker-${sourceSkillName}`;
49865
+ const workBuddySkillDir = path25.join(workBuddySkillsDir, workBuddySkillName);
49866
+ if (pathEntryExists(workBuddySkillDir)) {
49867
+ result.skippedSkills.push(workBuddySkillName);
49868
+ continue;
49869
+ }
49870
+ fs24.mkdirSync(workBuddySkillsDir, { recursive: true });
49871
+ installSkillContents(path25.join(sourceDir, sourceSkillName), workBuddySkillDir, platform);
49872
+ result.installedSkills.push(workBuddySkillName);
49873
+ }
49874
+ if (result.installedSkills.length > 0) {
49875
+ result.status = "installed";
49876
+ }
49877
+ return result;
49878
+ }
49879
+ function installSkillContents(sourceDir, targetDir, platform) {
49880
+ fs24.mkdirSync(targetDir);
49881
+ try {
49882
+ for (const entry of fs24.readdirSync(sourceDir)) {
49883
+ linkOrCopyEntry(path25.join(sourceDir, entry), path25.join(targetDir, entry), platform);
49884
+ }
49885
+ } catch (error2) {
49886
+ fs24.rmSync(targetDir, { recursive: true, force: true });
49887
+ throw error2;
49888
+ }
49889
+ }
49890
+ function linkOrCopyEntry(source, target, platform) {
49891
+ const stat = fs24.statSync(source);
49892
+ if (platform === "win32" && stat.isFile()) {
49893
+ fs24.copyFileSync(source, target);
49894
+ return;
49895
+ }
49896
+ try {
49897
+ const linkTarget = platform === "win32" ? source : path25.relative(path25.dirname(target), source);
49898
+ const linkType = stat.isDirectory() ? platform === "win32" ? "junction" : "dir" : "file";
49899
+ fs24.symlinkSync(linkTarget, target, linkType);
49900
+ } catch (error2) {
49901
+ try {
49902
+ fs24.cpSync(source, target, { recursive: stat.isDirectory() });
49903
+ } catch (copyError) {
49904
+ throw new Error(
49905
+ `Failed to install WorkBuddy project skill entry ${source}: ${formatError3(error2)}; copy fallback: ${formatError3(copyError)}`
49906
+ );
49907
+ }
49908
+ }
49909
+ }
49910
+ function isDirectory(value) {
49911
+ try {
49912
+ return fs24.statSync(value).isDirectory();
49913
+ } catch {
49914
+ return false;
49915
+ }
49916
+ }
49917
+ function pathEntryExists(value) {
49918
+ try {
49919
+ fs24.lstatSync(value);
49920
+ return true;
49921
+ } catch {
49922
+ return false;
49923
+ }
49924
+ }
49925
+ function formatError3(error2) {
49926
+ return error2 instanceof Error ? error2.message : String(error2);
49927
+ }
49928
+
48753
49929
  // src/maker/cli/commands.ts
48754
- var VERSION2 = true ? "0.0.30" : "dev";
49930
+ var VERSION2 = true ? "0.0.31-beta.2" : "dev";
48755
49931
  var DEFAULT_MCP_NAME = "taptap-maker";
48756
49932
  var MAKER_NPM_PACKAGE = "@taptap/maker";
48757
- var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
49933
+ var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
49934
+ "pat",
49935
+ "mcp",
49936
+ "dev-kit",
49937
+ "logs",
49938
+ "python",
49939
+ "lua-lsp",
49940
+ "agents",
49941
+ "plugin"
49942
+ ]);
48758
49943
  var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
48759
49944
  "json",
48760
49945
  "skip_confirm",
@@ -48765,6 +49950,7 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
48765
49950
  "all",
48766
49951
  "create",
48767
49952
  "consent",
49953
+ "confirm",
48768
49954
  "context_stdin",
48769
49955
  "h",
48770
49956
  "help"
@@ -48823,6 +50009,10 @@ async function runMakerCli(argv) {
48823
50009
  await runAgentsUpdate(parsed, ctx);
48824
50010
  return;
48825
50011
  }
50012
+ if (command === "plugin") {
50013
+ runPluginLifecycle(parsed, ctx);
50014
+ return;
50015
+ }
48826
50016
  if (command === "upgrade") {
48827
50017
  await runUpgrade(parsed, ctx);
48828
50018
  return;
@@ -48845,6 +50035,57 @@ async function runMakerCli(argv) {
48845
50035
  }
48846
50036
  throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
48847
50037
  }
50038
+ function runPluginLifecycle(parsed, ctx) {
50039
+ const subcommand = parsed.command[1];
50040
+ const client = stringOption(parsed, "client") || "codex";
50041
+ if (client !== "codex" && client !== "workbuddy" && client !== "dsh") {
50042
+ throw new Error(
50043
+ `Unsupported Maker plugin client: ${client}. Supported clients: codex, workbuddy, dsh.`
50044
+ );
50045
+ }
50046
+ if (subcommand === "inspect") {
50047
+ writePluginLifecycleResult(
50048
+ ctx,
50049
+ client === "codex" ? inspectCodexLegacyMakerMcp() : client === "workbuddy" ? inspectWorkBuddyLegacyMakerMcp() : inspectDshLegacyMakerMcp()
50050
+ );
50051
+ return;
50052
+ }
50053
+ if (subcommand === "migrate") {
50054
+ writePluginLifecycleResult(
50055
+ ctx,
50056
+ client === "codex" ? migrateCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? migrateWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : migrateDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
50057
+ );
50058
+ return;
50059
+ }
50060
+ if (subcommand === "restore") {
50061
+ writePluginLifecycleResult(
50062
+ ctx,
50063
+ client === "codex" ? restoreCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? restoreWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : restoreDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
50064
+ );
50065
+ return;
50066
+ }
50067
+ throw new Error("Unknown Maker plugin command. Use inspect, migrate, or restore.");
50068
+ }
50069
+ function writePluginLifecycleResult(ctx, result) {
50070
+ if (ctx.json) {
50071
+ writeJson(result);
50072
+ return;
50073
+ }
50074
+ process.stdout.write(
50075
+ [
50076
+ "TapTap Maker plugin migration",
50077
+ "",
50078
+ `- client: ${result.client}`,
50079
+ `- legacy_mcp_status: ${result.status}`,
50080
+ `- config_path: ${result.config_path}`,
50081
+ ..."config_paths" in result && result.config_paths.length > 1 ? [`- config_paths: ${result.config_paths.join(", ")}`] : [],
50082
+ `- registration_count: ${result.registration_count}`,
50083
+ ..."action" in result ? [`- action: ${result.action}`, `- changed: ${result.changed}`] : [],
50084
+ ..."backup_path" in result && result.backup_path ? [`- backup_path: ${result.backup_path}`] : [],
50085
+ ""
50086
+ ].join("\n")
50087
+ );
50088
+ }
48848
50089
  function parseArgs(argv) {
48849
50090
  const command = [];
48850
50091
  const positionals = [];
@@ -48892,7 +50133,7 @@ function toOptionKey(value) {
48892
50133
  }
48893
50134
  async function runInit(parsed, ctx) {
48894
50135
  rejectPackageOption(parsed);
48895
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50136
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
48896
50137
  const env = makerEnvOption(parsed);
48897
50138
  const skipConfirm = booleanOption(parsed, "skip_confirm");
48898
50139
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -49007,7 +50248,7 @@ async function runInit(parsed, ctx) {
49007
50248
  }
49008
50249
  async function runDoctor(parsed, ctx) {
49009
50250
  var _a3, _b;
49010
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50251
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49011
50252
  const env = makerEnvOption(parsed);
49012
50253
  const git = checkGitEnvironment();
49013
50254
  const python = checkMakerPythonEnvironment();
@@ -49098,8 +50339,8 @@ async function runDoctor(parsed, ctx) {
49098
50339
  );
49099
50340
  }
49100
50341
  function inspectMakerDoctorExecutionContext(options) {
49101
- const doctorCwd = path22.resolve(process.cwd());
49102
- const makerProjectDir = options.makerProjectDir ? path22.resolve(options.makerProjectDir) : void 0;
50342
+ const doctorCwd = path26.resolve(process.cwd());
50343
+ const makerProjectDir = options.makerProjectDir ? path26.resolve(options.makerProjectDir) : void 0;
49103
50344
  if (!makerProjectDir) {
49104
50345
  return {
49105
50346
  active_client_session: "not_checked",
@@ -49134,9 +50375,9 @@ function samePath2(left, right) {
49134
50375
  return normalizePathForCompare3(left) === normalizePathForCompare3(right);
49135
50376
  }
49136
50377
  function normalizePathForCompare3(value) {
49137
- const resolved = path22.resolve(value);
50378
+ const resolved = path26.resolve(value);
49138
50379
  try {
49139
- return fs21.realpathSync.native(resolved);
50380
+ return fs25.realpathSync.native(resolved);
49140
50381
  } catch {
49141
50382
  return resolved;
49142
50383
  }
@@ -49454,7 +50695,7 @@ async function runPatSet(parsed, ctx) {
49454
50695
  }
49455
50696
  async function resolvePatSet(parsed, ctx) {
49456
50697
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
49457
- const pat = fs21.readFileSync(0, "utf8").trim();
50698
+ const pat = fs25.readFileSync(0, "utf8").trim();
49458
50699
  if (!pat) {
49459
50700
  throw new Error("No PAT found on stdin.");
49460
50701
  }
@@ -49509,17 +50750,17 @@ async function prepareMcpLauncher(options) {
49509
50750
  if (options.mode === "self") {
49510
50751
  launcher = materializeMakerSelfLauncher({
49511
50752
  version: VERSION2,
49512
- bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(path22.resolve(process.cwd(), "dist", "maker.js")).href,
50753
+ bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(path26.resolve(process.cwd(), "dist", "maker.js")).href,
49513
50754
  makerHome: getMakerHome()
49514
50755
  });
49515
50756
  } else {
49516
50757
  const packageSpec = resolveMakerPackageSpec(MAKER_NPM_PACKAGE, VERSION2);
49517
50758
  launcher = resolveMakerMcpLauncher({ packageName: packageSpec });
49518
50759
  const configuredCache = process.env.npm_config_cache || process.env.NPM_CONFIG_CACHE;
49519
- const npmCacheDir = path22.resolve(
49520
- configuredCache || path22.join(getMakerHome(), "cache", "npm")
50760
+ const npmCacheDir = path26.resolve(
50761
+ configuredCache || path26.join(getMakerHome(), "cache", "npm")
49521
50762
  );
49522
- fs21.mkdirSync(npmCacheDir, { recursive: true });
50763
+ fs25.mkdirSync(npmCacheDir, { recursive: true });
49523
50764
  launcherEnv = { npm_config_cache: npmCacheDir };
49524
50765
  }
49525
50766
  } catch (error2) {
@@ -49652,14 +50893,37 @@ ${indent3(payload.stderr)}` : "",
49652
50893
  }
49653
50894
  async function runMcpReport(parsed, ctx) {
49654
50895
  rejectPackageOption(parsed);
49655
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50896
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49656
50897
  const contextInput = booleanOption(parsed, "context_stdin") ? await readStdinText() : "";
49657
50898
  const context = parseMakerMcpReportContext(contextInput);
50899
+ const reportRuntime = resolveMakerMcpReportRuntime({
50900
+ distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
50901
+ bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : void 0
50902
+ });
49658
50903
  const diagnostics = await collectMakerMcpIssueDiagnostics({
49659
- ide: stringOption(parsed, "ide"),
50904
+ ide: stringOption(parsed, "ide") || (reportRuntime == null ? void 0 : reportRuntime.client),
49660
50905
  targetDir,
49661
50906
  makerVersion: VERSION2,
50907
+ configSource: reportRuntime == null ? void 0 : reportRuntime.config_source,
50908
+ distribution: reportRuntime == null ? void 0 : reportRuntime.distribution,
49662
50909
  verify: async () => {
50910
+ if (reportRuntime) {
50911
+ const verification = await verifyMakerMcpLauncher(reportRuntime.launcher, {
50912
+ cwd: reportRuntime.cwd,
50913
+ env: reportRuntime.env,
50914
+ timeoutMs: 15e3
50915
+ });
50916
+ return {
50917
+ ok: verification.ok,
50918
+ stage: verification.stage,
50919
+ launcher_kind: verification.launcherKind,
50920
+ command: verification.command,
50921
+ tools: verification.toolNames,
50922
+ stderr: verification.stderr,
50923
+ error: verification.error,
50924
+ failure_type: verification.failureType
50925
+ };
50926
+ }
49663
50927
  const prepared = await prepareMcpLauncher({
49664
50928
  env: makerEnvOption(parsed),
49665
50929
  mode: "self"
@@ -49682,7 +50946,7 @@ async function runMcpReport(parsed, ctx) {
49682
50946
  const issue3 = buildMakerMcpIssue({
49683
50947
  context,
49684
50948
  diagnostics,
49685
- homeDir: os6.homedir()
50949
+ homeDir: os8.homedir()
49686
50950
  });
49687
50951
  const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
49688
50952
  status: "consent_required",
@@ -49709,7 +50973,7 @@ async function runMcpReport(parsed, ctx) {
49709
50973
  );
49710
50974
  }
49711
50975
  async function runAgentsUpdate(parsed, ctx) {
49712
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50976
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49713
50977
  const result = updateMakerAgentsPolicy(targetDir);
49714
50978
  if (ctx.json) {
49715
50979
  writeJson(result);
@@ -49728,21 +50992,25 @@ async function runAgentsUpdate(parsed, ctx) {
49728
50992
  async function runUpgrade(parsed, ctx) {
49729
50993
  rejectPackageOption(parsed);
49730
50994
  const explicitTargetDir = stringOption(parsed, "target_dir");
49731
- const targetDir = path22.resolve(explicitTargetDir || process.cwd());
50995
+ const targetDir = path26.resolve(explicitTargetDir || process.cwd());
49732
50996
  const env = makerEnvOption(parsed);
49733
50997
  const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
49734
- const prepared = await prepareMcpLauncher({ env, mode: mcpLauncherOption(parsed) });
49735
- if (!prepared.ok) {
49736
- writeMcpLauncherFailure(ctx, prepared);
49737
- return;
50998
+ const pluginDistribution = resolveMakerPluginDistribution();
50999
+ let installResults = [];
51000
+ if (!pluginDistribution) {
51001
+ const prepared = await prepareMcpLauncher({ env, mode: mcpLauncherOption(parsed) });
51002
+ if (!prepared.ok) {
51003
+ writeMcpLauncherFailure(ctx, prepared);
51004
+ return;
51005
+ }
51006
+ installResults = installMcpConfigs({
51007
+ ides: ides.length > 0 ? ides : getDefaultMcpInstallIdes(),
51008
+ env: makerMcpConfigEnvOption(parsed),
51009
+ mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
51010
+ launcher: prepared.launcher,
51011
+ launcherEnv: prepared.launcherEnv
51012
+ });
49738
51013
  }
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
51014
  const identify = identifyMakerProject({ cwd: targetDir });
49747
51015
  const agentsResult = identify.projectRoot ? updateMakerAgentsPolicy(identify.projectRoot) : void 0;
49748
51016
  const payload = {
@@ -49753,7 +51021,8 @@ async function runUpgrade(parsed, ctx) {
49753
51021
  agents_policy: agentsResult,
49754
51022
  restart_required: false,
49755
51023
  apply_mode: "next_mcp_start",
49756
- current_session: "preserved"
51024
+ current_session: "preserved",
51025
+ plugin_distribution: pluginDistribution == null ? void 0 : pluginDistribution.id
49757
51026
  };
49758
51027
  if (!payload.ok) {
49759
51028
  process.exitCode = 1;
@@ -49764,9 +51033,9 @@ async function runUpgrade(parsed, ctx) {
49764
51033
  }
49765
51034
  process.stdout.write(
49766
51035
  [
49767
- payload.ok ? "TapTap Maker upgrade completed" : "TapTap Maker upgrade completed with errors",
51036
+ pluginDistribution ? "TapTap Maker project policy update completed" : payload.ok ? "TapTap Maker upgrade completed" : "TapTap Maker upgrade completed with errors",
49768
51037
  "",
49769
- ...installResults.map((result) => result.message),
51038
+ ...pluginDistribution ? [`✓ Standalone MCP registration unchanged (${pluginDistribution.displayName} plugin)`] : installResults.map((result) => result.message),
49770
51039
  "",
49771
51040
  agentsResult ? [
49772
51041
  agentsResult.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
@@ -49774,8 +51043,8 @@ async function runUpgrade(parsed, ctx) {
49774
51043
  `- previous_status: ${agentsResult.previousStatus}`
49775
51044
  ].join("\n") : "AGENTS.md managed policy skipped: current directory is not bound to a Maker project.",
49776
51045
  "",
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.",
51046
+ pluginDistribution ? formatMakerPluginUpdateAction(pluginDistribution) : "Current MCP session remains unchanged and continues using the existing version.",
51047
+ 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
51048
  ""
49780
51049
  ].join("\n")
49781
51050
  );
@@ -49812,19 +51081,20 @@ function getMcpVerifyNextSteps(mode, commandText) {
49812
51081
  ];
49813
51082
  }
49814
51083
  async function runDevKitUpdate(parsed, ctx) {
49815
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
51084
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49816
51085
  const result = await installAiDevKit({
49817
51086
  targetDir,
49818
51087
  preserveExisting: false,
49819
51088
  replaceManagedEntries: true,
49820
51089
  environment: makerEnvOption(parsed)
49821
51090
  });
51091
+ syncWorkBuddyDevKitSkills(targetDir, ctx);
49822
51092
  finalizeStagedDevKitGitignore(targetDir);
49823
51093
  emit(ctx, "dev_kit", formatDevKitInstallMessage("AI dev kit updated", result), result);
49824
51094
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
49825
51095
  }
49826
51096
  async function runLogsWatch(parsed, ctx) {
49827
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
51097
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49828
51098
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
49829
51099
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
49830
51100
  const maxPolls = numberOption(parsed, "max_polls");
@@ -49834,9 +51104,9 @@ async function runLogsWatch(parsed, ctx) {
49834
51104
  serverUrl: stringOption(parsed, "server_url"),
49835
51105
  env: makerEnvOption(parsed)
49836
51106
  });
49837
- const runtimeDir = path22.join(proxy.projectRoot, ".maker", "logs", "runtime");
49838
- const runtimeLog = path22.join(runtimeDir, "runtime.log");
49839
- const pidFile = path22.join(runtimeDir, "watcher.pid");
51107
+ const runtimeDir = path26.join(proxy.projectRoot, ".maker", "logs", "runtime");
51108
+ const runtimeLog = path26.join(runtimeDir, "runtime.log");
51109
+ const pidFile = path26.join(runtimeDir, "watcher.pid");
49840
51110
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
49841
51111
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
49842
51112
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -49881,10 +51151,10 @@ async function runLogsWatch(parsed, ctx) {
49881
51151
  }
49882
51152
  }
49883
51153
  function registerRuntimeLogWatcherProcess(pidFile) {
49884
- fs21.mkdirSync(path22.dirname(pidFile), { recursive: true });
51154
+ fs25.mkdirSync(path26.dirname(pidFile), { recursive: true });
49885
51155
  const existingPid = readPidFile(pidFile);
49886
51156
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
49887
- fs21.writeFileSync(
51157
+ fs25.writeFileSync(
49888
51158
  pidFile,
49889
51159
  `${JSON.stringify(
49890
51160
  {
@@ -49902,10 +51172,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
49902
51172
  return previous;
49903
51173
  }
49904
51174
  function readPidFile(pidFile) {
49905
- if (!fs21.existsSync(pidFile)) {
51175
+ if (!fs25.existsSync(pidFile)) {
49906
51176
  return void 0;
49907
51177
  }
49908
- const raw = fs21.readFileSync(pidFile, "utf8").trim();
51178
+ const raw = fs25.readFileSync(pidFile, "utf8").trim();
49909
51179
  let pid = Number(raw);
49910
51180
  if (!Number.isInteger(pid) || pid <= 0) {
49911
51181
  try {
@@ -49925,7 +51195,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
49925
51195
  }
49926
51196
  cleaned = true;
49927
51197
  if (readPidFile(pidFile) === process.pid) {
49928
- fs21.rmSync(pidFile, { force: true });
51198
+ fs25.rmSync(pidFile, { force: true });
49929
51199
  }
49930
51200
  };
49931
51201
  process.once("exit", cleanup);
@@ -50076,9 +51346,10 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
50076
51346
  onStart: (event) => emitSkillInstallerStart(ctx, event)
50077
51347
  });
50078
51348
  writeDevKitStagedGitignore(
50079
- path22.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
51349
+ path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
50080
51350
  listPresentDevKitManagedEntries(targetDir)
50081
51351
  );
51352
+ syncWorkBuddyDevKitSkills(targetDir, ctx);
50082
51353
  if (options.finalizeGitignore) {
50083
51354
  finalizeStagedDevKitGitignore(targetDir);
50084
51355
  }
@@ -50093,7 +51364,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
50093
51364
  );
50094
51365
  } catch (error2) {
50095
51366
  writeDevKitStagedGitignore(
50096
- path22.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
51367
+ path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
50097
51368
  listPresentDevKitManagedEntries(targetDir)
50098
51369
  );
50099
51370
  if (options.finalizeGitignore) {
@@ -50114,6 +51385,7 @@ ${detail}`, {
50114
51385
  environment: options.environment,
50115
51386
  onSkillInstallerStart: (event) => emitSkillInstallerStart(ctx, event)
50116
51387
  });
51388
+ syncWorkBuddyDevKitSkills(targetDir, ctx);
50117
51389
  if (options.finalizeGitignore) {
50118
51390
  finalizeStagedDevKitGitignore(targetDir);
50119
51391
  }
@@ -50131,6 +51403,38 @@ ${detail}`, {
50131
51403
  });
50132
51404
  }
50133
51405
  }
51406
+ function syncWorkBuddyDevKitSkills(targetDir, ctx) {
51407
+ var _a3;
51408
+ if (((_a3 = resolveMakerPluginDistribution()) == null ? void 0 : _a3.client) !== "workbuddy") {
51409
+ return;
51410
+ }
51411
+ try {
51412
+ const result = syncWorkBuddyProjectSkills(targetDir);
51413
+ const managedSkillPaths = [...result.installedSkills, ...result.skippedSkills].map(
51414
+ (skillName) => path26.join(".workbuddy", "skills", skillName)
51415
+ );
51416
+ if (managedSkillPaths.length > 0) {
51417
+ writeDevKitStagedGitignore(path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
51418
+ ...listPresentDevKitManagedEntries(targetDir),
51419
+ ...managedSkillPaths
51420
+ ]);
51421
+ }
51422
+ if (result.installedSkills.length > 0) {
51423
+ emit(
51424
+ ctx,
51425
+ "dev_kit",
51426
+ `WorkBuddy project skills installed: ${result.installedSkills.length}`,
51427
+ result
51428
+ );
51429
+ }
51430
+ } catch (error2) {
51431
+ const detail = error2 instanceof Error ? error2.message : String(error2);
51432
+ emit(ctx, "dev_kit_warning", `WorkBuddy project skills install failed
51433
+ ${detail}`, {
51434
+ error: detail
51435
+ });
51436
+ }
51437
+ }
50134
51438
  function formatDevKitInstallMessage(message, result) {
50135
51439
  if (!result.skillInstaller) {
50136
51440
  return message;
@@ -50187,12 +51491,12 @@ function installMcpConfig(ide, options) {
50187
51491
  }
50188
51492
  function installMcpConfigUnsafe(ide, options) {
50189
51493
  if (ide === "codex") {
50190
- const configPath = path22.join(os6.homedir(), ".codex", "config.toml");
51494
+ const configPath = path26.join(os8.homedir(), ".codex", "config.toml");
50191
51495
  const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
50192
51496
  return [createMcpInstallResult(ide, "Codex", configPath, write)];
50193
51497
  }
50194
51498
  if (ide === "cursor") {
50195
- const configPath = path22.join(os6.homedir(), ".cursor", "mcp.json");
51499
+ const configPath = path26.join(os8.homedir(), ".cursor", "mcp.json");
50196
51500
  const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
50197
51501
  return [createMcpInstallResult(ide, "Cursor", configPath, write)];
50198
51502
  }
@@ -50209,7 +51513,7 @@ function installMcpConfigUnsafe(ide, options) {
50209
51513
  }
50210
51514
  ];
50211
51515
  }
50212
- const configPath = path22.join(os6.homedir(), ".claude.json");
51516
+ const configPath = path26.join(os8.homedir(), ".claude.json");
50213
51517
  const write = mergeJsonMcpConfig(configPath, claudeOptions);
50214
51518
  return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
50215
51519
  }
@@ -50223,7 +51527,7 @@ function installMcpConfigUnsafe(ide, options) {
50223
51527
  }
50224
51528
  if (ide === "opencode") {
50225
51529
  const configPath = getOpenCodeMcpConfigPath();
50226
- if (!fs21.existsSync(configPath)) {
51530
+ if (!fs25.existsSync(configPath)) {
50227
51531
  return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
50228
51532
  }
50229
51533
  const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
@@ -50306,13 +51610,13 @@ function getDefaultMcpInstallIdes() {
50306
51610
  if (getTraeMcpInstallPaths().length > 0) {
50307
51611
  ides.push("trae");
50308
51612
  }
50309
- if (fs21.existsSync(getOpenCodeMcpConfigPath())) {
51613
+ if (fs25.existsSync(getOpenCodeMcpConfigPath())) {
50310
51614
  ides.push("opencode");
50311
51615
  }
50312
51616
  if (getWorkBuddyMcpInstallPaths().length > 0) {
50313
51617
  ides.push("workbuddy");
50314
51618
  }
50315
- if (fs21.existsSync(getDshHome())) {
51619
+ if (fs25.existsSync(getDshHome())) {
50316
51620
  ides.push("dsh");
50317
51621
  }
50318
51622
  return ides;
@@ -50326,7 +51630,7 @@ function getExistingTraeUserConfigPaths(paths) {
50326
51630
  const seen = /* @__PURE__ */ new Set();
50327
51631
  return paths.filter((configPath) => {
50328
51632
  const key = normalizeConfigPathKey(configPath);
50329
- if (seen.has(key) || !fs21.existsSync(path22.dirname(configPath))) {
51633
+ if (seen.has(key) || !fs25.existsSync(path26.dirname(configPath))) {
50330
51634
  return false;
50331
51635
  }
50332
51636
  seen.add(key);
@@ -50337,7 +51641,7 @@ function getExistingConfigPaths(paths) {
50337
51641
  const seen = /* @__PURE__ */ new Set();
50338
51642
  return paths.filter((configPath) => {
50339
51643
  const key = normalizeConfigPathKey(configPath);
50340
- if (seen.has(key) || !fs21.existsSync(configPath)) {
51644
+ if (seen.has(key) || !fs25.existsSync(configPath)) {
50341
51645
  return false;
50342
51646
  }
50343
51647
  seen.add(key);
@@ -50345,62 +51649,62 @@ function getExistingConfigPaths(paths) {
50345
51649
  });
50346
51650
  }
50347
51651
  function normalizeConfigPathKey(configPath) {
50348
- const resolved = path22.resolve(configPath);
51652
+ const resolved = path26.resolve(configPath);
50349
51653
  return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
50350
51654
  }
50351
51655
  function getTraeSoloMcpConfigPaths() {
50352
51656
  if (process.platform === "win32") {
50353
- const roaming = process.env.APPDATA || path22.join(os6.homedir(), "AppData", "Roaming");
51657
+ const roaming = process.env.APPDATA || path26.join(os8.homedir(), "AppData", "Roaming");
50354
51658
  return [
50355
- path22.join(roaming, "TRAE SOLO", "User", "mcp.json"),
50356
- path22.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
51659
+ path26.join(roaming, "TRAE SOLO", "User", "mcp.json"),
51660
+ path26.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
50357
51661
  ];
50358
51662
  }
50359
- const appSupport = path22.join(os6.homedir(), "Library", "Application Support");
51663
+ const appSupport = path26.join(os8.homedir(), "Library", "Application Support");
50360
51664
  return [
50361
- path22.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
50362
- path22.join(appSupport, "TRAE SOLO", "User", "mcp.json")
51665
+ path26.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
51666
+ path26.join(appSupport, "TRAE SOLO", "User", "mcp.json")
50363
51667
  ];
50364
51668
  }
50365
51669
  function getTraeUnverifiedMcpConfigPaths() {
50366
51670
  if (process.platform === "win32") {
50367
- const roaming = process.env.APPDATA || path22.join(os6.homedir(), "AppData", "Roaming");
51671
+ const roaming = process.env.APPDATA || path26.join(os8.homedir(), "AppData", "Roaming");
50368
51672
  return [
50369
- path22.join(roaming, "Trae", "User", "mcp.json"),
50370
- path22.join(roaming, "TRAE", "User", "mcp.json"),
50371
- path22.join(roaming, "Trae CN", "User", "mcp.json")
51673
+ path26.join(roaming, "Trae", "User", "mcp.json"),
51674
+ path26.join(roaming, "TRAE", "User", "mcp.json"),
51675
+ path26.join(roaming, "Trae CN", "User", "mcp.json")
50372
51676
  ];
50373
51677
  }
50374
- const appSupport = path22.join(os6.homedir(), "Library", "Application Support");
51678
+ const appSupport = path26.join(os8.homedir(), "Library", "Application Support");
50375
51679
  return [
50376
- path22.join(appSupport, "Trae", "User", "mcp.json"),
50377
- path22.join(appSupport, "TRAE", "User", "mcp.json"),
50378
- path22.join(appSupport, "Trae CN", "User", "mcp.json")
51680
+ path26.join(appSupport, "Trae", "User", "mcp.json"),
51681
+ path26.join(appSupport, "TRAE", "User", "mcp.json"),
51682
+ path26.join(appSupport, "Trae CN", "User", "mcp.json")
50379
51683
  ];
50380
51684
  }
50381
51685
  function getOpenCodeMcpConfigPath() {
50382
- return path22.join(os6.homedir(), ".config", "opencode", "opencode.jsonc");
51686
+ return path26.join(os8.homedir(), ".config", "opencode", "opencode.jsonc");
50383
51687
  }
50384
51688
  function getWorkBuddyHome() {
50385
- return path22.join(os6.homedir(), ".workbuddy");
51689
+ return path26.join(os8.homedir(), ".workbuddy");
50386
51690
  }
50387
51691
  function getWorkBuddyMcpInstallPaths(options = {}) {
50388
- const primary = path22.join(getWorkBuddyHome(), "mcp.json");
50389
- if (fs21.existsSync(primary) || options.createPrimary) {
51692
+ const primary = path26.join(getWorkBuddyHome(), "mcp.json");
51693
+ if (fs25.existsSync(primary) || options.createPrimary) {
50390
51694
  return [primary];
50391
51695
  }
50392
- const legacy = path22.join(getWorkBuddyHome(), ".mcp.json");
50393
- if (fs21.existsSync(legacy)) {
51696
+ const legacy = path26.join(getWorkBuddyHome(), ".mcp.json");
51697
+ if (fs25.existsSync(legacy)) {
50394
51698
  return [legacy];
50395
51699
  }
50396
51700
  return [];
50397
51701
  }
50398
51702
  function inspectWorkBuddyTrustState(mcpName) {
50399
51703
  const workbuddyHome = getWorkBuddyHome();
50400
- const connectorsDir = path22.join(workbuddyHome, "connectors");
51704
+ const connectorsDir = path26.join(workbuddyHome, "connectors");
50401
51705
  const accounts = [];
50402
51706
  const stateFiles = [];
50403
- if (!fs21.existsSync(connectorsDir)) {
51707
+ if (!fs25.existsSync(connectorsDir)) {
50404
51708
  return {
50405
51709
  status: "not_found",
50406
51710
  mcp_name: mcpName,
@@ -50410,12 +51714,12 @@ function inspectWorkBuddyTrustState(mcpName) {
50410
51714
  accounts
50411
51715
  };
50412
51716
  }
50413
- for (const entry of fs21.readdirSync(connectorsDir, { withFileTypes: true })) {
51717
+ for (const entry of fs25.readdirSync(connectorsDir, { withFileTypes: true })) {
50414
51718
  if (!entry.isDirectory()) {
50415
51719
  continue;
50416
51720
  }
50417
- const statePath = path22.join(connectorsDir, entry.name, "connector-states.json");
50418
- if (!fs21.existsSync(statePath)) {
51721
+ const statePath = path26.join(connectorsDir, entry.name, "connector-states.json");
51722
+ if (!fs25.existsSync(statePath)) {
50419
51723
  continue;
50420
51724
  }
50421
51725
  stateFiles.push(statePath);
@@ -50494,7 +51798,7 @@ function mergeJsonMcpConfig(configPath, options) {
50494
51798
  );
50495
51799
  }
50496
51800
  function mergeOpenCodeMcpConfig(configPath, options) {
50497
- const rawContent = fs21.readFileSync(configPath, "utf8");
51801
+ const rawContent = fs25.readFileSync(configPath, "utf8");
50498
51802
  const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
50499
51803
  const existing = readJsonObject(configPath, { jsonc: true });
50500
51804
  const mcp = asObject(existing.mcp);
@@ -50526,20 +51830,21 @@ function mergeOpenCodeMcpConfig(configPath, options) {
50526
51830
  return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
50527
51831
  }
50528
51832
  function mergeCodexMcpConfig(configPath, options) {
50529
- const existing = fs21.existsSync(configPath) ? fs21.readFileSync(configPath, "utf8") : "";
50530
- const sectionPattern = createCodexMcpSectionPattern(options.mcpName);
50531
- const withoutOld = existing.replace(sectionPattern, "").trimEnd();
51833
+ const existing = fs25.existsSync(configPath) ? fs25.readFileSync(configPath, "utf8") : "";
51834
+ const withoutOld = removeCodexMcpTables(existing, options.mcpName).trimEnd();
50532
51835
  const launch = options.launcher;
50533
51836
  const envValues = createMcpEnvironmentValues(options.env, options.clientIde, options.launcherEnv);
50534
51837
  const envSection = Object.keys(envValues).length === 0 ? [] : [
50535
51838
  "",
50536
51839
  `[mcp_servers."${options.mcpName}".env]`,
50537
- ...Object.entries(envValues).map(([key, value]) => `${key} = "${escapeToml(value)}"`)
51840
+ ...Object.entries(envValues).map(
51841
+ ([key, value]) => `${key} = "${escapeTomlString(value)}"`
51842
+ )
50538
51843
  ];
50539
51844
  const section = [
50540
51845
  `[mcp_servers."${options.mcpName}"]`,
50541
- `command = "${escapeToml(launch.command)}"`,
50542
- `args = [${launch.args.map((arg) => `"${escapeToml(arg)}"`).join(", ")}]`,
51846
+ `command = "${escapeTomlString(launch.command)}"`,
51847
+ `args = [${launch.args.map((arg) => `"${escapeTomlString(arg)}"`).join(", ")}]`,
50543
51848
  ...envSection,
50544
51849
  ""
50545
51850
  ].join("\n");
@@ -50558,48 +51863,8 @@ function mergeCodexMcpConfig(configPath, options) {
50558
51863
  }
50559
51864
  );
50560
51865
  }
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
51866
  function tryClaudeMcpAdd(options) {
50602
- const configPath = path22.join(os6.homedir(), ".claude.json");
51867
+ const configPath = path26.join(os8.homedir(), ".claude.json");
50603
51868
  try {
50604
51869
  const existing = readJsonObject(configPath);
50605
51870
  const server = asObject(asObject(existing.mcpServers)[options.mcpName]);
@@ -50692,10 +51957,10 @@ function rejectPackageOption(parsed) {
50692
51957
  }
50693
51958
  }
50694
51959
  function readJsonObject(filePath, options = {}) {
50695
- if (!fs21.existsSync(filePath)) {
51960
+ if (!fs25.existsSync(filePath)) {
50696
51961
  return {};
50697
51962
  }
50698
- const raw = fs21.readFileSync(filePath, "utf8");
51963
+ const raw = fs25.readFileSync(filePath, "utf8");
50699
51964
  try {
50700
51965
  const normalized = normalizeJsonConfigContent(raw, options);
50701
51966
  const parsed = JSON.parse(normalized);
@@ -50714,30 +51979,6 @@ function asObject(value) {
50714
51979
  }
50715
51980
  return {};
50716
51981
  }
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
51982
  function validateJsonMcpServersConfig(content, options) {
50742
51983
  const parsed = parseGeneratedJsonObject(content);
50743
51984
  const server = asObject(asObject(parsed.mcpServers)[options.mcpName]);
@@ -50891,10 +52132,10 @@ function formatMcpInstallMessage(label, configPath, write) {
50891
52132
  ].filter(Boolean).join("\n");
50892
52133
  }
50893
52134
  function saveInitState(targetDir, state) {
50894
- fs21.mkdirSync(getMakerHome(), { recursive: true });
50895
- const key = crypto3.createHash("sha256").update(path22.resolve(targetDir)).digest("hex").slice(0, 16);
50896
- fs21.writeFileSync(
50897
- path22.join(getMakerHome(), `init-state-${key}.json`),
52135
+ fs25.mkdirSync(getMakerHome(), { recursive: true });
52136
+ const key = crypto5.createHash("sha256").update(path26.resolve(targetDir)).digest("hex").slice(0, 16);
52137
+ fs25.writeFileSync(
52138
+ path26.join(getMakerHome(), `init-state-${key}.json`),
50898
52139
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
50899
52140
  `,
50900
52141
  "utf8"
@@ -51042,7 +52283,7 @@ function makerEnvOption(parsed) {
51042
52283
  return env;
51043
52284
  }
51044
52285
  const targetDir = stringOption(parsed, "target_dir");
51045
- return getMakerEnvironment(void 0, targetDir ? path22.resolve(targetDir) : process.cwd());
52286
+ return getMakerEnvironment(void 0, targetDir ? path26.resolve(targetDir) : process.cwd());
51046
52287
  }
51047
52288
  function makerMcpConfigEnvOption(parsed) {
51048
52289
  return stringOption(parsed, "env") === "rnd" ? "rnd" : "production";
@@ -51073,15 +52314,6 @@ function mask(value) {
51073
52314
  }
51074
52315
  return `${value.slice(0, 6)}...${value.slice(-4)}`;
51075
52316
  }
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
52317
  function indent3(value) {
51086
52318
  return value.split("\n").map((line) => ` ${line}`).join("\n");
51087
52319
  }
@@ -51123,6 +52355,9 @@ function printHelp() {
51123
52355
  " [--context-stdin] [--consent] [--json]",
51124
52356
  " # Run only after the user agrees to submit",
51125
52357
  " taptap-maker agents update [--target-dir DIR] [--json]",
52358
+ " taptap-maker plugin inspect --client codex|workbuddy|dsh [--json]",
52359
+ " taptap-maker plugin migrate --client codex|workbuddy|dsh --confirm [--json]",
52360
+ " taptap-maker plugin restore --client codex|workbuddy|dsh --confirm [--json]",
51126
52361
  " taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
51127
52362
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
51128
52363
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
@@ -51192,13 +52427,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
51192
52427
  }
51193
52428
 
51194
52429
  // node_modules/pkce-challenge/dist/index.node.js
51195
- var crypto4;
52430
+ var crypto6;
51196
52431
  var _a2;
51197
- crypto4 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
52432
+ crypto6 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
51198
52433
  globalThis.crypto ?? // Node.js >18
51199
52434
  import("node:crypto").then((m) => m.webcrypto);
51200
52435
  async function getRandomValues(size) {
51201
- return (await crypto4).getRandomValues(new Uint8Array(size));
52436
+ return (await crypto6).getRandomValues(new Uint8Array(size));
51202
52437
  }
51203
52438
  async function random(size) {
51204
52439
  const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
@@ -51214,7 +52449,7 @@ async function generateVerifier(length) {
51214
52449
  return await random(length);
51215
52450
  }
51216
52451
  async function generateChallenge(code_verifier) {
51217
- const buffer = await (await crypto4).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
52452
+ const buffer = await (await crypto6).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
51218
52453
  return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
51219
52454
  }
51220
52455
  async function pkceChallenge(length) {
@@ -52569,8 +53804,8 @@ var StreamableHTTPClientTransport = class {
52569
53804
  };
52570
53805
 
52571
53806
  // src/mcp-proxy/proxy.ts
52572
- import * as path24 from "node:path";
52573
- import * as crypto6 from "node:crypto";
53807
+ import * as path28 from "node:path";
53808
+ import * as crypto8 from "node:crypto";
52574
53809
 
52575
53810
  // src/mcp-proxy/cookieJar.ts
52576
53811
  var CookieJar = class {
@@ -52751,9 +53986,9 @@ function createCookieFetch(cookieJar) {
52751
53986
  }
52752
53987
 
52753
53988
  // src/core/utils/logWriter.ts
52754
- import * as fs22 from "node:fs";
52755
- import * as path23 from "node:path";
52756
- import * as crypto5 from "node:crypto";
53989
+ import * as fs26 from "node:fs";
53990
+ import * as path27 from "node:path";
53991
+ import * as crypto7 from "node:crypto";
52757
53992
 
52758
53993
  // src/core/types/log.ts
52759
53994
  var LOG_LEVEL_PRIORITY = {
@@ -52793,7 +54028,7 @@ var LogWriter = class {
52793
54028
  return;
52794
54029
  }
52795
54030
  try {
52796
- await fs22.promises.mkdir(this.config.logDir, { recursive: true });
54031
+ await fs26.promises.mkdir(this.config.logDir, { recursive: true });
52797
54032
  await this.cleanupOldLogs();
52798
54033
  this.initialized = true;
52799
54034
  } catch (error2) {
@@ -52816,7 +54051,7 @@ var LogWriter = class {
52816
54051
  */
52817
54052
  getLogFilePath(date5) {
52818
54053
  const d = date5 || this.getCurrentDate();
52819
- return path23.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
54054
+ return path27.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
52820
54055
  }
52821
54056
  /**
52822
54057
  * 获取或创建写入流
@@ -52831,7 +54066,7 @@ var LogWriter = class {
52831
54066
  }
52832
54067
  this.currentDate = date5;
52833
54068
  try {
52834
- this.writeStream = fs22.createWriteStream(this.getLogFilePath(date5), {
54069
+ this.writeStream = fs26.createWriteStream(this.getLogFilePath(date5), {
52835
54070
  flags: "a",
52836
54071
  encoding: "utf8"
52837
54072
  });
@@ -52883,11 +54118,11 @@ var LogWriter = class {
52883
54118
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
52884
54119
  try {
52885
54120
  const filePath = this.getLogFilePath();
52886
- const dir = path23.dirname(filePath);
52887
- if (!fs22.existsSync(dir)) {
52888
- fs22.mkdirSync(dir, { recursive: true });
54121
+ const dir = path27.dirname(filePath);
54122
+ if (!fs26.existsSync(dir)) {
54123
+ fs26.mkdirSync(dir, { recursive: true });
52889
54124
  }
52890
- fs22.appendFileSync(filePath, message, "utf8");
54125
+ fs26.appendFileSync(filePath, message, "utf8");
52891
54126
  } catch {
52892
54127
  }
52893
54128
  }
@@ -52898,7 +54133,7 @@ var LogWriter = class {
52898
54133
  async cleanupOldLogs() {
52899
54134
  if (this.config.maxDays <= 0) return;
52900
54135
  try {
52901
- const files = await fs22.promises.readdir(this.config.logDir);
54136
+ const files = await fs26.promises.readdir(this.config.logDir);
52902
54137
  const cutoffDate = /* @__PURE__ */ new Date();
52903
54138
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
52904
54139
  const prefix = this.config.prefix;
@@ -52913,7 +54148,7 @@ var LogWriter = class {
52913
54148
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
52914
54149
  const fileDate = new Date(year, month - 1, day);
52915
54150
  if (fileDate < cutoffDate) {
52916
- await fs22.promises.unlink(path23.join(this.config.logDir, file2));
54151
+ await fs26.promises.unlink(path27.join(this.config.logDir, file2));
52917
54152
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
52918
54153
  `);
52919
54154
  }
@@ -52957,7 +54192,7 @@ function convertMcpApplicationErrorToToolResult(error2) {
52957
54192
  return void 0;
52958
54193
  }
52959
54194
  const data = error2.data;
52960
- if (!isRecord5(data) || !("remote_result" in data) || data.remote_result === void 0) {
54195
+ if (!isRecord7(data) || !("remote_result" in data) || data.remote_result === void 0) {
52961
54196
  return void 0;
52962
54197
  }
52963
54198
  return {
@@ -52974,7 +54209,7 @@ function convertMcpApplicationErrorToToolResult(error2) {
52974
54209
  ]
52975
54210
  };
52976
54211
  }
52977
- function isRecord5(value) {
54212
+ function isRecord7(value) {
52978
54213
  return typeof value === "object" && value !== null && !Array.isArray(value);
52979
54214
  }
52980
54215
  function formatProxyDiagnosticValue(value) {
@@ -53034,10 +54269,10 @@ var TapTapMCPProxy = class {
53034
54269
  const { user_id, project_id } = this.config.tenant;
53035
54270
  let logDir;
53036
54271
  if (user_id && project_id) {
53037
- logDir = path24.join(logRoot, "proxy", user_id, project_id);
54272
+ logDir = path28.join(logRoot, "proxy", user_id, project_id);
53038
54273
  } else {
53039
- const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
53040
- logDir = path24.join(logRoot, "proxy", kidHash);
54274
+ const kidHash = crypto8.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
54275
+ logDir = path28.join(logRoot, "proxy", kidHash);
53041
54276
  }
53042
54277
  return new LogWriter({
53043
54278
  logDir,
@@ -53759,6 +54994,9 @@ function printHelp2() {
53759
54994
  " [--context-stdin] [--consent] [--json]",
53760
54995
  " # Run only after the user agrees to submit",
53761
54996
  " taptap-maker agents update [--target-dir DIR] [--json]",
54997
+ " taptap-maker plugin inspect --client codex|workbuddy [--json]",
54998
+ " taptap-maker plugin migrate --client codex|workbuddy --confirm [--json]",
54999
+ " taptap-maker plugin restore --client codex|workbuddy --confirm [--json]",
53762
55000
  " taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
53763
55001
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
53764
55002
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",