@taptap/maker 0.0.30 → 0.0.31-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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.1
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.1 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,32 @@ 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 resolveMakerPluginDistribution(distribution = process.env.TAPTAP_MAKER_DISTRIBUTION) {
39690
+ if (distribution === "codex_plugin") {
39691
+ return { id: distribution, client: "codex", displayName: "Codex" };
39692
+ }
39693
+ if (distribution === "workbuddy_plugin") {
39694
+ return { id: distribution, client: "workbuddy", displayName: "WorkBuddy" };
39695
+ }
39696
+ if (distribution === "dsh_plugin") {
39697
+ return { id: distribution, client: "dsh", displayName: "DSH" };
39698
+ }
39699
+ return void 0;
39700
+ }
39701
+ function formatMakerPluginUpdateAction(distribution) {
39702
+ if (distribution.client === "dsh") {
39703
+ return "Update the installed DSH plugin via `dsh plugin --profile <profile> update @taptap/dsh-maker`; do not install or upgrade the standalone npm package.";
39704
+ }
39705
+ return `Update the installed ${distribution.displayName} plugin through its marketplace; do not install or upgrade the standalone npm package.`;
39706
+ }
39707
+
39708
+ // src/maker/cli/skill.ts
39686
39709
  var MAKER_LOCAL_SKILL_NAME = "taptap-maker-local";
39687
39710
  var MAKER_DEV_KIT_GUIDE_SKILL_NAME = "taptap-maker-dev-kit-guide";
39688
39711
  var UPDATE_TAPTAP_MCP_SKILL_NAME = "update-taptap-mcp";
39712
+ var MAKER_PLUGIN_LIFECYCLE_SKILL_NAME = "taptap-maker-plugin-lifecycle";
39689
39713
  var BUNDLED_SKILLS = [
39690
39714
  {
39691
39715
  name: MAKER_LOCAL_SKILL_NAME
@@ -39698,7 +39722,10 @@ var BUNDLED_SKILLS = [
39698
39722
  }
39699
39723
  ];
39700
39724
  function formatMakerSkillStatus(_options = {}) {
39701
- const skillDocuments = BUNDLED_SKILLS.map((skill) => ({
39725
+ const pluginDistribution = resolveMakerPluginDistribution();
39726
+ const clientPluginDistribution = pluginDistribution && pluginDistribution.client !== "dsh" ? pluginDistribution : void 0;
39727
+ const bundledSkills = clientPluginDistribution ? [...BUNDLED_SKILLS, { name: MAKER_PLUGIN_LIFECYCLE_SKILL_NAME }] : BUNDLED_SKILLS;
39728
+ const skillDocuments = bundledSkills.map((skill) => ({
39702
39729
  name: skill.name,
39703
39730
  path: path11.join(resolveMakerSkillSourceDir(skill.name), "SKILL.md")
39704
39731
  }));
@@ -39708,6 +39735,27 @@ function formatMakerSkillStatus(_options = {}) {
39708
39735
  ...skillDocuments.map((skill) => `- ${skill.name}: ${skill.path}`),
39709
39736
  "",
39710
39737
  "Use these documents as reading references for Maker local workflows.",
39738
+ ...clientPluginDistribution ? [
39739
+ "",
39740
+ `Maker ${clientPluginDistribution.displayName} plugin lifecycle`,
39741
+ `- entry: ${MAKER_PLUGIN_LIFECYCLE_SKILL_NAME}`,
39742
+ `- Inspect a legacy ${clientPluginDistribution.displayName} Maker MCP registration before first use.`,
39743
+ ...clientPluginDistribution.client === "codex" ? [
39744
+ "- Automatically disable an active legacy Codex Maker MCP; the plugin installation request is the authorization.",
39745
+ "- Verify the legacy registration is disabled or absent before reporting the plugin ready.",
39746
+ "- Require explicit confirmation only when restoring the old MCP during plugin removal."
39747
+ ] : ["- Require explicit confirmation before disabling or restoring it."],
39748
+ "- Initialize with `taptap-maker init --skip-mcp-install`; the plugin already provides MCP.",
39749
+ `- ${formatMakerPluginUpdateAction(clientPluginDistribution)}`
39750
+ ] : [],
39751
+ ...(pluginDistribution == null ? void 0 : pluginDistribution.client) === "dsh" ? [
39752
+ "",
39753
+ "Maker DSH plugin lifecycle",
39754
+ "- Inspect a legacy DSH L1 MCP registration with `taptap-maker plugin inspect --client dsh` before first use.",
39755
+ "- Migrate/disable it with `taptap-maker plugin migrate --client dsh --confirm`; restore with `taptap-maker plugin restore --client dsh --confirm`.",
39756
+ "- Initialize with `taptap-maker init --skip-mcp-install`; the DSH plugin already provides MCP.",
39757
+ `- ${formatMakerPluginUpdateAction(pluginDistribution)}`
39758
+ ] : [],
39711
39759
  "",
39712
39760
  "Maker Git workflow policy",
39713
39761
  `- entry: ${MAKER_LOCAL_SKILL_NAME} > Maker Git Workflow Policy`,
@@ -39753,7 +39801,7 @@ function formatMakerSkillStatus(_options = {}) {
39753
39801
  " mcp report --ide <client> --target-dir <project> --context-stdin --consent --json",
39754
39802
  "- Never use an unversioned npm package; preserve the configured version and Windows absolute launcher.",
39755
39803
  "- A manual_required result never blocks troubleshooting or the original Maker task.",
39756
- "Maker initialization next_step: execute `taptap-maker init`.",
39804
+ 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
39805
  "Load these documents when the current AI client supports reading local guide files."
39758
39806
  ].join("\n");
39759
39807
  }
@@ -44352,7 +44400,7 @@ function applyDefaults(config2) {
44352
44400
  var MAKER_MCP_TRACKING_ACTION = "tapmaker_mcp_call";
44353
44401
  var MAKER_MCP_TRACKING_SOURCE = "local_mcp";
44354
44402
  var MAKER_MCP_TRACKING_TIMEOUT_MS = 1500;
44355
- var MAKER_MCP_VERSION = "0.0.30".trim() ? "0.0.30".trim() : "dev";
44403
+ var MAKER_MCP_VERSION = "0.0.31-beta.1".trim() ? "0.0.31-beta.1".trim() : "dev";
44356
44404
  var TRACKING_ERROR_MAX_LENGTH = 500;
44357
44405
  function buildMakerMcpTrackingPayload(event) {
44358
44406
  var _a3, _b, _c;
@@ -44665,7 +44713,7 @@ function createMakerRemoteProxyManager(options = {}) {
44665
44713
  }
44666
44714
 
44667
44715
  // src/maker/server/mcp.ts
44668
- var VERSION = true ? "0.0.30" : "dev";
44716
+ var VERSION = true ? "0.0.31-beta.1" : "dev";
44669
44717
  var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
44670
44718
  var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
44671
44719
  var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
@@ -45352,6 +45400,8 @@ function installMakerServerExitHandlers(remoteProxyManager) {
45352
45400
  async function formatStatus(options = {}) {
45353
45401
  var _a3;
45354
45402
  const detail = options.detail === true;
45403
+ const distribution = process.env.TAPTAP_MAKER_DISTRIBUTION;
45404
+ const pluginDistribution = resolveMakerPluginDistribution(distribution);
45355
45405
  const projectContext = await resolveMakerProjectContext({
45356
45406
  targetDir: options.targetDir,
45357
45407
  listClientRoots: options.listClientRoots,
@@ -45374,7 +45424,7 @@ async function formatStatus(options = {}) {
45374
45424
  allowRemoteFetch: false,
45375
45425
  ...detail ? {} : { backgroundRefresh: false }
45376
45426
  });
45377
- const packageUpdateText = detail ? formatMakerPackageUpdateStatus(packageUpdateStatus) : "";
45427
+ const packageUpdateText = detail ? formatMakerPackageUpdateStatusForDistribution(packageUpdateStatus, distribution) : "";
45378
45428
  const projectInitialization = identify.projectRoot ? inspectMakerProjectInitialization(identify.projectRoot) : void 0;
45379
45429
  const projectHealth = identify.projectRoot ? inspectMakerProjectHealth(identify.projectRoot, "status") : void 0;
45380
45430
  const projectInitializationText = projectInitialization ? formatMakerProjectInitializationStatus(projectInitialization) : "";
@@ -45410,8 +45460,9 @@ async function formatStatus(options = {}) {
45410
45460
  `- lua_lsp: ${luaLsp.status}`,
45411
45461
  "Maker MCP package update",
45412
45462
  `- status: ${packageUpdateStatus.status}`,
45463
+ pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
45413
45464
  packageUpdateStatus.target_version ? `- target_version: ${packageUpdateStatus.target_version}` : "",
45414
- packageUpdateStatus.next_action ? `- next_action: ${packageUpdateStatus.next_action}` : "",
45465
+ pluginDistribution ? `- next_action: ${formatMakerPluginUpdateAction(pluginDistribution)}` : packageUpdateStatus.next_action ? `- next_action: ${packageUpdateStatus.next_action}` : "",
45415
45466
  projectInitialization ? `- project_initialization: ${projectInitialization.status}` : "",
45416
45467
  projectHealth ? `- project_health: ${projectHealth.status}` : "",
45417
45468
  formatMakerClientRootsSummary(projectContext.roots),
@@ -45437,6 +45488,7 @@ async function formatStatus(options = {}) {
45437
45488
  "TapTap Maker MCP status",
45438
45489
  "",
45439
45490
  `- version: ${VERSION}`,
45491
+ pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
45440
45492
  `- env: ${env}`,
45441
45493
  `- project_context_source: ${projectContext.source}`,
45442
45494
  summaryText
@@ -45446,6 +45498,7 @@ async function formatStatus(options = {}) {
45446
45498
  "TapTap Maker MCP status",
45447
45499
  "",
45448
45500
  `- version: ${VERSION}`,
45501
+ pluginDistribution ? `- distribution: ${pluginDistribution.id}` : "",
45449
45502
  `- env: ${env}`,
45450
45503
  `- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
45451
45504
  `- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
@@ -45506,6 +45559,18 @@ async function formatStatus(options = {}) {
45506
45559
  projectSection
45507
45560
  ].filter(Boolean).join("\n");
45508
45561
  }
45562
+ function formatMakerPackageUpdateStatusForDistribution(status, distribution) {
45563
+ const formatted = formatMakerPackageUpdateStatus(status);
45564
+ const pluginDistribution = resolveMakerPluginDistribution(distribution);
45565
+ if (!pluginDistribution) {
45566
+ return formatted;
45567
+ }
45568
+ return [
45569
+ ...formatted.split("\n").filter((line) => !line.startsWith("- next_action:")),
45570
+ `- distribution: ${pluginDistribution.id}`,
45571
+ `- next_action: ${formatMakerPluginUpdateAction(pluginDistribution)}`
45572
+ ].join("\n");
45573
+ }
45509
45574
  function formatAuthNextStep(options) {
45510
45575
  if (!options.hasTapAuth) {
45511
45576
  if (options.hasPat) {
@@ -47454,10 +47519,10 @@ function indent2(value) {
47454
47519
 
47455
47520
  // src/maker/cli/commands.ts
47456
47521
  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";
47522
+ import crypto5 from "node:crypto";
47523
+ import fs25 from "node:fs";
47524
+ import os8 from "node:os";
47525
+ import path26 from "node:path";
47461
47526
  import readline from "node:readline/promises";
47462
47527
  import { stdin as input, stdout as output } from "node:process";
47463
47528
  import { pathToFileURL } from "node:url";
@@ -47882,6 +47947,7 @@ import { spawnSync as spawnSync7 } from "node:child_process";
47882
47947
  import fs20 from "node:fs";
47883
47948
  import os5 from "node:os";
47884
47949
  import path21 from "node:path";
47950
+ import { fileURLToPath as fileURLToPath4 } from "node:url";
47885
47951
 
47886
47952
  // src/maker/cli/dshMcpConfig.ts
47887
47953
  var import_yaml = __toESM(require_dist2());
@@ -48171,6 +48237,40 @@ function inspectMakerMcpClientConfig(options) {
48171
48237
  const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
48172
48238
  return { ide, status, entries };
48173
48239
  }
48240
+ function resolveMakerMcpReportRuntime(options) {
48241
+ const pluginDistribution = resolveMakerPluginDistribution(options.distribution);
48242
+ if (!pluginDistribution) {
48243
+ return void 0;
48244
+ }
48245
+ if (!options.bundleUrl) {
48246
+ throw new Error(
48247
+ `${pluginDistribution.displayName} plugin diagnostics require the active Maker bundle URL.`
48248
+ );
48249
+ }
48250
+ const bundlePath = path21.resolve(fileURLToPath4(options.bundleUrl));
48251
+ const pluginRoot = path21.dirname(path21.dirname(bundlePath));
48252
+ const execPath = options.execPath ?? process.execPath;
48253
+ return {
48254
+ distribution: pluginDistribution.id,
48255
+ client: pluginDistribution.client,
48256
+ config_source: {
48257
+ format: "json",
48258
+ paths: [path21.join(pluginRoot, ".mcp.json")],
48259
+ mcp_name: "taptap-maker-plugin"
48260
+ },
48261
+ launcher: {
48262
+ kind: "self_runtime",
48263
+ command: execPath,
48264
+ args: [bundlePath],
48265
+ commandAndArgs: [execPath, bundlePath]
48266
+ },
48267
+ cwd: pluginRoot,
48268
+ env: {
48269
+ TAPTAP_MAKER_DISTRIBUTION: pluginDistribution.id,
48270
+ TAPTAP_MCP_CLIENT_IDE: pluginDistribution.client
48271
+ }
48272
+ };
48273
+ }
48174
48274
  function buildMakerMcpIssue(options) {
48175
48275
  const context = sanitizePublicValue(options.context, options.homeDir);
48176
48276
  const diagnostics = sanitizePublicValue(
@@ -48203,7 +48303,7 @@ function buildMakerMcpIssue(options) {
48203
48303
  return { title, body };
48204
48304
  }
48205
48305
  async function collectMakerMcpIssueDiagnostics(options) {
48206
- var _a3;
48306
+ var _a3, _b;
48207
48307
  const platform = options.platform || process.platform;
48208
48308
  const homeDir = options.homeDir || os5.homedir();
48209
48309
  const processCwd = path21.resolve(options.processCwd || process.cwd());
@@ -48220,7 +48320,7 @@ async function collectMakerMcpIssueDiagnostics(options) {
48220
48320
  };
48221
48321
  const client = (_a3 = options.ide) == null ? void 0 : _a3.trim().toLowerCase();
48222
48322
  const environment = options.environment || process.env;
48223
- const clientConfig = client ? inspectMakerMcpClientConfig({
48323
+ const clientConfig = client ? options.configSource ? inspectMakerMcpConfigSource(client, options.configSource) : inspectMakerMcpClientConfig({
48224
48324
  ide: client,
48225
48325
  homeDir,
48226
48326
  platform,
@@ -48252,10 +48352,14 @@ async function collectMakerMcpIssueDiagnostics(options) {
48252
48352
  http_proxy_configured: hasEnvironmentValue(environment, "HTTP_PROXY"),
48253
48353
  https_proxy_configured: hasEnvironmentValue(environment, "HTTPS_PROXY"),
48254
48354
  no_proxy_configured: hasEnvironmentValue(environment, "NO_PROXY")
48255
- }
48355
+ },
48356
+ ...options.distribution ? { distribution: options.distribution } : {}
48256
48357
  };
48257
48358
  if (client === "workbuddy") {
48258
- diagnostics.workbuddy_trust = inspectWorkBuddyTrust(homeDir);
48359
+ diagnostics.workbuddy_trust = inspectWorkBuddyTrust(
48360
+ homeDir,
48361
+ ((_b = options.configSource) == null ? void 0 : _b.mcp_name) || MAKER_MCP_NAME
48362
+ );
48259
48363
  }
48260
48364
  return diagnostics;
48261
48365
  }
@@ -48313,10 +48417,12 @@ function getMcpConfigPaths(options) {
48313
48417
  }
48314
48418
  return void 0;
48315
48419
  }
48316
- function inspectMcpConfigFile(configPath, ide, mcpName) {
48420
+ function inspectMcpConfigFile(configPath, ide, mcpName, format) {
48317
48421
  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"),
48422
+ const resolvedFormat = format ?? (ide === "codex" ? "codex_toml" : ide === "dsh" ? "dsh" : ide === "opencode" ? "jsonc" : "json");
48423
+ const content = fs20.readFileSync(configPath, "utf8");
48424
+ const server = resolvedFormat === "codex_toml" ? extractCodexMcpServerConfig(content, mcpName) : resolvedFormat === "dsh" ? extractDshMcpServerConfig(content, mcpName, configPath) : extractMakerMcpServerConfig(
48425
+ parseJsonConfig(content, resolvedFormat === "jsonc"),
48320
48426
  mcpName
48321
48427
  );
48322
48428
  return server ? { path: configPath, status: "found", server } : { path: configPath, status: "missing_entry" };
@@ -48324,6 +48430,11 @@ function inspectMcpConfigFile(configPath, ide, mcpName) {
48324
48430
  return { path: configPath, status: "unreadable" };
48325
48431
  }
48326
48432
  }
48433
+ function inspectMakerMcpConfigSource(ide, source) {
48434
+ const entries = source.paths.filter((configPath) => fs20.existsSync(configPath)).map((configPath) => inspectMcpConfigFile(configPath, ide, source.mcp_name, source.format));
48435
+ const status = entries.some((entry) => entry.status === "found") ? "found" : entries.some((entry) => entry.status === "unreadable") ? "unreadable" : entries.length > 0 ? "missing_entry" : "not_found";
48436
+ return { ide, status, entries };
48437
+ }
48327
48438
  function extractDshMcpServerConfig(content, mcpName, source) {
48328
48439
  const plugin = findDshMakerPluginEntry(content, mcpName, source);
48329
48440
  if (!plugin) {
@@ -48529,7 +48640,7 @@ function runGitHubIssueCreate(args, input2) {
48529
48640
  stderr: typeof result.stderr === "string" ? result.stderr : ""
48530
48641
  };
48531
48642
  }
48532
- function inspectWorkBuddyTrust(homeDir) {
48643
+ function inspectWorkBuddyTrust(homeDir, mcpName) {
48533
48644
  const emptyCounts = {
48534
48645
  accounts_checked: 0,
48535
48646
  trusted_accounts: 0,
@@ -48563,9 +48674,9 @@ function inspectWorkBuddyTrust(homeDir) {
48563
48674
  counts.unreadable_accounts += 1;
48564
48675
  continue;
48565
48676
  }
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);
48677
+ const enabled = asStringArray(state.enabled).includes(mcpName);
48678
+ const userDisabled = asStringArray(state.userDisabled).includes(mcpName);
48679
+ const everConnected = asStringArray(state.everConnected).includes(mcpName);
48569
48680
  if (!enabled && !userDisabled && !everConnected) {
48570
48681
  continue;
48571
48682
  }
@@ -48750,11 +48861,1063 @@ function stripControlCharacters(value) {
48750
48861
  }).join("");
48751
48862
  }
48752
48863
 
48864
+ // src/maker/cli/pluginMigration.ts
48865
+ import fs22 from "node:fs";
48866
+ import os6 from "node:os";
48867
+ import path23 from "node:path";
48868
+ import crypto3 from "node:crypto";
48869
+
48870
+ // src/maker/cli/codexMcpConfig.ts
48871
+ function findCodexMcpTables(content, mcpName) {
48872
+ const mainPath = `mcp_servers.${mcpName}`;
48873
+ return findTomlTables(content).flatMap((table) => {
48874
+ const normalizedPath = normalizeCodexMcpTablePath(table.path, mcpName);
48875
+ if (!normalizedPath) {
48876
+ return [];
48877
+ }
48878
+ return [
48879
+ {
48880
+ headerStart: table.headerStart,
48881
+ bodyStart: table.bodyStart,
48882
+ bodyEnd: table.bodyEnd,
48883
+ normalizedPath,
48884
+ isMain: normalizedPath === mainPath
48885
+ }
48886
+ ];
48887
+ });
48888
+ }
48889
+ function removeCodexMcpTables(content, mcpName) {
48890
+ const tables = findCodexMcpTables(content, mcpName);
48891
+ return [...tables].reverse().reduce(
48892
+ (updated, table) => `${updated.slice(0, table.headerStart)}${updated.slice(table.bodyEnd)}`,
48893
+ content
48894
+ );
48895
+ }
48896
+ function findCodexMcpTableDuplicates(text, mcpName) {
48897
+ const seen = /* @__PURE__ */ new Set();
48898
+ const duplicates = /* @__PURE__ */ new Set();
48899
+ for (const table of findCodexMcpTables(text, mcpName)) {
48900
+ if (seen.has(table.normalizedPath)) {
48901
+ duplicates.add(table.normalizedPath);
48902
+ } else {
48903
+ seen.add(table.normalizedPath);
48904
+ }
48905
+ }
48906
+ return Array.from(duplicates);
48907
+ }
48908
+ function findTomlBooleanAssignment(content, start, end, key) {
48909
+ const keyPattern = escapeRegExp3(key);
48910
+ let multiline;
48911
+ for (const line of splitTomlLines(content, start, end)) {
48912
+ if (!multiline) {
48913
+ const match = new RegExp(`^\\s*${keyPattern}\\s*=\\s*(true|false)\\s*(?:#.*)?$`).exec(
48914
+ line.text
48915
+ );
48916
+ if ((match == null ? void 0 : match.index) !== void 0) {
48917
+ const relativeValueStart = match.index + match[0].indexOf(match[1]);
48918
+ return {
48919
+ value: match[1] === "true",
48920
+ valueStart: line.start + relativeValueStart,
48921
+ valueEnd: line.start + relativeValueStart + match[1].length
48922
+ };
48923
+ }
48924
+ }
48925
+ multiline = scanTomlLine(line.text, multiline);
48926
+ }
48927
+ return void 0;
48928
+ }
48929
+ function escapeTomlString(value) {
48930
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
48931
+ }
48932
+ function findTomlTables(content) {
48933
+ const tables = [];
48934
+ let multiline;
48935
+ for (const line of splitTomlLines(content)) {
48936
+ if (!multiline) {
48937
+ const match = /^\s*\[([^\]]+)\]\s*(?:#.*)?$/.exec(line.text);
48938
+ if (match) {
48939
+ const previous = tables[tables.length - 1];
48940
+ if (previous) {
48941
+ previous.bodyEnd = line.start;
48942
+ }
48943
+ tables.push({
48944
+ headerStart: line.start,
48945
+ bodyStart: line.end,
48946
+ bodyEnd: content.length,
48947
+ path: match[1]
48948
+ });
48949
+ }
48950
+ }
48951
+ multiline = scanTomlLine(line.text, multiline);
48952
+ }
48953
+ return tables;
48954
+ }
48955
+ function splitTomlLines(content, start = 0, end = content.length) {
48956
+ const lines = [];
48957
+ let lineStart = start;
48958
+ while (lineStart < end) {
48959
+ const newline = content.indexOf("\n", lineStart);
48960
+ const nextLineStart = newline === -1 || newline >= end ? end : newline + 1;
48961
+ let lineEnd = newline === -1 || newline >= end ? end : newline;
48962
+ if (lineEnd > lineStart && content[lineEnd - 1] === "\r") {
48963
+ lineEnd -= 1;
48964
+ }
48965
+ lines.push({
48966
+ start: lineStart,
48967
+ end: lineEnd,
48968
+ text: content.slice(lineStart, lineEnd)
48969
+ });
48970
+ lineStart = nextLineStart;
48971
+ }
48972
+ return lines;
48973
+ }
48974
+ function scanTomlLine(line, initial) {
48975
+ let multiline = initial;
48976
+ let index = 0;
48977
+ while (index < line.length) {
48978
+ if (multiline === "basic") {
48979
+ const closing = findUnescapedTripleQuote(line, index, '"""');
48980
+ if (closing === -1) {
48981
+ return multiline;
48982
+ }
48983
+ multiline = void 0;
48984
+ index = closing + 3;
48985
+ continue;
48986
+ }
48987
+ if (multiline === "literal") {
48988
+ const closing = line.indexOf("'''", index);
48989
+ if (closing === -1) {
48990
+ return multiline;
48991
+ }
48992
+ multiline = void 0;
48993
+ index = closing + 3;
48994
+ continue;
48995
+ }
48996
+ const character = line[index];
48997
+ if (character === "#") {
48998
+ return void 0;
48999
+ }
49000
+ if (line.startsWith('"""', index)) {
49001
+ multiline = "basic";
49002
+ index += 3;
49003
+ continue;
49004
+ }
49005
+ if (line.startsWith("'''", index)) {
49006
+ multiline = "literal";
49007
+ index += 3;
49008
+ continue;
49009
+ }
49010
+ if (character === '"') {
49011
+ index = skipBasicString(line, index + 1);
49012
+ continue;
49013
+ }
49014
+ if (character === "'") {
49015
+ const closing = line.indexOf("'", index + 1);
49016
+ index = closing === -1 ? line.length : closing + 1;
49017
+ continue;
49018
+ }
49019
+ index += 1;
49020
+ }
49021
+ return multiline;
49022
+ }
49023
+ function findUnescapedTripleQuote(line, start, delimiter) {
49024
+ let match = line.indexOf(delimiter, start);
49025
+ while (match !== -1) {
49026
+ let backslashes = 0;
49027
+ for (let index = match - 1; index >= 0 && line[index] === "\\"; index -= 1) {
49028
+ backslashes += 1;
49029
+ }
49030
+ if (backslashes % 2 === 0) {
49031
+ return match;
49032
+ }
49033
+ match = line.indexOf(delimiter, match + delimiter.length);
49034
+ }
49035
+ return -1;
49036
+ }
49037
+ function skipBasicString(line, start) {
49038
+ let escaped = false;
49039
+ for (let index = start; index < line.length; index += 1) {
49040
+ if (escaped) {
49041
+ escaped = false;
49042
+ continue;
49043
+ }
49044
+ if (line[index] === "\\") {
49045
+ escaped = true;
49046
+ continue;
49047
+ }
49048
+ if (line[index] === '"') {
49049
+ return index + 1;
49050
+ }
49051
+ }
49052
+ return line.length;
49053
+ }
49054
+ function normalizeCodexMcpTablePath(tablePath, mcpName) {
49055
+ const keyPattern = createCodexMcpKeyPattern(mcpName);
49056
+ const match = new RegExp(`^mcp_servers\\.${keyPattern}(\\..+)?$`).exec(tablePath);
49057
+ if (!match) {
49058
+ return void 0;
49059
+ }
49060
+ return `mcp_servers.${mcpName}${match[1] || ""}`;
49061
+ }
49062
+ function createCodexMcpKeyPattern(mcpName) {
49063
+ const quotedKey = `"${escapeRegExp3(mcpName)}"`;
49064
+ if (!/^[A-Za-z0-9_-]+$/.test(mcpName)) {
49065
+ return quotedKey;
49066
+ }
49067
+ return `(?:${quotedKey}|${escapeRegExp3(mcpName)})`;
49068
+ }
49069
+ function escapeRegExp3(value) {
49070
+ return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
49071
+ }
49072
+
49073
+ // src/maker/cli/configWrite.ts
49074
+ import fs21 from "node:fs";
49075
+ import path22 from "node:path";
49076
+ function writeConfigWithTapTapBackupIfChanged(filePath, nextContent, validate) {
49077
+ const existed = fs21.existsSync(filePath);
49078
+ const previousContent = existed ? fs21.readFileSync(filePath, "utf8") : void 0;
49079
+ if (previousContent === nextContent) {
49080
+ return { changed: false };
49081
+ }
49082
+ const backupPath = existed ? `${filePath}.taptap-maker.bak.latest` : void 0;
49083
+ fs21.mkdirSync(path22.dirname(filePath), { recursive: true });
49084
+ if (previousContent !== void 0 && backupPath) {
49085
+ fs21.writeFileSync(backupPath, previousContent, "utf8");
49086
+ }
49087
+ try {
49088
+ fs21.writeFileSync(filePath, nextContent, "utf8");
49089
+ validate == null ? void 0 : validate(fs21.readFileSync(filePath, "utf8"));
49090
+ return { changed: true, backupPath };
49091
+ } catch (error2) {
49092
+ if (previousContent !== void 0) {
49093
+ fs21.writeFileSync(filePath, previousContent, "utf8");
49094
+ } else {
49095
+ fs21.rmSync(filePath, { force: true });
49096
+ }
49097
+ throw error2;
49098
+ }
49099
+ }
49100
+
49101
+ // src/maker/cli/pluginMigration.ts
49102
+ function inspectCodexLegacyMakerMcp(options = {}) {
49103
+ const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
49104
+ if (!fs22.existsSync(configPath)) {
49105
+ return createInspection(configPath, "not_found", 0);
49106
+ }
49107
+ const content = fs22.readFileSync(configPath, "utf8");
49108
+ const registrations = findCodexMakerMainTables(content);
49109
+ if (registrations.length === 0) {
49110
+ return createInspection(configPath, "not_found", 0);
49111
+ }
49112
+ if (registrations.length > 1) {
49113
+ return createInspection(configPath, "ambiguous", registrations.length);
49114
+ }
49115
+ const enabled = registrations[0].enabled;
49116
+ return {
49117
+ ...createInspection(configPath, enabled ? "active" : "disabled", 1),
49118
+ enabled
49119
+ };
49120
+ }
49121
+ function migrateCodexLegacyMakerMcp(options = {}) {
49122
+ const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
49123
+ const makerHome = options.makerHome ?? getMakerHome();
49124
+ const statePath = getCodexPluginMigrationStatePath(makerHome);
49125
+ const inspection = inspectCodexLegacyMakerMcp({ configPath });
49126
+ if (inspection.status === "not_found") {
49127
+ return { ...inspection, action: "not_found", changed: false };
49128
+ }
49129
+ if (inspection.status === "ambiguous") {
49130
+ throw new Error(
49131
+ `Codex Maker MCP migration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before migrating.`
49132
+ );
49133
+ }
49134
+ if (inspection.status === "disabled") {
49135
+ const state2 = readMigrationState(statePath);
49136
+ const content = fs22.readFileSync(configPath, "utf8");
49137
+ const registration2 = findCodexMakerMainTables(content)[0];
49138
+ const owned = (state2 == null ? void 0 : state2.config_path) === configPath && sha256(readCodexMakerRegistration(content, registration2)) === state2.migrated_registration_sha256;
49139
+ return {
49140
+ ...inspection,
49141
+ action: owned ? "already_migrated" : "already_disabled",
49142
+ changed: false,
49143
+ ...owned ? { state_path: statePath } : {}
49144
+ };
49145
+ }
49146
+ if (!options.confirm) {
49147
+ throw new Error("Disabling the legacy Codex Maker MCP requires explicit confirmation.");
49148
+ }
49149
+ const previousContent = fs22.readFileSync(configPath, "utf8");
49150
+ const registration = findCodexMakerMainTables(previousContent)[0];
49151
+ const nextContent = disableCodexMakerRegistration(previousContent, registration);
49152
+ const state = {
49153
+ schema_version: 2,
49154
+ client: "codex",
49155
+ config_path: configPath,
49156
+ previous_enabled: registration.enabledExplicitly ? "true" : "implicit",
49157
+ original_registration_sha256: sha256(readCodexMakerRegistration(previousContent, registration)),
49158
+ migrated_registration_sha256: sha256(
49159
+ readCodexMakerRegistration(nextContent, findCodexMakerMainTables(nextContent)[0])
49160
+ ),
49161
+ migrated_at: (/* @__PURE__ */ new Date()).toISOString()
49162
+ };
49163
+ fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
49164
+ const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
49165
+ const migratedInspection = inspectCodexLegacyMakerMcp({ configPath });
49166
+ if (migratedInspection.status !== "disabled") {
49167
+ throw new Error("Codex Maker MCP migration validation did not find a disabled registration.");
49168
+ }
49169
+ fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
49170
+ `, "utf8");
49171
+ });
49172
+ return {
49173
+ ...inspectCodexLegacyMakerMcp({ configPath }),
49174
+ action: "disabled",
49175
+ changed: write.changed,
49176
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49177
+ state_path: statePath
49178
+ };
49179
+ }
49180
+ function restoreCodexLegacyMakerMcp(options = {}) {
49181
+ const configPath = options.configPath ?? path23.join(os6.homedir(), ".codex", "config.toml");
49182
+ const makerHome = options.makerHome ?? getMakerHome();
49183
+ const statePath = getCodexPluginMigrationStatePath(makerHome);
49184
+ const inspection = inspectCodexLegacyMakerMcp({ configPath });
49185
+ const state = readMigrationState(statePath);
49186
+ if (!state || state.config_path !== configPath) {
49187
+ return { ...inspection, action: "not_owned", changed: false };
49188
+ }
49189
+ if (!options.confirm) {
49190
+ throw new Error("Restoring the legacy Codex Maker MCP requires explicit confirmation.");
49191
+ }
49192
+ if (inspection.status === "ambiguous") {
49193
+ throw new Error(
49194
+ `Codex Maker MCP restoration found ${inspection.registration_count} equivalent registrations; resolve the duplicate tables before restoring.`
49195
+ );
49196
+ }
49197
+ if (inspection.status === "not_found") {
49198
+ throw new Error(
49199
+ "The migrated Codex Maker MCP registration no longer exists and cannot be restored."
49200
+ );
49201
+ }
49202
+ const previousContent = fs22.readFileSync(configPath, "utf8");
49203
+ const registration = findCodexMakerMainTables(previousContent)[0];
49204
+ const registrationSha256 = sha256(readCodexMakerRegistration(previousContent, registration));
49205
+ if (inspection.status === "active") {
49206
+ if (registrationSha256 !== state.original_registration_sha256) {
49207
+ return { ...inspection, action: "not_owned", changed: false };
49208
+ }
49209
+ fs22.unlinkSync(statePath);
49210
+ return { ...inspection, action: "already_restored", changed: false };
49211
+ }
49212
+ if (registrationSha256 !== state.migrated_registration_sha256) {
49213
+ return { ...inspection, action: "not_owned", changed: false };
49214
+ }
49215
+ const nextContent = restoreCodexMakerRegistration(previousContent, registration, state);
49216
+ const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
49217
+ const restoredInspection = inspectCodexLegacyMakerMcp({ configPath });
49218
+ if (restoredInspection.status !== "active") {
49219
+ throw new Error(
49220
+ "Codex Maker MCP restoration validation did not find an active registration."
49221
+ );
49222
+ }
49223
+ const restoredContent = fs22.readFileSync(configPath, "utf8");
49224
+ const restoredRegistration = findCodexMakerMainTables(restoredContent)[0];
49225
+ if (sha256(readCodexMakerRegistration(restoredContent, restoredRegistration)) !== state.original_registration_sha256) {
49226
+ throw new Error("Codex Maker MCP restoration changed the migrated registration identity.");
49227
+ }
49228
+ fs22.unlinkSync(statePath);
49229
+ });
49230
+ return {
49231
+ ...inspectCodexLegacyMakerMcp({ configPath }),
49232
+ action: "restored",
49233
+ changed: write.changed,
49234
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49235
+ state_path: statePath
49236
+ };
49237
+ }
49238
+ function findCodexMakerMainTables(content) {
49239
+ return findCodexMcpTables(content, "taptap-maker").filter((table) => table.isMain).map((table) => {
49240
+ const enabledAssignment = findTomlBooleanAssignment(
49241
+ content,
49242
+ table.bodyStart,
49243
+ table.bodyEnd,
49244
+ "enabled"
49245
+ );
49246
+ return {
49247
+ headerStart: table.headerStart,
49248
+ bodyStart: table.bodyStart,
49249
+ bodyEnd: table.bodyEnd,
49250
+ enabled: (enabledAssignment == null ? void 0 : enabledAssignment.value) !== false,
49251
+ enabledExplicitly: Boolean(enabledAssignment),
49252
+ ...enabledAssignment ? {
49253
+ enabledValueStart: enabledAssignment.valueStart,
49254
+ enabledValueEnd: enabledAssignment.valueEnd
49255
+ } : {}
49256
+ };
49257
+ });
49258
+ }
49259
+ function disableCodexMakerRegistration(content, registration) {
49260
+ if (registration.enabledValueStart !== void 0 && registration.enabledValueEnd !== void 0) {
49261
+ return `${content.slice(0, registration.enabledValueStart)}false${content.slice(
49262
+ registration.enabledValueEnd
49263
+ )}`;
49264
+ }
49265
+ return `${content.slice(0, registration.bodyStart)}
49266
+ enabled = false${content.slice(
49267
+ registration.bodyStart
49268
+ )}`;
49269
+ }
49270
+ function restoreCodexMakerRegistration(content, registration, state) {
49271
+ if (state.previous_enabled === "true") {
49272
+ if (registration.enabledValueStart === void 0 || registration.enabledValueEnd === void 0) {
49273
+ throw new Error("The migrated Codex Maker MCP enabled value is missing.");
49274
+ }
49275
+ return `${content.slice(0, registration.enabledValueStart)}true${content.slice(
49276
+ registration.enabledValueEnd
49277
+ )}`;
49278
+ }
49279
+ const insertedLine = "\nenabled = false";
49280
+ if (!content.startsWith(insertedLine, registration.bodyStart)) {
49281
+ throw new Error("The plugin-owned Codex Maker MCP disabled marker was modified.");
49282
+ }
49283
+ return `${content.slice(0, registration.bodyStart)}${content.slice(
49284
+ registration.bodyStart + insertedLine.length
49285
+ )}`;
49286
+ }
49287
+ function readCodexMakerRegistration(content, registration) {
49288
+ return content.slice(registration.headerStart, registration.bodyEnd).trimEnd();
49289
+ }
49290
+ function getCodexPluginMigrationStatePath(makerHome) {
49291
+ return path23.join(makerHome, "plugin-migrations", "codex.json");
49292
+ }
49293
+ function readMigrationState(statePath) {
49294
+ if (!fs22.existsSync(statePath)) {
49295
+ return void 0;
49296
+ }
49297
+ try {
49298
+ const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
49299
+ return (state == null ? void 0 : state.schema_version) === 2 && state.client === "codex" ? state : void 0;
49300
+ } catch {
49301
+ return void 0;
49302
+ }
49303
+ }
49304
+ function sha256(content) {
49305
+ return crypto3.createHash("sha256").update(content).digest("hex");
49306
+ }
49307
+ function createInspection(configPath, status, registrationCount) {
49308
+ return {
49309
+ client: "codex",
49310
+ status,
49311
+ config_path: configPath,
49312
+ registration_count: registrationCount
49313
+ };
49314
+ }
49315
+ function inspectWorkBuddyLegacyMakerMcp(options = {}) {
49316
+ const configPaths = getWorkBuddyConfigPaths(options.configPaths);
49317
+ const registrations = findWorkBuddyMakerRegistrations(configPaths);
49318
+ const registrationPaths = registrations.map((entry) => entry.configPath);
49319
+ if (registrations.length === 0) {
49320
+ return createWorkBuddyInspection(configPaths[0], "not_found", []);
49321
+ }
49322
+ const activeRegistrations = registrations.filter((entry) => entry.registration.disabled !== true);
49323
+ if (activeRegistrations.length > 1) {
49324
+ return createWorkBuddyInspection(configPaths[0], "ambiguous", registrationPaths);
49325
+ }
49326
+ if (activeRegistrations.length === 0) {
49327
+ return {
49328
+ ...createWorkBuddyInspection(registrations[0].configPath, "disabled", registrationPaths),
49329
+ enabled: false
49330
+ };
49331
+ }
49332
+ const active = activeRegistrations[0];
49333
+ return {
49334
+ ...createWorkBuddyInspection(active.configPath, "active", registrationPaths),
49335
+ enabled: true
49336
+ };
49337
+ }
49338
+ function migrateWorkBuddyLegacyMakerMcp(options = {}) {
49339
+ const configPaths = getWorkBuddyConfigPaths(options.configPaths);
49340
+ const makerHome = options.makerHome ?? getMakerHome();
49341
+ const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
49342
+ const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49343
+ if (inspection.status === "not_found") {
49344
+ return { ...inspection, action: "not_found", changed: false };
49345
+ }
49346
+ if (inspection.status === "ambiguous") {
49347
+ throw new Error(
49348
+ `WorkBuddy Maker MCP migration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
49349
+ );
49350
+ }
49351
+ const registrations = findWorkBuddyMakerRegistrations(configPaths);
49352
+ if (inspection.status === "disabled") {
49353
+ const state2 = readWorkBuddyMigrationState(statePath);
49354
+ const current2 = state2 ? registrations.find((entry) => entry.configPath === state2.config_path) : registrations[0];
49355
+ const owned = Boolean(
49356
+ state2 && current2 && hashWorkBuddyRegistration(current2.registration) === state2.migrated_registration_sha256
49357
+ );
49358
+ return {
49359
+ ...inspection,
49360
+ ...owned && current2 ? { config_path: current2.configPath } : {},
49361
+ action: owned ? "already_migrated" : "already_disabled",
49362
+ changed: false,
49363
+ ...owned ? { state_path: statePath } : {}
49364
+ };
49365
+ }
49366
+ if (!options.confirm) {
49367
+ throw new Error("Disabling the legacy WorkBuddy Maker MCP requires explicit confirmation.");
49368
+ }
49369
+ const current = registrations.find((entry) => entry.configPath === inspection.config_path);
49370
+ if (!current) {
49371
+ throw new Error("The active WorkBuddy Maker MCP registration could not be resolved.");
49372
+ }
49373
+ const originalRegistration = { ...current.registration };
49374
+ const previousDisabled = Object.prototype.hasOwnProperty.call(originalRegistration, "disabled") ? false : "missing";
49375
+ const migratedRegistration = { ...originalRegistration, disabled: true };
49376
+ setWorkBuddyMakerRegistration(current.config, migratedRegistration);
49377
+ const nextContent = `${JSON.stringify(current.config, null, 2)}
49378
+ `;
49379
+ const state = {
49380
+ schema_version: 1,
49381
+ client: "workbuddy",
49382
+ config_path: current.configPath,
49383
+ previous_disabled: previousDisabled,
49384
+ original_registration_sha256: hashWorkBuddyRegistration(originalRegistration),
49385
+ migrated_registration_sha256: hashWorkBuddyRegistration(migratedRegistration),
49386
+ migrated_at: (/* @__PURE__ */ new Date()).toISOString()
49387
+ };
49388
+ fs22.mkdirSync(path23.dirname(statePath), { recursive: true });
49389
+ const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
49390
+ const migrated = findWorkBuddyMakerRegistrations(configPaths).find(
49391
+ (entry) => entry.configPath === current.configPath
49392
+ );
49393
+ if (!migrated || hashWorkBuddyRegistration(migrated.registration) !== state.migrated_registration_sha256) {
49394
+ throw new Error(
49395
+ "WorkBuddy Maker MCP migration validation did not find the disabled registration."
49396
+ );
49397
+ }
49398
+ fs22.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
49399
+ `, "utf8");
49400
+ });
49401
+ const migratedInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49402
+ return {
49403
+ ...migratedInspection,
49404
+ config_path: current.configPath,
49405
+ action: "disabled",
49406
+ changed: write.changed,
49407
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49408
+ state_path: statePath
49409
+ };
49410
+ }
49411
+ function restoreWorkBuddyLegacyMakerMcp(options = {}) {
49412
+ const configPaths = getWorkBuddyConfigPaths(options.configPaths);
49413
+ const makerHome = options.makerHome ?? getMakerHome();
49414
+ const statePath = getWorkBuddyPluginMigrationStatePath(makerHome);
49415
+ const inspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49416
+ const state = readWorkBuddyMigrationState(statePath);
49417
+ if (!state) {
49418
+ return { ...inspection, action: "not_owned", changed: false };
49419
+ }
49420
+ if (!options.confirm) {
49421
+ throw new Error("Restoring the legacy WorkBuddy Maker MCP requires explicit confirmation.");
49422
+ }
49423
+ if (inspection.status === "ambiguous") {
49424
+ throw new Error(
49425
+ `WorkBuddy Maker MCP restoration found registrations in multiple config files: ${inspection.config_paths.join(", ")}`
49426
+ );
49427
+ }
49428
+ if (inspection.status === "not_found") {
49429
+ throw new Error(
49430
+ "The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
49431
+ );
49432
+ }
49433
+ const current = findWorkBuddyMakerRegistrations(configPaths).find(
49434
+ (entry) => entry.configPath === state.config_path
49435
+ );
49436
+ if (!current) {
49437
+ throw new Error(
49438
+ "The migrated WorkBuddy Maker MCP registration no longer exists and cannot be restored."
49439
+ );
49440
+ }
49441
+ const registrationSha256 = hashWorkBuddyRegistration(current.registration);
49442
+ const currentEnabled = current.registration.disabled !== true;
49443
+ if (currentEnabled) {
49444
+ if (registrationSha256 !== state.original_registration_sha256) {
49445
+ return {
49446
+ ...inspection,
49447
+ config_path: current.configPath,
49448
+ action: "not_owned",
49449
+ changed: false
49450
+ };
49451
+ }
49452
+ fs22.unlinkSync(statePath);
49453
+ return {
49454
+ ...inspection,
49455
+ config_path: current.configPath,
49456
+ action: "already_restored",
49457
+ changed: false
49458
+ };
49459
+ }
49460
+ if (registrationSha256 !== state.migrated_registration_sha256) {
49461
+ return { ...inspection, config_path: current.configPath, action: "not_owned", changed: false };
49462
+ }
49463
+ const restoredRegistration = { ...current.registration };
49464
+ if (state.previous_disabled === "missing") {
49465
+ delete restoredRegistration.disabled;
49466
+ } else {
49467
+ restoredRegistration.disabled = false;
49468
+ }
49469
+ setWorkBuddyMakerRegistration(current.config, restoredRegistration);
49470
+ const nextContent = `${JSON.stringify(current.config, null, 2)}
49471
+ `;
49472
+ const write = writeConfigWithTapTapBackupIfChanged(current.configPath, nextContent, () => {
49473
+ const restoredInspection = inspectWorkBuddyLegacyMakerMcp({ configPaths });
49474
+ if (restoredInspection.status !== "active") {
49475
+ throw new Error(
49476
+ "WorkBuddy Maker MCP restoration validation did not find an active registration."
49477
+ );
49478
+ }
49479
+ const restored = findWorkBuddyMakerRegistrations(configPaths).find(
49480
+ (entry) => entry.configPath === state.config_path
49481
+ );
49482
+ if (!restored || hashWorkBuddyRegistration(restored.registration) !== state.original_registration_sha256) {
49483
+ throw new Error("WorkBuddy Maker MCP restoration changed the registration identity.");
49484
+ }
49485
+ fs22.unlinkSync(statePath);
49486
+ });
49487
+ return {
49488
+ ...inspectWorkBuddyLegacyMakerMcp({ configPaths }),
49489
+ config_path: current.configPath,
49490
+ action: "restored",
49491
+ changed: write.changed,
49492
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49493
+ state_path: statePath
49494
+ };
49495
+ }
49496
+ function getWorkBuddyConfigPaths(configPaths) {
49497
+ return configPaths ?? [
49498
+ path23.join(os6.homedir(), ".workbuddy", "mcp.json"),
49499
+ path23.join(os6.homedir(), ".workbuddy", ".mcp.json")
49500
+ ];
49501
+ }
49502
+ function findWorkBuddyMakerRegistrations(configPaths) {
49503
+ const registrations = [];
49504
+ for (const configPath of configPaths) {
49505
+ if (!fs22.existsSync(configPath)) {
49506
+ continue;
49507
+ }
49508
+ let config2;
49509
+ try {
49510
+ config2 = JSON.parse(fs22.readFileSync(configPath, "utf8"));
49511
+ } catch (error2) {
49512
+ throw new Error(
49513
+ `Cannot parse WorkBuddy MCP config ${configPath}: ${error2 instanceof Error ? error2.message : String(error2)}`
49514
+ );
49515
+ }
49516
+ if (!isRecord5(config2)) {
49517
+ throw new Error(`WorkBuddy MCP config must contain a JSON object: ${configPath}`);
49518
+ }
49519
+ const servers = config2.mcpServers;
49520
+ if (servers === void 0) {
49521
+ continue;
49522
+ }
49523
+ if (!isRecord5(servers)) {
49524
+ throw new Error(`WorkBuddy MCP config mcpServers must be an object: ${configPath}`);
49525
+ }
49526
+ const registration = servers["taptap-maker"];
49527
+ if (registration === void 0) {
49528
+ continue;
49529
+ }
49530
+ if (!isRecord5(registration)) {
49531
+ throw new Error(`WorkBuddy taptap-maker MCP registration must be an object: ${configPath}`);
49532
+ }
49533
+ registrations.push({ configPath, config: config2, registration });
49534
+ }
49535
+ return registrations;
49536
+ }
49537
+ function setWorkBuddyMakerRegistration(config2, registration) {
49538
+ const servers = config2.mcpServers;
49539
+ if (!isRecord5(servers)) {
49540
+ throw new Error("WorkBuddy MCP config mcpServers must be an object.");
49541
+ }
49542
+ servers["taptap-maker"] = registration;
49543
+ }
49544
+ function getWorkBuddyPluginMigrationStatePath(makerHome) {
49545
+ return path23.join(makerHome, "plugin-migrations", "workbuddy.json");
49546
+ }
49547
+ function readWorkBuddyMigrationState(statePath) {
49548
+ if (!fs22.existsSync(statePath)) {
49549
+ return void 0;
49550
+ }
49551
+ try {
49552
+ const state = JSON.parse(fs22.readFileSync(statePath, "utf8"));
49553
+ return (state == null ? void 0 : state.schema_version) === 1 && state.client === "workbuddy" ? state : void 0;
49554
+ } catch {
49555
+ return void 0;
49556
+ }
49557
+ }
49558
+ function hashWorkBuddyRegistration(registration) {
49559
+ return sha256(JSON.stringify(registration));
49560
+ }
49561
+ function createWorkBuddyInspection(configPath, status, configPaths) {
49562
+ return {
49563
+ client: "workbuddy",
49564
+ status,
49565
+ config_path: configPath,
49566
+ config_paths: configPaths,
49567
+ registration_count: configPaths.length
49568
+ };
49569
+ }
49570
+ function isRecord5(value) {
49571
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
49572
+ }
49573
+
49574
+ // src/maker/cli/dshPluginMigration.ts
49575
+ var import_yaml2 = __toESM(require_dist2());
49576
+ import fs23 from "node:fs";
49577
+ import os7 from "node:os";
49578
+ import path24 from "node:path";
49579
+ import crypto4 from "node:crypto";
49580
+ var DSH_MAKER_MCP_NAME = "taptap-maker";
49581
+ function inspectDshLegacyMakerMcp(options = {}) {
49582
+ const registrations = findDshMakerRegistrations(options.dshHome);
49583
+ const configPaths = unique(registrations.map((entry) => entry.configPath));
49584
+ if (registrations.length === 0) {
49585
+ return createDshInspection("not_found", [], configPaths);
49586
+ }
49587
+ if (registrations.length > 1) {
49588
+ return createDshInspection("ambiguous", configPaths, configPaths);
49589
+ }
49590
+ return createDshInspection("active", [registrations[0].configPath], configPaths);
49591
+ }
49592
+ function migrateDshLegacyMakerMcp(options = {}) {
49593
+ const makerHome = getMakerHome();
49594
+ const statePath = getDshPluginMigrationStatePath(makerHome);
49595
+ const registrations = findDshMakerRegistrations(options.dshHome);
49596
+ const inspection = inspectDshLegacyMakerMcp(options);
49597
+ if (inspection.status === "not_found") {
49598
+ return { ...inspection, action: "not_found", changed: false };
49599
+ }
49600
+ if (inspection.status === "ambiguous") {
49601
+ throw new Error(
49602
+ `DSH Maker MCP migration found ${inspection.registration_count} registrations in ${inspection.config_paths.join(", ")}; resolve the duplicates before migrating.`
49603
+ );
49604
+ }
49605
+ if (!options.confirm) {
49606
+ throw new Error(
49607
+ "Removing the legacy DSH Maker MCP registration requires explicit confirmation."
49608
+ );
49609
+ }
49610
+ const registration = registrations[0];
49611
+ const previousContent = fs23.readFileSync(registration.configPath, "utf8");
49612
+ const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
49613
+ if (document.errors.length > 0) {
49614
+ throw new Error(`Invalid YAML in ${registration.configPath}: ${document.errors[0].message}`);
49615
+ }
49616
+ removeDshMakerRegistration(document, registration);
49617
+ const nextContent = document.toString({ lineWidth: 0 });
49618
+ const state = {
49619
+ schema_version: 1,
49620
+ client: "dsh",
49621
+ config_path: registration.configPath,
49622
+ removed_registration: registration.registration,
49623
+ removed_registration_sha256: sha2562(JSON.stringify(registration.registration)),
49624
+ migrated_at: (/* @__PURE__ */ new Date()).toISOString()
49625
+ };
49626
+ fs23.mkdirSync(path24.dirname(statePath), { recursive: true });
49627
+ const write = writeConfigWithTapTapBackupIfChanged(registration.configPath, nextContent, () => {
49628
+ const after = findDshMakerRegistrations(options.dshHome);
49629
+ if (after.some((entry) => entry.configPath === registration.configPath)) {
49630
+ throw new Error("DSH Maker MCP migration validation still found a registration.");
49631
+ }
49632
+ fs23.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}
49633
+ `, "utf8");
49634
+ });
49635
+ return {
49636
+ ...inspectDshLegacyMakerMcp(options),
49637
+ action: "removed",
49638
+ changed: write.changed,
49639
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49640
+ state_path: statePath
49641
+ };
49642
+ }
49643
+ function restoreDshLegacyMakerMcp(options = {}) {
49644
+ const makerHome = getMakerHome();
49645
+ const statePath = getDshPluginMigrationStatePath(makerHome);
49646
+ const inspection = inspectDshLegacyMakerMcp(options);
49647
+ const state = readDshMigrationState(statePath);
49648
+ if (!state) {
49649
+ return { ...inspection, action: "not_owned", changed: false };
49650
+ }
49651
+ if (!options.confirm) {
49652
+ throw new Error(
49653
+ "Restoring the legacy DSH Maker MCP registration requires explicit confirmation."
49654
+ );
49655
+ }
49656
+ if (inspection.status === "ambiguous") {
49657
+ throw new Error(
49658
+ `DSH Maker MCP restoration found ${inspection.registration_count} registrations; resolve the duplicates before restoring.`
49659
+ );
49660
+ }
49661
+ if (inspection.status === "active") {
49662
+ const current = findDshMakerRegistrations(options.dshHome)[0];
49663
+ const currentSha = sha2562(JSON.stringify(current.registration));
49664
+ if (currentSha === state.removed_registration_sha256) {
49665
+ fs23.rmSync(statePath, { force: true });
49666
+ return { ...inspection, action: "already_restored", changed: false, state_path: statePath };
49667
+ }
49668
+ return { ...inspection, action: "not_owned", changed: false };
49669
+ }
49670
+ const configPath = state.config_path;
49671
+ const previousContent = fs23.readFileSync(configPath, "utf8");
49672
+ const document = (0, import_yaml2.parseDocument)(previousContent, { prettyErrors: true });
49673
+ if (document.errors.length > 0) {
49674
+ throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
49675
+ }
49676
+ reinsertDshMakerRegistration(document, state.removed_registration);
49677
+ const nextContent = document.toString({ lineWidth: 0 });
49678
+ const write = writeConfigWithTapTapBackupIfChanged(configPath, nextContent, () => {
49679
+ const restored = findDshMakerRegistrations(options.dshHome);
49680
+ const match = restored.find((entry) => entry.configPath === configPath);
49681
+ if (!match || sha2562(JSON.stringify(match.registration)) !== state.removed_registration_sha256) {
49682
+ throw new Error("DSH Maker MCP restoration changed the registration identity.");
49683
+ }
49684
+ fs23.rmSync(statePath, { force: true });
49685
+ });
49686
+ return {
49687
+ ...inspectDshLegacyMakerMcp(options),
49688
+ action: "restored",
49689
+ changed: write.changed,
49690
+ ...write.backupPath ? { backup_path: write.backupPath } : {},
49691
+ state_path: statePath
49692
+ };
49693
+ }
49694
+ function findDshMakerRegistrations(dshHome) {
49695
+ const resolvedDshHome = dshHome || getDshHome();
49696
+ const configPaths = listDshMcpConfigPaths({ homeDir: os7.homedir(), dshHome: resolvedDshHome });
49697
+ const registrations = [];
49698
+ for (const configPath of configPaths) {
49699
+ if (!fs23.existsSync(configPath)) {
49700
+ continue;
49701
+ }
49702
+ const content = fs23.readFileSync(configPath, "utf8");
49703
+ const document = (0, import_yaml2.parseDocument)(content, { prettyErrors: true });
49704
+ if (document.errors.length > 0) {
49705
+ throw new Error(`Invalid YAML in ${configPath}: ${document.errors[0].message}`);
49706
+ }
49707
+ const candidates = findDshMakerCandidates(document);
49708
+ for (const candidate of candidates) {
49709
+ registrations.push({ configPath, ...candidate });
49710
+ }
49711
+ }
49712
+ return registrations;
49713
+ }
49714
+ function findDshMakerCandidates(document) {
49715
+ const candidates = [];
49716
+ const top = document.contents;
49717
+ if (!(0, import_yaml2.isSeq)(top)) {
49718
+ return candidates;
49719
+ }
49720
+ top.items.forEach((rawPatch, patchIndex) => {
49721
+ const patchNode = rawPatch;
49722
+ const patch = patchNode.toJSON();
49723
+ if (Array.isArray(patch == null ? void 0 : patch.insert)) {
49724
+ const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
49725
+ if (!(0, import_yaml2.isSeq)(insertNode)) {
49726
+ return;
49727
+ }
49728
+ insertNode.items.forEach((rawRow, insertIndex) => {
49729
+ const rowNode = rawRow;
49730
+ const row = rowNode.toJSON();
49731
+ if (isDshMakerPluginCandidate(row)) {
49732
+ candidates.push({
49733
+ patchIndex,
49734
+ insertIndex,
49735
+ registration: row
49736
+ });
49737
+ }
49738
+ });
49739
+ return;
49740
+ }
49741
+ if (isDshMakerPluginCandidate(patch)) {
49742
+ candidates.push({
49743
+ patchIndex,
49744
+ registration: patch
49745
+ });
49746
+ }
49747
+ });
49748
+ return candidates;
49749
+ }
49750
+ function removeDshMakerRegistration(document, registration) {
49751
+ const top = document.contents;
49752
+ if (!(0, import_yaml2.isSeq)(top)) {
49753
+ throw new Error("DSH config top-level value must be a plugin array.");
49754
+ }
49755
+ if (registration.insertIndex !== void 0) {
49756
+ const patchNode = top.items[registration.patchIndex];
49757
+ const insertNode = (0, import_yaml2.isMap)(patchNode) ? patchNode.get("insert", true) : void 0;
49758
+ if (!(0, import_yaml2.isSeq)(insertNode)) {
49759
+ throw new Error("Invalid DSH insert patch.");
49760
+ }
49761
+ insertNode.items.splice(registration.insertIndex, 1);
49762
+ if (insertNode.items.length === 0) {
49763
+ top.items.splice(registration.patchIndex, 1);
49764
+ }
49765
+ return;
49766
+ }
49767
+ top.items.splice(registration.patchIndex, 1);
49768
+ }
49769
+ function reinsertDshMakerRegistration(document, registration) {
49770
+ const top = document.contents;
49771
+ if (!(0, import_yaml2.isSeq)(top)) {
49772
+ throw new Error("DSH config top-level value must be a plugin array.");
49773
+ }
49774
+ top.items.push(document.createNode({ insert: [registration] }));
49775
+ }
49776
+ function isDshMakerPluginCandidate(value) {
49777
+ if (!isRecord6(value)) {
49778
+ return false;
49779
+ }
49780
+ if (value.id === DSH_MAKER_PLUGIN_ID) {
49781
+ return true;
49782
+ }
49783
+ const config2 = isRecord6(value.config) ? value.config : void 0;
49784
+ return value.name === DSH_MCP_PLUGIN_NAME && (config2 == null ? void 0 : config2.serverName) === DSH_MAKER_MCP_NAME;
49785
+ }
49786
+ function getDshPluginMigrationStatePath(makerHome) {
49787
+ return path24.join(makerHome, "plugin-migrations", "dsh.json");
49788
+ }
49789
+ function readDshMigrationState(statePath) {
49790
+ if (!fs23.existsSync(statePath)) {
49791
+ return void 0;
49792
+ }
49793
+ try {
49794
+ const state = JSON.parse(fs23.readFileSync(statePath, "utf8"));
49795
+ return (state == null ? void 0 : state.schema_version) === 1 && state.client === "dsh" ? state : void 0;
49796
+ } catch {
49797
+ return void 0;
49798
+ }
49799
+ }
49800
+ function createDshInspection(status, primaryPaths, allPaths) {
49801
+ return {
49802
+ client: "dsh",
49803
+ status,
49804
+ config_path: primaryPaths[0] ?? "",
49805
+ config_paths: allPaths,
49806
+ registration_count: primaryPaths.length
49807
+ };
49808
+ }
49809
+ function sha2562(content) {
49810
+ return crypto4.createHash("sha256").update(content).digest("hex");
49811
+ }
49812
+ function isRecord6(value) {
49813
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
49814
+ }
49815
+ function unique(values) {
49816
+ return [...new Set(values)];
49817
+ }
49818
+
49819
+ // src/maker/cli/workBuddyProjectSkills.ts
49820
+ import fs24 from "node:fs";
49821
+ import path25 from "node:path";
49822
+ function syncWorkBuddyProjectSkills(targetDir, options = {}) {
49823
+ const platform = options.platform ?? process.platform;
49824
+ const projectDir = path25.resolve(targetDir);
49825
+ const sourceDir = path25.join(projectDir, ".installer", "skills");
49826
+ const workBuddySkillsDir = path25.join(projectDir, ".workbuddy", "skills");
49827
+ const result = {
49828
+ status: "skipped",
49829
+ sourceDir,
49830
+ targetDir: workBuddySkillsDir,
49831
+ installedSkills: [],
49832
+ skippedSkills: []
49833
+ };
49834
+ if (!isDirectory(sourceDir)) {
49835
+ result.reason = "source_not_found";
49836
+ return result;
49837
+ }
49838
+ const sourceSkills = fs24.readdirSync(sourceDir, { withFileTypes: true }).filter(
49839
+ (entry) => entry.isDirectory() && fs24.existsSync(path25.join(sourceDir, entry.name, "SKILL.md"))
49840
+ ).map((entry) => entry.name).sort();
49841
+ for (const sourceSkillName of sourceSkills) {
49842
+ const workBuddySkillName = `taptap-maker-${sourceSkillName}`;
49843
+ const workBuddySkillDir = path25.join(workBuddySkillsDir, workBuddySkillName);
49844
+ if (pathEntryExists(workBuddySkillDir)) {
49845
+ result.skippedSkills.push(workBuddySkillName);
49846
+ continue;
49847
+ }
49848
+ fs24.mkdirSync(workBuddySkillsDir, { recursive: true });
49849
+ installSkillContents(path25.join(sourceDir, sourceSkillName), workBuddySkillDir, platform);
49850
+ result.installedSkills.push(workBuddySkillName);
49851
+ }
49852
+ if (result.installedSkills.length > 0) {
49853
+ result.status = "installed";
49854
+ }
49855
+ return result;
49856
+ }
49857
+ function installSkillContents(sourceDir, targetDir, platform) {
49858
+ fs24.mkdirSync(targetDir);
49859
+ try {
49860
+ for (const entry of fs24.readdirSync(sourceDir)) {
49861
+ linkOrCopyEntry(path25.join(sourceDir, entry), path25.join(targetDir, entry), platform);
49862
+ }
49863
+ } catch (error2) {
49864
+ fs24.rmSync(targetDir, { recursive: true, force: true });
49865
+ throw error2;
49866
+ }
49867
+ }
49868
+ function linkOrCopyEntry(source, target, platform) {
49869
+ const stat = fs24.statSync(source);
49870
+ if (platform === "win32" && stat.isFile()) {
49871
+ fs24.copyFileSync(source, target);
49872
+ return;
49873
+ }
49874
+ try {
49875
+ const linkTarget = platform === "win32" ? source : path25.relative(path25.dirname(target), source);
49876
+ const linkType = stat.isDirectory() ? platform === "win32" ? "junction" : "dir" : "file";
49877
+ fs24.symlinkSync(linkTarget, target, linkType);
49878
+ } catch (error2) {
49879
+ try {
49880
+ fs24.cpSync(source, target, { recursive: stat.isDirectory() });
49881
+ } catch (copyError) {
49882
+ throw new Error(
49883
+ `Failed to install WorkBuddy project skill entry ${source}: ${formatError3(error2)}; copy fallback: ${formatError3(copyError)}`
49884
+ );
49885
+ }
49886
+ }
49887
+ }
49888
+ function isDirectory(value) {
49889
+ try {
49890
+ return fs24.statSync(value).isDirectory();
49891
+ } catch {
49892
+ return false;
49893
+ }
49894
+ }
49895
+ function pathEntryExists(value) {
49896
+ try {
49897
+ fs24.lstatSync(value);
49898
+ return true;
49899
+ } catch {
49900
+ return false;
49901
+ }
49902
+ }
49903
+ function formatError3(error2) {
49904
+ return error2 instanceof Error ? error2.message : String(error2);
49905
+ }
49906
+
48753
49907
  // src/maker/cli/commands.ts
48754
- var VERSION2 = true ? "0.0.30" : "dev";
49908
+ var VERSION2 = true ? "0.0.31-beta.1" : "dev";
48755
49909
  var DEFAULT_MCP_NAME = "taptap-maker";
48756
49910
  var MAKER_NPM_PACKAGE = "@taptap/maker";
48757
- var TWO_PART_COMMANDS = /* @__PURE__ */ new Set(["pat", "mcp", "dev-kit", "logs", "python", "lua-lsp", "agents"]);
49911
+ var TWO_PART_COMMANDS = /* @__PURE__ */ new Set([
49912
+ "pat",
49913
+ "mcp",
49914
+ "dev-kit",
49915
+ "logs",
49916
+ "python",
49917
+ "lua-lsp",
49918
+ "agents",
49919
+ "plugin"
49920
+ ]);
48758
49921
  var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
48759
49922
  "json",
48760
49923
  "skip_confirm",
@@ -48765,6 +49928,7 @@ var BOOLEAN_OPTIONS = /* @__PURE__ */ new Set([
48765
49928
  "all",
48766
49929
  "create",
48767
49930
  "consent",
49931
+ "confirm",
48768
49932
  "context_stdin",
48769
49933
  "h",
48770
49934
  "help"
@@ -48823,6 +49987,10 @@ async function runMakerCli(argv) {
48823
49987
  await runAgentsUpdate(parsed, ctx);
48824
49988
  return;
48825
49989
  }
49990
+ if (command === "plugin") {
49991
+ runPluginLifecycle(parsed, ctx);
49992
+ return;
49993
+ }
48826
49994
  if (command === "upgrade") {
48827
49995
  await runUpgrade(parsed, ctx);
48828
49996
  return;
@@ -48845,6 +50013,57 @@ async function runMakerCli(argv) {
48845
50013
  }
48846
50014
  throw new Error(`Unknown taptap-maker command: ${formatUnknownCommand(parsed.command)}`);
48847
50015
  }
50016
+ function runPluginLifecycle(parsed, ctx) {
50017
+ const subcommand = parsed.command[1];
50018
+ const client = stringOption(parsed, "client") || "codex";
50019
+ if (client !== "codex" && client !== "workbuddy" && client !== "dsh") {
50020
+ throw new Error(
50021
+ `Unsupported Maker plugin client: ${client}. Supported clients: codex, workbuddy, dsh.`
50022
+ );
50023
+ }
50024
+ if (subcommand === "inspect") {
50025
+ writePluginLifecycleResult(
50026
+ ctx,
50027
+ client === "codex" ? inspectCodexLegacyMakerMcp() : client === "workbuddy" ? inspectWorkBuddyLegacyMakerMcp() : inspectDshLegacyMakerMcp()
50028
+ );
50029
+ return;
50030
+ }
50031
+ if (subcommand === "migrate") {
50032
+ writePluginLifecycleResult(
50033
+ ctx,
50034
+ client === "codex" ? migrateCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? migrateWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : migrateDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
50035
+ );
50036
+ return;
50037
+ }
50038
+ if (subcommand === "restore") {
50039
+ writePluginLifecycleResult(
50040
+ ctx,
50041
+ client === "codex" ? restoreCodexLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : client === "workbuddy" ? restoreWorkBuddyLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") }) : restoreDshLegacyMakerMcp({ confirm: booleanOption(parsed, "confirm") })
50042
+ );
50043
+ return;
50044
+ }
50045
+ throw new Error("Unknown Maker plugin command. Use inspect, migrate, or restore.");
50046
+ }
50047
+ function writePluginLifecycleResult(ctx, result) {
50048
+ if (ctx.json) {
50049
+ writeJson(result);
50050
+ return;
50051
+ }
50052
+ process.stdout.write(
50053
+ [
50054
+ "TapTap Maker plugin migration",
50055
+ "",
50056
+ `- client: ${result.client}`,
50057
+ `- legacy_mcp_status: ${result.status}`,
50058
+ `- config_path: ${result.config_path}`,
50059
+ ..."config_paths" in result && result.config_paths.length > 1 ? [`- config_paths: ${result.config_paths.join(", ")}`] : [],
50060
+ `- registration_count: ${result.registration_count}`,
50061
+ ..."action" in result ? [`- action: ${result.action}`, `- changed: ${result.changed}`] : [],
50062
+ ..."backup_path" in result && result.backup_path ? [`- backup_path: ${result.backup_path}`] : [],
50063
+ ""
50064
+ ].join("\n")
50065
+ );
50066
+ }
48848
50067
  function parseArgs(argv) {
48849
50068
  const command = [];
48850
50069
  const positionals = [];
@@ -48892,7 +50111,7 @@ function toOptionKey(value) {
48892
50111
  }
48893
50112
  async function runInit(parsed, ctx) {
48894
50113
  rejectPackageOption(parsed);
48895
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50114
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
48896
50115
  const env = makerEnvOption(parsed);
48897
50116
  const skipConfirm = booleanOption(parsed, "skip_confirm");
48898
50117
  const skipMcpInstall = booleanOption(parsed, "skip_mcp_install");
@@ -49007,7 +50226,7 @@ async function runInit(parsed, ctx) {
49007
50226
  }
49008
50227
  async function runDoctor(parsed, ctx) {
49009
50228
  var _a3, _b;
49010
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50229
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49011
50230
  const env = makerEnvOption(parsed);
49012
50231
  const git = checkGitEnvironment();
49013
50232
  const python = checkMakerPythonEnvironment();
@@ -49098,8 +50317,8 @@ async function runDoctor(parsed, ctx) {
49098
50317
  );
49099
50318
  }
49100
50319
  function inspectMakerDoctorExecutionContext(options) {
49101
- const doctorCwd = path22.resolve(process.cwd());
49102
- const makerProjectDir = options.makerProjectDir ? path22.resolve(options.makerProjectDir) : void 0;
50320
+ const doctorCwd = path26.resolve(process.cwd());
50321
+ const makerProjectDir = options.makerProjectDir ? path26.resolve(options.makerProjectDir) : void 0;
49103
50322
  if (!makerProjectDir) {
49104
50323
  return {
49105
50324
  active_client_session: "not_checked",
@@ -49134,9 +50353,9 @@ function samePath2(left, right) {
49134
50353
  return normalizePathForCompare3(left) === normalizePathForCompare3(right);
49135
50354
  }
49136
50355
  function normalizePathForCompare3(value) {
49137
- const resolved = path22.resolve(value);
50356
+ const resolved = path26.resolve(value);
49138
50357
  try {
49139
- return fs21.realpathSync.native(resolved);
50358
+ return fs25.realpathSync.native(resolved);
49140
50359
  } catch {
49141
50360
  return resolved;
49142
50361
  }
@@ -49454,7 +50673,7 @@ async function runPatSet(parsed, ctx) {
49454
50673
  }
49455
50674
  async function resolvePatSet(parsed, ctx) {
49456
50675
  if (booleanOption(parsed, "pat_stdin") || booleanOption(parsed, "pat_from_stdin")) {
49457
- const pat = fs21.readFileSync(0, "utf8").trim();
50676
+ const pat = fs25.readFileSync(0, "utf8").trim();
49458
50677
  if (!pat) {
49459
50678
  throw new Error("No PAT found on stdin.");
49460
50679
  }
@@ -49509,17 +50728,17 @@ async function prepareMcpLauncher(options) {
49509
50728
  if (options.mode === "self") {
49510
50729
  launcher = materializeMakerSelfLauncher({
49511
50730
  version: VERSION2,
49512
- bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(path22.resolve(process.cwd(), "dist", "maker.js")).href,
50731
+ bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : pathToFileURL(path26.resolve(process.cwd(), "dist", "maker.js")).href,
49513
50732
  makerHome: getMakerHome()
49514
50733
  });
49515
50734
  } else {
49516
50735
  const packageSpec = resolveMakerPackageSpec(MAKER_NPM_PACKAGE, VERSION2);
49517
50736
  launcher = resolveMakerMcpLauncher({ packageName: packageSpec });
49518
50737
  const configuredCache = process.env.npm_config_cache || process.env.NPM_CONFIG_CACHE;
49519
- const npmCacheDir = path22.resolve(
49520
- configuredCache || path22.join(getMakerHome(), "cache", "npm")
50738
+ const npmCacheDir = path26.resolve(
50739
+ configuredCache || path26.join(getMakerHome(), "cache", "npm")
49521
50740
  );
49522
- fs21.mkdirSync(npmCacheDir, { recursive: true });
50741
+ fs25.mkdirSync(npmCacheDir, { recursive: true });
49523
50742
  launcherEnv = { npm_config_cache: npmCacheDir };
49524
50743
  }
49525
50744
  } catch (error2) {
@@ -49652,14 +50871,37 @@ ${indent3(payload.stderr)}` : "",
49652
50871
  }
49653
50872
  async function runMcpReport(parsed, ctx) {
49654
50873
  rejectPackageOption(parsed);
49655
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50874
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49656
50875
  const contextInput = booleanOption(parsed, "context_stdin") ? await readStdinText() : "";
49657
50876
  const context = parseMakerMcpReportContext(contextInput);
50877
+ const reportRuntime = resolveMakerMcpReportRuntime({
50878
+ distribution: process.env.TAPTAP_MAKER_DISTRIBUTION,
50879
+ bundleUrl: typeof __MAKER_BUNDLE_URL__ !== "undefined" ? __MAKER_BUNDLE_URL__ : void 0
50880
+ });
49658
50881
  const diagnostics = await collectMakerMcpIssueDiagnostics({
49659
- ide: stringOption(parsed, "ide"),
50882
+ ide: stringOption(parsed, "ide") || (reportRuntime == null ? void 0 : reportRuntime.client),
49660
50883
  targetDir,
49661
50884
  makerVersion: VERSION2,
50885
+ configSource: reportRuntime == null ? void 0 : reportRuntime.config_source,
50886
+ distribution: reportRuntime == null ? void 0 : reportRuntime.distribution,
49662
50887
  verify: async () => {
50888
+ if (reportRuntime) {
50889
+ const verification = await verifyMakerMcpLauncher(reportRuntime.launcher, {
50890
+ cwd: reportRuntime.cwd,
50891
+ env: reportRuntime.env,
50892
+ timeoutMs: 15e3
50893
+ });
50894
+ return {
50895
+ ok: verification.ok,
50896
+ stage: verification.stage,
50897
+ launcher_kind: verification.launcherKind,
50898
+ command: verification.command,
50899
+ tools: verification.toolNames,
50900
+ stderr: verification.stderr,
50901
+ error: verification.error,
50902
+ failure_type: verification.failureType
50903
+ };
50904
+ }
49663
50905
  const prepared = await prepareMcpLauncher({
49664
50906
  env: makerEnvOption(parsed),
49665
50907
  mode: "self"
@@ -49682,7 +50924,7 @@ async function runMcpReport(parsed, ctx) {
49682
50924
  const issue3 = buildMakerMcpIssue({
49683
50925
  context,
49684
50926
  diagnostics,
49685
- homeDir: os6.homedir()
50927
+ homeDir: os8.homedir()
49686
50928
  });
49687
50929
  const submission = booleanOption(parsed, "consent") ? submitMakerMcpIssue(issue3) : {
49688
50930
  status: "consent_required",
@@ -49709,7 +50951,7 @@ async function runMcpReport(parsed, ctx) {
49709
50951
  );
49710
50952
  }
49711
50953
  async function runAgentsUpdate(parsed, ctx) {
49712
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
50954
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49713
50955
  const result = updateMakerAgentsPolicy(targetDir);
49714
50956
  if (ctx.json) {
49715
50957
  writeJson(result);
@@ -49728,21 +50970,25 @@ async function runAgentsUpdate(parsed, ctx) {
49728
50970
  async function runUpgrade(parsed, ctx) {
49729
50971
  rejectPackageOption(parsed);
49730
50972
  const explicitTargetDir = stringOption(parsed, "target_dir");
49731
- const targetDir = path22.resolve(explicitTargetDir || process.cwd());
50973
+ const targetDir = path26.resolve(explicitTargetDir || process.cwd());
49732
50974
  const env = makerEnvOption(parsed);
49733
50975
  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;
50976
+ const pluginDistribution = resolveMakerPluginDistribution();
50977
+ let installResults = [];
50978
+ if (!pluginDistribution) {
50979
+ const prepared = await prepareMcpLauncher({ env, mode: mcpLauncherOption(parsed) });
50980
+ if (!prepared.ok) {
50981
+ writeMcpLauncherFailure(ctx, prepared);
50982
+ return;
50983
+ }
50984
+ installResults = installMcpConfigs({
50985
+ ides: ides.length > 0 ? ides : getDefaultMcpInstallIdes(),
50986
+ env: makerMcpConfigEnvOption(parsed),
50987
+ mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
50988
+ launcher: prepared.launcher,
50989
+ launcherEnv: prepared.launcherEnv
50990
+ });
49738
50991
  }
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
50992
  const identify = identifyMakerProject({ cwd: targetDir });
49747
50993
  const agentsResult = identify.projectRoot ? updateMakerAgentsPolicy(identify.projectRoot) : void 0;
49748
50994
  const payload = {
@@ -49753,7 +50999,8 @@ async function runUpgrade(parsed, ctx) {
49753
50999
  agents_policy: agentsResult,
49754
51000
  restart_required: false,
49755
51001
  apply_mode: "next_mcp_start",
49756
- current_session: "preserved"
51002
+ current_session: "preserved",
51003
+ plugin_distribution: pluginDistribution == null ? void 0 : pluginDistribution.id
49757
51004
  };
49758
51005
  if (!payload.ok) {
49759
51006
  process.exitCode = 1;
@@ -49764,9 +51011,9 @@ async function runUpgrade(parsed, ctx) {
49764
51011
  }
49765
51012
  process.stdout.write(
49766
51013
  [
49767
- payload.ok ? "TapTap Maker upgrade completed" : "TapTap Maker upgrade completed with errors",
51014
+ pluginDistribution ? "TapTap Maker project policy update completed" : payload.ok ? "TapTap Maker upgrade completed" : "TapTap Maker upgrade completed with errors",
49768
51015
  "",
49769
- ...installResults.map((result) => result.message),
51016
+ ...pluginDistribution ? [`✓ Standalone MCP registration unchanged (${pluginDistribution.displayName} plugin)`] : installResults.map((result) => result.message),
49770
51017
  "",
49771
51018
  agentsResult ? [
49772
51019
  agentsResult.changed ? "✓ AGENTS.md managed policy updated" : "✓ AGENTS.md managed policy current",
@@ -49774,8 +51021,8 @@ async function runUpgrade(parsed, ctx) {
49774
51021
  `- previous_status: ${agentsResult.previousStatus}`
49775
51022
  ].join("\n") : "AGENTS.md managed policy skipped: current directory is not bound to a Maker project.",
49776
51023
  "",
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.",
51024
+ pluginDistribution ? formatMakerPluginUpdateAction(pluginDistribution) : "Current MCP session remains unchanged and continues using the existing version.",
51025
+ 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
51026
  ""
49780
51027
  ].join("\n")
49781
51028
  );
@@ -49812,19 +51059,20 @@ function getMcpVerifyNextSteps(mode, commandText) {
49812
51059
  ];
49813
51060
  }
49814
51061
  async function runDevKitUpdate(parsed, ctx) {
49815
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
51062
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49816
51063
  const result = await installAiDevKit({
49817
51064
  targetDir,
49818
51065
  preserveExisting: false,
49819
51066
  replaceManagedEntries: true,
49820
51067
  environment: makerEnvOption(parsed)
49821
51068
  });
51069
+ syncWorkBuddyDevKitSkills(targetDir, ctx);
49822
51070
  finalizeStagedDevKitGitignore(targetDir);
49823
51071
  emit(ctx, "dev_kit", formatDevKitInstallMessage("AI dev kit updated", result), result);
49824
51072
  emitDevKitSkillInstallerFailure(ctx, result.skillInstaller, "AI skills install failed");
49825
51073
  }
49826
51074
  async function runLogsWatch(parsed, ctx) {
49827
- const targetDir = path22.resolve(stringOption(parsed, "target_dir") || process.cwd());
51075
+ const targetDir = path26.resolve(stringOption(parsed, "target_dir") || process.cwd());
49828
51076
  const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
49829
51077
  const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
49830
51078
  const maxPolls = numberOption(parsed, "max_polls");
@@ -49834,9 +51082,9 @@ async function runLogsWatch(parsed, ctx) {
49834
51082
  serverUrl: stringOption(parsed, "server_url"),
49835
51083
  env: makerEnvOption(parsed)
49836
51084
  });
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");
51085
+ const runtimeDir = path26.join(proxy.projectRoot, ".maker", "logs", "runtime");
51086
+ const runtimeLog = path26.join(runtimeDir, "runtime.log");
51087
+ const pidFile = path26.join(runtimeDir, "watcher.pid");
49840
51088
  const replacedWatcher = registerRuntimeLogWatcherProcess(pidFile);
49841
51089
  const runtimeLogClient = createRemoteRuntimeLogClient(proxy, timeoutMs);
49842
51090
  emit(ctx, "logs_watch_start", "Maker runtime log watcher started", {
@@ -49881,10 +51129,10 @@ async function runLogsWatch(parsed, ctx) {
49881
51129
  }
49882
51130
  }
49883
51131
  function registerRuntimeLogWatcherProcess(pidFile) {
49884
- fs21.mkdirSync(path22.dirname(pidFile), { recursive: true });
51132
+ fs25.mkdirSync(path26.dirname(pidFile), { recursive: true });
49885
51133
  const existingPid = readPidFile(pidFile);
49886
51134
  const previous = existingPid && existingPid !== process.pid ? stopExistingRuntimeLogWatcher(pidFile) : {};
49887
- fs21.writeFileSync(
51135
+ fs25.writeFileSync(
49888
51136
  pidFile,
49889
51137
  `${JSON.stringify(
49890
51138
  {
@@ -49902,10 +51150,10 @@ function registerRuntimeLogWatcherProcess(pidFile) {
49902
51150
  return previous;
49903
51151
  }
49904
51152
  function readPidFile(pidFile) {
49905
- if (!fs21.existsSync(pidFile)) {
51153
+ if (!fs25.existsSync(pidFile)) {
49906
51154
  return void 0;
49907
51155
  }
49908
- const raw = fs21.readFileSync(pidFile, "utf8").trim();
51156
+ const raw = fs25.readFileSync(pidFile, "utf8").trim();
49909
51157
  let pid = Number(raw);
49910
51158
  if (!Number.isInteger(pid) || pid <= 0) {
49911
51159
  try {
@@ -49925,7 +51173,7 @@ function installRuntimeLogWatcherPidCleanup(pidFile) {
49925
51173
  }
49926
51174
  cleaned = true;
49927
51175
  if (readPidFile(pidFile) === process.pid) {
49928
- fs21.rmSync(pidFile, { force: true });
51176
+ fs25.rmSync(pidFile, { force: true });
49929
51177
  }
49930
51178
  };
49931
51179
  process.once("exit", cleanup);
@@ -50076,9 +51324,10 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
50076
51324
  onStart: (event) => emitSkillInstallerStart(ctx, event)
50077
51325
  });
50078
51326
  writeDevKitStagedGitignore(
50079
- path22.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
51327
+ path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
50080
51328
  listPresentDevKitManagedEntries(targetDir)
50081
51329
  );
51330
+ syncWorkBuddyDevKitSkills(targetDir, ctx);
50082
51331
  if (options.finalizeGitignore) {
50083
51332
  finalizeStagedDevKitGitignore(targetDir);
50084
51333
  }
@@ -50093,7 +51342,7 @@ async function prepareDevKit(targetDir, ctx, options = {}) {
50093
51342
  );
50094
51343
  } catch (error2) {
50095
51344
  writeDevKitStagedGitignore(
50096
- path22.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
51345
+ path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE),
50097
51346
  listPresentDevKitManagedEntries(targetDir)
50098
51347
  );
50099
51348
  if (options.finalizeGitignore) {
@@ -50114,6 +51363,7 @@ ${detail}`, {
50114
51363
  environment: options.environment,
50115
51364
  onSkillInstallerStart: (event) => emitSkillInstallerStart(ctx, event)
50116
51365
  });
51366
+ syncWorkBuddyDevKitSkills(targetDir, ctx);
50117
51367
  if (options.finalizeGitignore) {
50118
51368
  finalizeStagedDevKitGitignore(targetDir);
50119
51369
  }
@@ -50131,6 +51381,38 @@ ${detail}`, {
50131
51381
  });
50132
51382
  }
50133
51383
  }
51384
+ function syncWorkBuddyDevKitSkills(targetDir, ctx) {
51385
+ var _a3;
51386
+ if (((_a3 = resolveMakerPluginDistribution()) == null ? void 0 : _a3.client) !== "workbuddy") {
51387
+ return;
51388
+ }
51389
+ try {
51390
+ const result = syncWorkBuddyProjectSkills(targetDir);
51391
+ const managedSkillPaths = [...result.installedSkills, ...result.skippedSkills].map(
51392
+ (skillName) => path26.join(".workbuddy", "skills", skillName)
51393
+ );
51394
+ if (managedSkillPaths.length > 0) {
51395
+ writeDevKitStagedGitignore(path26.join(targetDir, DEV_KIT_GITIGNORE_STAGING_FILE), [
51396
+ ...listPresentDevKitManagedEntries(targetDir),
51397
+ ...managedSkillPaths
51398
+ ]);
51399
+ }
51400
+ if (result.installedSkills.length > 0) {
51401
+ emit(
51402
+ ctx,
51403
+ "dev_kit",
51404
+ `WorkBuddy project skills installed: ${result.installedSkills.length}`,
51405
+ result
51406
+ );
51407
+ }
51408
+ } catch (error2) {
51409
+ const detail = error2 instanceof Error ? error2.message : String(error2);
51410
+ emit(ctx, "dev_kit_warning", `WorkBuddy project skills install failed
51411
+ ${detail}`, {
51412
+ error: detail
51413
+ });
51414
+ }
51415
+ }
50134
51416
  function formatDevKitInstallMessage(message, result) {
50135
51417
  if (!result.skillInstaller) {
50136
51418
  return message;
@@ -50187,12 +51469,12 @@ function installMcpConfig(ide, options) {
50187
51469
  }
50188
51470
  function installMcpConfigUnsafe(ide, options) {
50189
51471
  if (ide === "codex") {
50190
- const configPath = path22.join(os6.homedir(), ".codex", "config.toml");
51472
+ const configPath = path26.join(os8.homedir(), ".codex", "config.toml");
50191
51473
  const write = mergeCodexMcpConfig(configPath, withClientIde(options, "codex"));
50192
51474
  return [createMcpInstallResult(ide, "Codex", configPath, write)];
50193
51475
  }
50194
51476
  if (ide === "cursor") {
50195
- const configPath = path22.join(os6.homedir(), ".cursor", "mcp.json");
51477
+ const configPath = path26.join(os8.homedir(), ".cursor", "mcp.json");
50196
51478
  const write = mergeJsonMcpConfig(configPath, withClientIde(options, "cursor"));
50197
51479
  return [createMcpInstallResult(ide, "Cursor", configPath, write)];
50198
51480
  }
@@ -50209,7 +51491,7 @@ function installMcpConfigUnsafe(ide, options) {
50209
51491
  }
50210
51492
  ];
50211
51493
  }
50212
- const configPath = path22.join(os6.homedir(), ".claude.json");
51494
+ const configPath = path26.join(os8.homedir(), ".claude.json");
50213
51495
  const write = mergeJsonMcpConfig(configPath, claudeOptions);
50214
51496
  return [createMcpInstallResult(ide, "Claude fallback", configPath, write)];
50215
51497
  }
@@ -50223,7 +51505,7 @@ function installMcpConfigUnsafe(ide, options) {
50223
51505
  }
50224
51506
  if (ide === "opencode") {
50225
51507
  const configPath = getOpenCodeMcpConfigPath();
50226
- if (!fs21.existsSync(configPath)) {
51508
+ if (!fs25.existsSync(configPath)) {
50227
51509
  return [{ ide, ok: false, message: "Skipped OpenCode: no supported config file found" }];
50228
51510
  }
50229
51511
  const write = mergeOpenCodeMcpConfig(configPath, withClientIde(options, "opencode"));
@@ -50306,13 +51588,13 @@ function getDefaultMcpInstallIdes() {
50306
51588
  if (getTraeMcpInstallPaths().length > 0) {
50307
51589
  ides.push("trae");
50308
51590
  }
50309
- if (fs21.existsSync(getOpenCodeMcpConfigPath())) {
51591
+ if (fs25.existsSync(getOpenCodeMcpConfigPath())) {
50310
51592
  ides.push("opencode");
50311
51593
  }
50312
51594
  if (getWorkBuddyMcpInstallPaths().length > 0) {
50313
51595
  ides.push("workbuddy");
50314
51596
  }
50315
- if (fs21.existsSync(getDshHome())) {
51597
+ if (fs25.existsSync(getDshHome())) {
50316
51598
  ides.push("dsh");
50317
51599
  }
50318
51600
  return ides;
@@ -50326,7 +51608,7 @@ function getExistingTraeUserConfigPaths(paths) {
50326
51608
  const seen = /* @__PURE__ */ new Set();
50327
51609
  return paths.filter((configPath) => {
50328
51610
  const key = normalizeConfigPathKey(configPath);
50329
- if (seen.has(key) || !fs21.existsSync(path22.dirname(configPath))) {
51611
+ if (seen.has(key) || !fs25.existsSync(path26.dirname(configPath))) {
50330
51612
  return false;
50331
51613
  }
50332
51614
  seen.add(key);
@@ -50337,7 +51619,7 @@ function getExistingConfigPaths(paths) {
50337
51619
  const seen = /* @__PURE__ */ new Set();
50338
51620
  return paths.filter((configPath) => {
50339
51621
  const key = normalizeConfigPathKey(configPath);
50340
- if (seen.has(key) || !fs21.existsSync(configPath)) {
51622
+ if (seen.has(key) || !fs25.existsSync(configPath)) {
50341
51623
  return false;
50342
51624
  }
50343
51625
  seen.add(key);
@@ -50345,62 +51627,62 @@ function getExistingConfigPaths(paths) {
50345
51627
  });
50346
51628
  }
50347
51629
  function normalizeConfigPathKey(configPath) {
50348
- const resolved = path22.resolve(configPath);
51630
+ const resolved = path26.resolve(configPath);
50349
51631
  return process.platform === "win32" || process.platform === "darwin" ? resolved.toLowerCase() : resolved;
50350
51632
  }
50351
51633
  function getTraeSoloMcpConfigPaths() {
50352
51634
  if (process.platform === "win32") {
50353
- const roaming = process.env.APPDATA || path22.join(os6.homedir(), "AppData", "Roaming");
51635
+ const roaming = process.env.APPDATA || path26.join(os8.homedir(), "AppData", "Roaming");
50354
51636
  return [
50355
- path22.join(roaming, "TRAE SOLO", "User", "mcp.json"),
50356
- path22.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
51637
+ path26.join(roaming, "TRAE SOLO", "User", "mcp.json"),
51638
+ path26.join(roaming, "TRAE SOLO CN", "User", "mcp.json")
50357
51639
  ];
50358
51640
  }
50359
- const appSupport = path22.join(os6.homedir(), "Library", "Application Support");
51641
+ const appSupport = path26.join(os8.homedir(), "Library", "Application Support");
50360
51642
  return [
50361
- path22.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
50362
- path22.join(appSupport, "TRAE SOLO", "User", "mcp.json")
51643
+ path26.join(appSupport, "TRAE SOLO CN", "User", "mcp.json"),
51644
+ path26.join(appSupport, "TRAE SOLO", "User", "mcp.json")
50363
51645
  ];
50364
51646
  }
50365
51647
  function getTraeUnverifiedMcpConfigPaths() {
50366
51648
  if (process.platform === "win32") {
50367
- const roaming = process.env.APPDATA || path22.join(os6.homedir(), "AppData", "Roaming");
51649
+ const roaming = process.env.APPDATA || path26.join(os8.homedir(), "AppData", "Roaming");
50368
51650
  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")
51651
+ path26.join(roaming, "Trae", "User", "mcp.json"),
51652
+ path26.join(roaming, "TRAE", "User", "mcp.json"),
51653
+ path26.join(roaming, "Trae CN", "User", "mcp.json")
50372
51654
  ];
50373
51655
  }
50374
- const appSupport = path22.join(os6.homedir(), "Library", "Application Support");
51656
+ const appSupport = path26.join(os8.homedir(), "Library", "Application Support");
50375
51657
  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")
51658
+ path26.join(appSupport, "Trae", "User", "mcp.json"),
51659
+ path26.join(appSupport, "TRAE", "User", "mcp.json"),
51660
+ path26.join(appSupport, "Trae CN", "User", "mcp.json")
50379
51661
  ];
50380
51662
  }
50381
51663
  function getOpenCodeMcpConfigPath() {
50382
- return path22.join(os6.homedir(), ".config", "opencode", "opencode.jsonc");
51664
+ return path26.join(os8.homedir(), ".config", "opencode", "opencode.jsonc");
50383
51665
  }
50384
51666
  function getWorkBuddyHome() {
50385
- return path22.join(os6.homedir(), ".workbuddy");
51667
+ return path26.join(os8.homedir(), ".workbuddy");
50386
51668
  }
50387
51669
  function getWorkBuddyMcpInstallPaths(options = {}) {
50388
- const primary = path22.join(getWorkBuddyHome(), "mcp.json");
50389
- if (fs21.existsSync(primary) || options.createPrimary) {
51670
+ const primary = path26.join(getWorkBuddyHome(), "mcp.json");
51671
+ if (fs25.existsSync(primary) || options.createPrimary) {
50390
51672
  return [primary];
50391
51673
  }
50392
- const legacy = path22.join(getWorkBuddyHome(), ".mcp.json");
50393
- if (fs21.existsSync(legacy)) {
51674
+ const legacy = path26.join(getWorkBuddyHome(), ".mcp.json");
51675
+ if (fs25.existsSync(legacy)) {
50394
51676
  return [legacy];
50395
51677
  }
50396
51678
  return [];
50397
51679
  }
50398
51680
  function inspectWorkBuddyTrustState(mcpName) {
50399
51681
  const workbuddyHome = getWorkBuddyHome();
50400
- const connectorsDir = path22.join(workbuddyHome, "connectors");
51682
+ const connectorsDir = path26.join(workbuddyHome, "connectors");
50401
51683
  const accounts = [];
50402
51684
  const stateFiles = [];
50403
- if (!fs21.existsSync(connectorsDir)) {
51685
+ if (!fs25.existsSync(connectorsDir)) {
50404
51686
  return {
50405
51687
  status: "not_found",
50406
51688
  mcp_name: mcpName,
@@ -50410,12 +51692,12 @@ function inspectWorkBuddyTrustState(mcpName) {
50410
51692
  accounts
50411
51693
  };
50412
51694
  }
50413
- for (const entry of fs21.readdirSync(connectorsDir, { withFileTypes: true })) {
51695
+ for (const entry of fs25.readdirSync(connectorsDir, { withFileTypes: true })) {
50414
51696
  if (!entry.isDirectory()) {
50415
51697
  continue;
50416
51698
  }
50417
- const statePath = path22.join(connectorsDir, entry.name, "connector-states.json");
50418
- if (!fs21.existsSync(statePath)) {
51699
+ const statePath = path26.join(connectorsDir, entry.name, "connector-states.json");
51700
+ if (!fs25.existsSync(statePath)) {
50419
51701
  continue;
50420
51702
  }
50421
51703
  stateFiles.push(statePath);
@@ -50494,7 +51776,7 @@ function mergeJsonMcpConfig(configPath, options) {
50494
51776
  );
50495
51777
  }
50496
51778
  function mergeOpenCodeMcpConfig(configPath, options) {
50497
- const rawContent = fs21.readFileSync(configPath, "utf8");
51779
+ const rawContent = fs25.readFileSync(configPath, "utf8");
50498
51780
  const rewroteJsonc = normalizeJsonConfigContent(rawContent, { jsonc: true }) !== rawContent;
50499
51781
  const existing = readJsonObject(configPath, { jsonc: true });
50500
51782
  const mcp = asObject(existing.mcp);
@@ -50526,20 +51808,21 @@ function mergeOpenCodeMcpConfig(configPath, options) {
50526
51808
  return { ...write, rewroteJsonc: write.changed && rewroteJsonc };
50527
51809
  }
50528
51810
  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();
51811
+ const existing = fs25.existsSync(configPath) ? fs25.readFileSync(configPath, "utf8") : "";
51812
+ const withoutOld = removeCodexMcpTables(existing, options.mcpName).trimEnd();
50532
51813
  const launch = options.launcher;
50533
51814
  const envValues = createMcpEnvironmentValues(options.env, options.clientIde, options.launcherEnv);
50534
51815
  const envSection = Object.keys(envValues).length === 0 ? [] : [
50535
51816
  "",
50536
51817
  `[mcp_servers."${options.mcpName}".env]`,
50537
- ...Object.entries(envValues).map(([key, value]) => `${key} = "${escapeToml(value)}"`)
51818
+ ...Object.entries(envValues).map(
51819
+ ([key, value]) => `${key} = "${escapeTomlString(value)}"`
51820
+ )
50538
51821
  ];
50539
51822
  const section = [
50540
51823
  `[mcp_servers."${options.mcpName}"]`,
50541
- `command = "${escapeToml(launch.command)}"`,
50542
- `args = [${launch.args.map((arg) => `"${escapeToml(arg)}"`).join(", ")}]`,
51824
+ `command = "${escapeTomlString(launch.command)}"`,
51825
+ `args = [${launch.args.map((arg) => `"${escapeTomlString(arg)}"`).join(", ")}]`,
50543
51826
  ...envSection,
50544
51827
  ""
50545
51828
  ].join("\n");
@@ -50558,48 +51841,8 @@ function mergeCodexMcpConfig(configPath, options) {
50558
51841
  }
50559
51842
  );
50560
51843
  }
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
51844
  function tryClaudeMcpAdd(options) {
50602
- const configPath = path22.join(os6.homedir(), ".claude.json");
51845
+ const configPath = path26.join(os8.homedir(), ".claude.json");
50603
51846
  try {
50604
51847
  const existing = readJsonObject(configPath);
50605
51848
  const server = asObject(asObject(existing.mcpServers)[options.mcpName]);
@@ -50692,10 +51935,10 @@ function rejectPackageOption(parsed) {
50692
51935
  }
50693
51936
  }
50694
51937
  function readJsonObject(filePath, options = {}) {
50695
- if (!fs21.existsSync(filePath)) {
51938
+ if (!fs25.existsSync(filePath)) {
50696
51939
  return {};
50697
51940
  }
50698
- const raw = fs21.readFileSync(filePath, "utf8");
51941
+ const raw = fs25.readFileSync(filePath, "utf8");
50699
51942
  try {
50700
51943
  const normalized = normalizeJsonConfigContent(raw, options);
50701
51944
  const parsed = JSON.parse(normalized);
@@ -50714,30 +51957,6 @@ function asObject(value) {
50714
51957
  }
50715
51958
  return {};
50716
51959
  }
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
51960
  function validateJsonMcpServersConfig(content, options) {
50742
51961
  const parsed = parseGeneratedJsonObject(content);
50743
51962
  const server = asObject(asObject(parsed.mcpServers)[options.mcpName]);
@@ -50891,10 +52110,10 @@ function formatMcpInstallMessage(label, configPath, write) {
50891
52110
  ].filter(Boolean).join("\n");
50892
52111
  }
50893
52112
  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`),
52113
+ fs25.mkdirSync(getMakerHome(), { recursive: true });
52114
+ const key = crypto5.createHash("sha256").update(path26.resolve(targetDir)).digest("hex").slice(0, 16);
52115
+ fs25.writeFileSync(
52116
+ path26.join(getMakerHome(), `init-state-${key}.json`),
50898
52117
  `${JSON.stringify({ ...state, updated_at: (/* @__PURE__ */ new Date()).toISOString() }, null, 2)}
50899
52118
  `,
50900
52119
  "utf8"
@@ -51042,7 +52261,7 @@ function makerEnvOption(parsed) {
51042
52261
  return env;
51043
52262
  }
51044
52263
  const targetDir = stringOption(parsed, "target_dir");
51045
- return getMakerEnvironment(void 0, targetDir ? path22.resolve(targetDir) : process.cwd());
52264
+ return getMakerEnvironment(void 0, targetDir ? path26.resolve(targetDir) : process.cwd());
51046
52265
  }
51047
52266
  function makerMcpConfigEnvOption(parsed) {
51048
52267
  return stringOption(parsed, "env") === "rnd" ? "rnd" : "production";
@@ -51073,15 +52292,6 @@ function mask(value) {
51073
52292
  }
51074
52293
  return `${value.slice(0, 6)}...${value.slice(-4)}`;
51075
52294
  }
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
52295
  function indent3(value) {
51086
52296
  return value.split("\n").map((line) => ` ${line}`).join("\n");
51087
52297
  }
@@ -51123,6 +52333,9 @@ function printHelp() {
51123
52333
  " [--context-stdin] [--consent] [--json]",
51124
52334
  " # Run only after the user agrees to submit",
51125
52335
  " taptap-maker agents update [--target-dir DIR] [--json]",
52336
+ " taptap-maker plugin inspect --client codex|workbuddy|dsh [--json]",
52337
+ " taptap-maker plugin migrate --client codex|workbuddy|dsh --confirm [--json]",
52338
+ " taptap-maker plugin restore --client codex|workbuddy|dsh --confirm [--json]",
51126
52339
  " taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
51127
52340
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
51128
52341
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",
@@ -51192,13 +52405,13 @@ function createFetchWithInit(baseFetch = fetch, baseInit) {
51192
52405
  }
51193
52406
 
51194
52407
  // node_modules/pkce-challenge/dist/index.node.js
51195
- var crypto4;
52408
+ var crypto6;
51196
52409
  var _a2;
51197
- crypto4 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
52410
+ crypto6 = ((_a2 = globalThis.crypto) == null ? void 0 : _a2.webcrypto) ?? // Node.js [18-16] REPL
51198
52411
  globalThis.crypto ?? // Node.js >18
51199
52412
  import("node:crypto").then((m) => m.webcrypto);
51200
52413
  async function getRandomValues(size) {
51201
- return (await crypto4).getRandomValues(new Uint8Array(size));
52414
+ return (await crypto6).getRandomValues(new Uint8Array(size));
51202
52415
  }
51203
52416
  async function random(size) {
51204
52417
  const mask2 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
@@ -51214,7 +52427,7 @@ async function generateVerifier(length) {
51214
52427
  return await random(length);
51215
52428
  }
51216
52429
  async function generateChallenge(code_verifier) {
51217
- const buffer = await (await crypto4).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
52430
+ const buffer = await (await crypto6).subtle.digest("SHA-256", new TextEncoder().encode(code_verifier));
51218
52431
  return btoa(String.fromCharCode(...new Uint8Array(buffer))).replace(/\//g, "_").replace(/\+/g, "-").replace(/=/g, "");
51219
52432
  }
51220
52433
  async function pkceChallenge(length) {
@@ -52569,8 +53782,8 @@ var StreamableHTTPClientTransport = class {
52569
53782
  };
52570
53783
 
52571
53784
  // src/mcp-proxy/proxy.ts
52572
- import * as path24 from "node:path";
52573
- import * as crypto6 from "node:crypto";
53785
+ import * as path28 from "node:path";
53786
+ import * as crypto8 from "node:crypto";
52574
53787
 
52575
53788
  // src/mcp-proxy/cookieJar.ts
52576
53789
  var CookieJar = class {
@@ -52751,9 +53964,9 @@ function createCookieFetch(cookieJar) {
52751
53964
  }
52752
53965
 
52753
53966
  // 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";
53967
+ import * as fs26 from "node:fs";
53968
+ import * as path27 from "node:path";
53969
+ import * as crypto7 from "node:crypto";
52757
53970
 
52758
53971
  // src/core/types/log.ts
52759
53972
  var LOG_LEVEL_PRIORITY = {
@@ -52793,7 +54006,7 @@ var LogWriter = class {
52793
54006
  return;
52794
54007
  }
52795
54008
  try {
52796
- await fs22.promises.mkdir(this.config.logDir, { recursive: true });
54009
+ await fs26.promises.mkdir(this.config.logDir, { recursive: true });
52797
54010
  await this.cleanupOldLogs();
52798
54011
  this.initialized = true;
52799
54012
  } catch (error2) {
@@ -52816,7 +54029,7 @@ var LogWriter = class {
52816
54029
  */
52817
54030
  getLogFilePath(date5) {
52818
54031
  const d = date5 || this.getCurrentDate();
52819
- return path23.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
54032
+ return path27.join(this.config.logDir, `${this.config.prefix}-${d}.log`);
52820
54033
  }
52821
54034
  /**
52822
54035
  * 获取或创建写入流
@@ -52831,7 +54044,7 @@ var LogWriter = class {
52831
54044
  }
52832
54045
  this.currentDate = date5;
52833
54046
  try {
52834
- this.writeStream = fs22.createWriteStream(this.getLogFilePath(date5), {
54047
+ this.writeStream = fs26.createWriteStream(this.getLogFilePath(date5), {
52835
54048
  flags: "a",
52836
54049
  encoding: "utf8"
52837
54050
  });
@@ -52883,11 +54096,11 @@ var LogWriter = class {
52883
54096
  if (this.shouldWriteToFile(level) && this.initialized && this.config.enabled) {
52884
54097
  try {
52885
54098
  const filePath = this.getLogFilePath();
52886
- const dir = path23.dirname(filePath);
52887
- if (!fs22.existsSync(dir)) {
52888
- fs22.mkdirSync(dir, { recursive: true });
54099
+ const dir = path27.dirname(filePath);
54100
+ if (!fs26.existsSync(dir)) {
54101
+ fs26.mkdirSync(dir, { recursive: true });
52889
54102
  }
52890
- fs22.appendFileSync(filePath, message, "utf8");
54103
+ fs26.appendFileSync(filePath, message, "utf8");
52891
54104
  } catch {
52892
54105
  }
52893
54106
  }
@@ -52898,7 +54111,7 @@ var LogWriter = class {
52898
54111
  async cleanupOldLogs() {
52899
54112
  if (this.config.maxDays <= 0) return;
52900
54113
  try {
52901
- const files = await fs22.promises.readdir(this.config.logDir);
54114
+ const files = await fs26.promises.readdir(this.config.logDir);
52902
54115
  const cutoffDate = /* @__PURE__ */ new Date();
52903
54116
  cutoffDate.setDate(cutoffDate.getDate() - this.config.maxDays);
52904
54117
  const prefix = this.config.prefix;
@@ -52913,7 +54126,7 @@ var LogWriter = class {
52913
54126
  if (!Number.isNaN(year) && !Number.isNaN(month) && !Number.isNaN(day)) {
52914
54127
  const fileDate = new Date(year, month - 1, day);
52915
54128
  if (fileDate < cutoffDate) {
52916
- await fs22.promises.unlink(path23.join(this.config.logDir, file2));
54129
+ await fs26.promises.unlink(path27.join(this.config.logDir, file2));
52917
54130
  process.stderr.write(`[LogWriter] Deleted old log: ${file2}
52918
54131
  `);
52919
54132
  }
@@ -52957,7 +54170,7 @@ function convertMcpApplicationErrorToToolResult(error2) {
52957
54170
  return void 0;
52958
54171
  }
52959
54172
  const data = error2.data;
52960
- if (!isRecord5(data) || !("remote_result" in data) || data.remote_result === void 0) {
54173
+ if (!isRecord7(data) || !("remote_result" in data) || data.remote_result === void 0) {
52961
54174
  return void 0;
52962
54175
  }
52963
54176
  return {
@@ -52974,7 +54187,7 @@ function convertMcpApplicationErrorToToolResult(error2) {
52974
54187
  ]
52975
54188
  };
52976
54189
  }
52977
- function isRecord5(value) {
54190
+ function isRecord7(value) {
52978
54191
  return typeof value === "object" && value !== null && !Array.isArray(value);
52979
54192
  }
52980
54193
  function formatProxyDiagnosticValue(value) {
@@ -53034,10 +54247,10 @@ var TapTapMCPProxy = class {
53034
54247
  const { user_id, project_id } = this.config.tenant;
53035
54248
  let logDir;
53036
54249
  if (user_id && project_id) {
53037
- logDir = path24.join(logRoot, "proxy", user_id, project_id);
54250
+ logDir = path28.join(logRoot, "proxy", user_id, project_id);
53038
54251
  } else {
53039
- const kidHash = crypto6.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
53040
- logDir = path24.join(logRoot, "proxy", kidHash);
54252
+ const kidHash = crypto8.createHash("sha256").update(this.config.auth.kid).digest("hex").substring(0, 8);
54253
+ logDir = path28.join(logRoot, "proxy", kidHash);
53041
54254
  }
53042
54255
  return new LogWriter({
53043
54256
  logDir,
@@ -53759,6 +54972,9 @@ function printHelp2() {
53759
54972
  " [--context-stdin] [--consent] [--json]",
53760
54973
  " # Run only after the user agrees to submit",
53761
54974
  " taptap-maker agents update [--target-dir DIR] [--json]",
54975
+ " taptap-maker plugin inspect --client codex|workbuddy [--json]",
54976
+ " taptap-maker plugin migrate --client codex|workbuddy --confirm [--json]",
54977
+ " taptap-maker plugin restore --client codex|workbuddy --confirm [--json]",
53762
54978
  " taptap-maker upgrade [--launcher self|npx] [--target-dir DIR] [--json]",
53763
54979
  " taptap-maker dev-kit update [--target-dir DIR] [--json]",
53764
54980
  " taptap-maker logs watch [--target-dir DIR] [--interval 5s] [--reset] [--json]",