@gethmy/mcp 2.3.1 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/lib/active-learning.js +939 -787
  2. package/dist/lib/api-client.js +2527 -644
  3. package/dist/lib/auto-session.js +177 -196
  4. package/dist/lib/cli.js +34954 -128
  5. package/dist/lib/config.js +235 -201
  6. package/dist/lib/consolidation.js +374 -289
  7. package/dist/lib/context-assembly.js +1265 -838
  8. package/dist/lib/graph-expansion.js +139 -155
  9. package/dist/lib/http.js +1917 -130
  10. package/dist/lib/index.js +29525 -5
  11. package/dist/lib/lifecycle-maintenance.js +663 -79
  12. package/dist/lib/memory-cleanup.js +1315 -409
  13. package/dist/lib/onboard.js +2588 -32
  14. package/dist/lib/prompt-builder.js +438 -445
  15. package/dist/lib/remote.js +31733 -143
  16. package/dist/lib/server.js +29388 -3229
  17. package/dist/lib/skills.js +315 -132
  18. package/dist/lib/tui/agents.js +128 -107
  19. package/dist/lib/tui/docs.js +1590 -687
  20. package/dist/lib/tui/setup.js +5698 -804
  21. package/dist/lib/tui/theme.js +183 -86
  22. package/dist/lib/tui/writer.js +1149 -176
  23. package/package.json +2 -2
  24. package/src/memory-cleanup.ts +2 -4
  25. package/dist/lib/__tests__/active-learning.test.js +0 -386
  26. package/dist/lib/__tests__/agent-performance-profiles.test.js +0 -325
  27. package/dist/lib/__tests__/auto-session.test.js +0 -661
  28. package/dist/lib/__tests__/context-assembly.test.js +0 -362
  29. package/dist/lib/__tests__/graph-expansion.test.js +0 -150
  30. package/dist/lib/__tests__/integration-memory-crud.test.js +0 -797
  31. package/dist/lib/__tests__/integration-memory-system.test.js +0 -281
  32. package/dist/lib/__tests__/lifecycle-maintenance.test.js +0 -207
  33. package/dist/lib/__tests__/pattern-detection.test.js +0 -295
  34. package/dist/lib/__tests__/prompt-builder.test.js +0 -418
@@ -1,200 +1,1173 @@
1
+ import { createRequire } from "node:module";
2
+ var __create = Object.create;
3
+ var __getProtoOf = Object.getPrototypeOf;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __toESM = (mod, isNodeMode, target) => {
8
+ target = mod != null ? __create(__getProtoOf(mod)) : {};
9
+ const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
+ for (let key of __getOwnPropNames(mod))
11
+ if (!__hasOwnProp.call(to, key))
12
+ __defProp(to, key, {
13
+ get: () => mod[key],
14
+ enumerable: true
15
+ });
16
+ return to;
17
+ };
18
+ var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, {
22
+ get: all[name],
23
+ enumerable: true,
24
+ configurable: true,
25
+ set: (newValue) => all[name] = () => newValue
26
+ });
27
+ };
28
+ var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
29
+ var __require = /* @__PURE__ */ createRequire(import.meta.url);
30
+
31
+ // ../../node_modules/picocolors/picocolors.js
32
+ var require_picocolors = __commonJS((exports, module) => {
33
+ var p = process || {};
34
+ var argv = p.argv || [];
35
+ var env = p.env || {};
36
+ var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
37
+ var formatter = (open, close, replace = open) => (input) => {
38
+ let string = "" + input, index = string.indexOf(close, open.length);
39
+ return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
40
+ };
41
+ var replaceClose = (string, close, replace, index) => {
42
+ let result = "", cursor = 0;
43
+ do {
44
+ result += string.substring(cursor, index) + replace;
45
+ cursor = index + close.length;
46
+ index = string.indexOf(close, cursor);
47
+ } while (~index);
48
+ return result + string.substring(cursor);
49
+ };
50
+ var createColors = (enabled = isColorSupported) => {
51
+ let f = enabled ? formatter : () => String;
52
+ return {
53
+ isColorSupported: enabled,
54
+ reset: f("\x1B[0m", "\x1B[0m"),
55
+ bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
56
+ dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
57
+ italic: f("\x1B[3m", "\x1B[23m"),
58
+ underline: f("\x1B[4m", "\x1B[24m"),
59
+ inverse: f("\x1B[7m", "\x1B[27m"),
60
+ hidden: f("\x1B[8m", "\x1B[28m"),
61
+ strikethrough: f("\x1B[9m", "\x1B[29m"),
62
+ black: f("\x1B[30m", "\x1B[39m"),
63
+ red: f("\x1B[31m", "\x1B[39m"),
64
+ green: f("\x1B[32m", "\x1B[39m"),
65
+ yellow: f("\x1B[33m", "\x1B[39m"),
66
+ blue: f("\x1B[34m", "\x1B[39m"),
67
+ magenta: f("\x1B[35m", "\x1B[39m"),
68
+ cyan: f("\x1B[36m", "\x1B[39m"),
69
+ white: f("\x1B[37m", "\x1B[39m"),
70
+ gray: f("\x1B[90m", "\x1B[39m"),
71
+ bgBlack: f("\x1B[40m", "\x1B[49m"),
72
+ bgRed: f("\x1B[41m", "\x1B[49m"),
73
+ bgGreen: f("\x1B[42m", "\x1B[49m"),
74
+ bgYellow: f("\x1B[43m", "\x1B[49m"),
75
+ bgBlue: f("\x1B[44m", "\x1B[49m"),
76
+ bgMagenta: f("\x1B[45m", "\x1B[49m"),
77
+ bgCyan: f("\x1B[46m", "\x1B[49m"),
78
+ bgWhite: f("\x1B[47m", "\x1B[49m"),
79
+ blackBright: f("\x1B[90m", "\x1B[39m"),
80
+ redBright: f("\x1B[91m", "\x1B[39m"),
81
+ greenBright: f("\x1B[92m", "\x1B[39m"),
82
+ yellowBright: f("\x1B[93m", "\x1B[39m"),
83
+ blueBright: f("\x1B[94m", "\x1B[39m"),
84
+ magentaBright: f("\x1B[95m", "\x1B[39m"),
85
+ cyanBright: f("\x1B[96m", "\x1B[39m"),
86
+ whiteBright: f("\x1B[97m", "\x1B[39m"),
87
+ bgBlackBright: f("\x1B[100m", "\x1B[49m"),
88
+ bgRedBright: f("\x1B[101m", "\x1B[49m"),
89
+ bgGreenBright: f("\x1B[102m", "\x1B[49m"),
90
+ bgYellowBright: f("\x1B[103m", "\x1B[49m"),
91
+ bgBlueBright: f("\x1B[104m", "\x1B[49m"),
92
+ bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
93
+ bgCyanBright: f("\x1B[106m", "\x1B[49m"),
94
+ bgWhiteBright: f("\x1B[107m", "\x1B[49m")
95
+ };
96
+ };
97
+ module.exports = createColors();
98
+ module.exports.createColors = createColors;
99
+ });
100
+
101
+ // ../../node_modules/sisteransi/src/index.js
102
+ var require_src = __commonJS((exports, module) => {
103
+ var ESC = "\x1B";
104
+ var CSI = `${ESC}[`;
105
+ var beep = "\x07";
106
+ var cursor = {
107
+ to(x, y) {
108
+ if (!y)
109
+ return `${CSI}${x + 1}G`;
110
+ return `${CSI}${y + 1};${x + 1}H`;
111
+ },
112
+ move(x, y) {
113
+ let ret = "";
114
+ if (x < 0)
115
+ ret += `${CSI}${-x}D`;
116
+ else if (x > 0)
117
+ ret += `${CSI}${x}C`;
118
+ if (y < 0)
119
+ ret += `${CSI}${-y}A`;
120
+ else if (y > 0)
121
+ ret += `${CSI}${y}B`;
122
+ return ret;
123
+ },
124
+ up: (count = 1) => `${CSI}${count}A`,
125
+ down: (count = 1) => `${CSI}${count}B`,
126
+ forward: (count = 1) => `${CSI}${count}C`,
127
+ backward: (count = 1) => `${CSI}${count}D`,
128
+ nextLine: (count = 1) => `${CSI}E`.repeat(count),
129
+ prevLine: (count = 1) => `${CSI}F`.repeat(count),
130
+ left: `${CSI}G`,
131
+ hide: `${CSI}?25l`,
132
+ show: `${CSI}?25h`,
133
+ save: `${ESC}7`,
134
+ restore: `${ESC}8`
135
+ };
136
+ var scroll = {
137
+ up: (count = 1) => `${CSI}S`.repeat(count),
138
+ down: (count = 1) => `${CSI}T`.repeat(count)
139
+ };
140
+ var erase = {
141
+ screen: `${CSI}2J`,
142
+ up: (count = 1) => `${CSI}1J`.repeat(count),
143
+ down: (count = 1) => `${CSI}J`.repeat(count),
144
+ line: `${CSI}2K`,
145
+ lineEnd: `${CSI}K`,
146
+ lineStart: `${CSI}1K`,
147
+ lines(count) {
148
+ let clear = "";
149
+ for (let i = 0;i < count; i++)
150
+ clear += this.line + (i < count - 1 ? cursor.up() : "");
151
+ if (count)
152
+ clear += cursor.left;
153
+ return clear;
154
+ }
155
+ };
156
+ module.exports = { cursor, scroll, erase, beep };
157
+ });
158
+
159
+ // src/tui/theme.ts
160
+ var pc = __toESM(require_picocolors(), 1);
161
+ var symbols = {
162
+ harmony: "▲",
163
+ check: "✓",
164
+ cross: "✗",
165
+ bullet: "•",
166
+ arrow: "→",
167
+ arrowRight: "▸",
168
+ dot: "●",
169
+ dotEmpty: "○",
170
+ info: "ℹ",
171
+ warning: "⚠",
172
+ pointer: "❯"
173
+ };
174
+ var colors = {
175
+ brand: (text) => pc.cyan(text),
176
+ brandBold: (text) => pc.bold(pc.cyan(text)),
177
+ success: (text) => pc.green(text),
178
+ error: (text) => pc.red(text),
179
+ warning: (text) => pc.yellow(text),
180
+ info: (text) => pc.blue(text),
181
+ dim: (text) => pc.dim(text),
182
+ bold: (text) => pc.bold(text),
183
+ muted: (text) => pc.gray(text),
184
+ highlight: (text) => pc.cyan(text),
185
+ link: (text) => pc.underline(pc.cyan(text))
186
+ };
187
+ var messages = {
188
+ header: () => {
189
+ return `
190
+ ${colors.brandBold(" HARMONY")}
191
+ ${colors.dim(" Project management for AI agents")}
192
+ `;
193
+ },
194
+ done: (message) => {
195
+ return `${colors.success(symbols.check)} ${message}`;
196
+ },
197
+ fail: (message) => {
198
+ return `${colors.error(symbols.cross)} ${message}`;
199
+ },
200
+ skip: (message) => {
201
+ return `${colors.dim("-")} ${colors.dim(message)}`;
202
+ },
203
+ step: (number, total, message) => {
204
+ return `${colors.dim(`[${number}/${total}]`)} ${message}`;
205
+ },
206
+ fileCreated: (path) => {
207
+ return ` ${colors.success(symbols.check)} ${colors.dim(path)}`;
208
+ },
209
+ fileSkipped: (path) => {
210
+ return ` ${colors.dim(symbols.bullet)} ${colors.dim(path)} ${colors.dim("(exists)")}`;
211
+ },
212
+ fileError: (path, error) => {
213
+ return ` ${colors.error(symbols.cross)} ${path}: ${colors.error(error)}`;
214
+ }
215
+ };
216
+ function box(title, content) {
217
+ const lines = content.split(`
218
+ `);
219
+ const maxWidth = Math.max(title.length, ...lines.map((l) => l.length));
220
+ const width = maxWidth + 4;
221
+ const top = `┌${"─".repeat(width)}┐`;
222
+ const bottom = `└${"─".repeat(width)}┘`;
223
+ const titleLine = `│ ${colors.bold(title)}${" ".repeat(width - title.length - 1)}│`;
224
+ const contentLines = lines.map((line) => `│ ${line}${" ".repeat(width - line.length - 1)}│`).join(`
225
+ `);
226
+ return `${top}
227
+ ${titleLine}
228
+ ${contentLines}
229
+ ${bottom}`;
230
+ }
231
+ function formatPath(path, homeDir) {
232
+ if (path.startsWith(homeDir)) {
233
+ return `~${path.slice(homeDir.length)}`;
234
+ }
235
+ return path;
236
+ }
237
+ function indent(text, spaces = 2) {
238
+ const pad = " ".repeat(spaces);
239
+ return text.split(`
240
+ `).map((line) => `${pad}${line}`).join(`
241
+ `);
242
+ }
243
+
244
+ // src/tui/writer.ts
1
245
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
246
  import { homedir } from "node:os";
3
247
  import { dirname } from "node:path";
4
- import * as p from "@clack/prompts";
5
- import { colors, formatPath, messages } from "./theme.js";
6
- /**
7
- * Ensure directory exists
8
- */
9
- function ensureDir(dirPath) {
10
- if (!existsSync(dirPath)) {
11
- mkdirSync(dirPath, { recursive: true, mode: 0o755 });
248
+
249
+ // ../../node_modules/@clack/core/dist/index.mjs
250
+ var import_sisteransi = __toESM(require_src(), 1);
251
+ var import_picocolors = __toESM(require_picocolors(), 1);
252
+ import { stdin as j, stdout as M } from "node:process";
253
+ import * as g from "node:readline";
254
+ import O from "node:readline";
255
+ import { Writable as X } from "node:stream";
256
+ function DD({ onlyFirst: e = false } = {}) {
257
+ const t = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
258
+ return new RegExp(t, e ? undefined : "g");
259
+ }
260
+ var uD = DD();
261
+ function P(e) {
262
+ if (typeof e != "string")
263
+ throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
264
+ return e.replace(uD, "");
265
+ }
266
+ function L(e) {
267
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
268
+ }
269
+ var W = { exports: {} };
270
+ (function(e) {
271
+ var u = {};
272
+ e.exports = u, u.eastAsianWidth = function(F) {
273
+ var s = F.charCodeAt(0), i = F.length == 2 ? F.charCodeAt(1) : 0, D = s;
274
+ return 55296 <= s && s <= 56319 && 56320 <= i && i <= 57343 && (s &= 1023, i &= 1023, D = s << 10 | i, D += 65536), D == 12288 || 65281 <= D && D <= 65376 || 65504 <= D && D <= 65510 ? "F" : D == 8361 || 65377 <= D && D <= 65470 || 65474 <= D && D <= 65479 || 65482 <= D && D <= 65487 || 65490 <= D && D <= 65495 || 65498 <= D && D <= 65500 || 65512 <= D && D <= 65518 ? "H" : 4352 <= D && D <= 4447 || 4515 <= D && D <= 4519 || 4602 <= D && D <= 4607 || 9001 <= D && D <= 9002 || 11904 <= D && D <= 11929 || 11931 <= D && D <= 12019 || 12032 <= D && D <= 12245 || 12272 <= D && D <= 12283 || 12289 <= D && D <= 12350 || 12353 <= D && D <= 12438 || 12441 <= D && D <= 12543 || 12549 <= D && D <= 12589 || 12593 <= D && D <= 12686 || 12688 <= D && D <= 12730 || 12736 <= D && D <= 12771 || 12784 <= D && D <= 12830 || 12832 <= D && D <= 12871 || 12880 <= D && D <= 13054 || 13056 <= D && D <= 19903 || 19968 <= D && D <= 42124 || 42128 <= D && D <= 42182 || 43360 <= D && D <= 43388 || 44032 <= D && D <= 55203 || 55216 <= D && D <= 55238 || 55243 <= D && D <= 55291 || 63744 <= D && D <= 64255 || 65040 <= D && D <= 65049 || 65072 <= D && D <= 65106 || 65108 <= D && D <= 65126 || 65128 <= D && D <= 65131 || 110592 <= D && D <= 110593 || 127488 <= D && D <= 127490 || 127504 <= D && D <= 127546 || 127552 <= D && D <= 127560 || 127568 <= D && D <= 127569 || 131072 <= D && D <= 194367 || 177984 <= D && D <= 196605 || 196608 <= D && D <= 262141 ? "W" : 32 <= D && D <= 126 || 162 <= D && D <= 163 || 165 <= D && D <= 166 || D == 172 || D == 175 || 10214 <= D && D <= 10221 || 10629 <= D && D <= 10630 ? "Na" : D == 161 || D == 164 || 167 <= D && D <= 168 || D == 170 || 173 <= D && D <= 174 || 176 <= D && D <= 180 || 182 <= D && D <= 186 || 188 <= D && D <= 191 || D == 198 || D == 208 || 215 <= D && D <= 216 || 222 <= D && D <= 225 || D == 230 || 232 <= D && D <= 234 || 236 <= D && D <= 237 || D == 240 || 242 <= D && D <= 243 || 247 <= D && D <= 250 || D == 252 || D == 254 || D == 257 || D == 273 || D == 275 || D == 283 || 294 <= D && D <= 295 || D == 299 || 305 <= D && D <= 307 || D == 312 || 319 <= D && D <= 322 || D == 324 || 328 <= D && D <= 331 || D == 333 || 338 <= D && D <= 339 || 358 <= D && D <= 359 || D == 363 || D == 462 || D == 464 || D == 466 || D == 468 || D == 470 || D == 472 || D == 474 || D == 476 || D == 593 || D == 609 || D == 708 || D == 711 || 713 <= D && D <= 715 || D == 717 || D == 720 || 728 <= D && D <= 731 || D == 733 || D == 735 || 768 <= D && D <= 879 || 913 <= D && D <= 929 || 931 <= D && D <= 937 || 945 <= D && D <= 961 || 963 <= D && D <= 969 || D == 1025 || 1040 <= D && D <= 1103 || D == 1105 || D == 8208 || 8211 <= D && D <= 8214 || 8216 <= D && D <= 8217 || 8220 <= D && D <= 8221 || 8224 <= D && D <= 8226 || 8228 <= D && D <= 8231 || D == 8240 || 8242 <= D && D <= 8243 || D == 8245 || D == 8251 || D == 8254 || D == 8308 || D == 8319 || 8321 <= D && D <= 8324 || D == 8364 || D == 8451 || D == 8453 || D == 8457 || D == 8467 || D == 8470 || 8481 <= D && D <= 8482 || D == 8486 || D == 8491 || 8531 <= D && D <= 8532 || 8539 <= D && D <= 8542 || 8544 <= D && D <= 8555 || 8560 <= D && D <= 8569 || D == 8585 || 8592 <= D && D <= 8601 || 8632 <= D && D <= 8633 || D == 8658 || D == 8660 || D == 8679 || D == 8704 || 8706 <= D && D <= 8707 || 8711 <= D && D <= 8712 || D == 8715 || D == 8719 || D == 8721 || D == 8725 || D == 8730 || 8733 <= D && D <= 8736 || D == 8739 || D == 8741 || 8743 <= D && D <= 8748 || D == 8750 || 8756 <= D && D <= 8759 || 8764 <= D && D <= 8765 || D == 8776 || D == 8780 || D == 8786 || 8800 <= D && D <= 8801 || 8804 <= D && D <= 8807 || 8810 <= D && D <= 8811 || 8814 <= D && D <= 8815 || 8834 <= D && D <= 8835 || 8838 <= D && D <= 8839 || D == 8853 || D == 8857 || D == 8869 || D == 8895 || D == 8978 || 9312 <= D && D <= 9449 || 9451 <= D && D <= 9547 || 9552 <= D && D <= 9587 || 9600 <= D && D <= 9615 || 9618 <= D && D <= 9621 || 9632 <= D && D <= 9633 || 9635 <= D && D <= 9641 || 9650 <= D && D <= 9651 || 9654 <= D && D <= 9655 || 9660 <= D && D <= 9661 || 9664 <= D && D <= 9665 || 9670 <= D && D <= 9672 || D == 9675 || 9678 <= D && D <= 9681 || 9698 <= D && D <= 9701 || D == 9711 || 9733 <= D && D <= 9734 || D == 9737 || 9742 <= D && D <= 9743 || 9748 <= D && D <= 9749 || D == 9756 || D == 9758 || D == 9792 || D == 9794 || 9824 <= D && D <= 9825 || 9827 <= D && D <= 9829 || 9831 <= D && D <= 9834 || 9836 <= D && D <= 9837 || D == 9839 || 9886 <= D && D <= 9887 || 9918 <= D && D <= 9919 || 9924 <= D && D <= 9933 || 9935 <= D && D <= 9953 || D == 9955 || 9960 <= D && D <= 9983 || D == 10045 || D == 10071 || 10102 <= D && D <= 10111 || 11093 <= D && D <= 11097 || 12872 <= D && D <= 12879 || 57344 <= D && D <= 63743 || 65024 <= D && D <= 65039 || D == 65533 || 127232 <= D && D <= 127242 || 127248 <= D && D <= 127277 || 127280 <= D && D <= 127337 || 127344 <= D && D <= 127386 || 917760 <= D && D <= 917999 || 983040 <= D && D <= 1048573 || 1048576 <= D && D <= 1114109 ? "A" : "N";
275
+ }, u.characterLength = function(F) {
276
+ var s = this.eastAsianWidth(F);
277
+ return s == "F" || s == "W" || s == "A" ? 2 : 1;
278
+ };
279
+ function t(F) {
280
+ return F.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
281
+ }
282
+ u.length = function(F) {
283
+ for (var s = t(F), i = 0, D = 0;D < s.length; D++)
284
+ i = i + this.characterLength(s[D]);
285
+ return i;
286
+ }, u.slice = function(F, s, i) {
287
+ textLen = u.length(F), s = s || 0, i = i || 1, s < 0 && (s = textLen + s), i < 0 && (i = textLen + i);
288
+ for (var D = "", C = 0, n = t(F), E = 0;E < n.length; E++) {
289
+ var a = n[E], o = u.length(a);
290
+ if (C >= s - (o == 2 ? 1 : 0))
291
+ if (C + o <= i)
292
+ D += a;
293
+ else
294
+ break;
295
+ C += o;
12
296
  }
297
+ return D;
298
+ };
299
+ })(W);
300
+ var tD = W.exports;
301
+ var eD = L(tD);
302
+ var FD = function() {
303
+ return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|(?:\uD83E\uDDD1\uD83C\uDFFF\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC68(?:\uD83C\uDFFB(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|[\u2695\u2696\u2708]\uFE0F|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))?|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFF]))|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])\uFE0F|\u200D(?:(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D[\uDC66\uDC67])|\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC)?|(?:\uD83D\uDC69(?:\uD83C\uDFFB\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|(?:\uD83C[\uDFFC-\uDFFF])\u200D\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69]))|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83E\uDDD1(?:\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDE36\u200D\uD83C\uDF2B|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83D\uDC3B\u200D\u2744|(?:(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])\u200D[\u2640\u2642]|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u2600-\u2604\u260E\u2611\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26B0\u26B1\u26C8\u26CF\u26D1\u26D3\u26E9\u26F0\u26F1\u26F4\u26F7\u26F8\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u3030\u303D\u3297\u3299]|\uD83C[\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]|\uD83D[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3])\uFE0F|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDE35\u200D\uD83D\uDCAB|\uD83D\uDE2E\u200D\uD83D\uDCA8|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83E\uDDD1(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83D\uDC69(?:\uD83C\uDFFF|\uD83C\uDFFE|\uD83C\uDFFD|\uD83C\uDFFC|\uD83C\uDFFB)?|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\u2764\uFE0F\u200D(?:\uD83D\uDD25|\uD83E\uDE79)|\uD83D\uDC41\uFE0F|\uD83C\uDFF3\uFE0F|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#\*0-9]\uFE0F\u20E3|\u2764\uFE0F|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83C\uDFF4|(?:[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270C\u270D]|\uD83D[\uDD74\uDD90])(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])|[\u270A\u270B]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC08\uDC15\uDC3B\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE2E\uDE35\uDE36\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5]|\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD4\uDDD6-\uDDDD]|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF]|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0D\uDD0E\uDD10-\uDD17\uDD1D\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78\uDD7A-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCB\uDDD0\uDDE0-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6]|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
304
+ };
305
+ var sD = L(FD);
306
+ function p(e, u = {}) {
307
+ if (typeof e != "string" || e.length === 0 || (u = { ambiguousIsNarrow: true, ...u }, e = P(e), e.length === 0))
308
+ return 0;
309
+ e = e.replace(sD(), " ");
310
+ const t = u.ambiguousIsNarrow ? 1 : 2;
311
+ let F = 0;
312
+ for (const s of e) {
313
+ const i = s.codePointAt(0);
314
+ if (i <= 31 || i >= 127 && i <= 159 || i >= 768 && i <= 879)
315
+ continue;
316
+ switch (eD.eastAsianWidth(s)) {
317
+ case "F":
318
+ case "W":
319
+ F += 2;
320
+ break;
321
+ case "A":
322
+ F += t;
323
+ break;
324
+ default:
325
+ F += 1;
326
+ }
327
+ }
328
+ return F;
13
329
  }
14
- /**
15
- * Write a file, optionally skipping if exists
16
- */
17
- export function writeFile(filePath, content, options = {}) {
18
- const exists = existsSync(filePath);
19
- if (exists && !options.force) {
20
- return { path: filePath, action: "skip" };
330
+ var w = 10;
331
+ var N = (e = 0) => (u) => `\x1B[${u + e}m`;
332
+ var I = (e = 0) => (u) => `\x1B[${38 + e};5;${u}m`;
333
+ var R = (e = 0) => (u, t, F) => `\x1B[${38 + e};2;${u};${t};${F}m`;
334
+ var r = { modifier: { reset: [0, 0], bold: [1, 22], dim: [2, 22], italic: [3, 23], underline: [4, 24], overline: [53, 55], inverse: [7, 27], hidden: [8, 28], strikethrough: [9, 29] }, color: { black: [30, 39], red: [31, 39], green: [32, 39], yellow: [33, 39], blue: [34, 39], magenta: [35, 39], cyan: [36, 39], white: [37, 39], blackBright: [90, 39], gray: [90, 39], grey: [90, 39], redBright: [91, 39], greenBright: [92, 39], yellowBright: [93, 39], blueBright: [94, 39], magentaBright: [95, 39], cyanBright: [96, 39], whiteBright: [97, 39] }, bgColor: { bgBlack: [40, 49], bgRed: [41, 49], bgGreen: [42, 49], bgYellow: [43, 49], bgBlue: [44, 49], bgMagenta: [45, 49], bgCyan: [46, 49], bgWhite: [47, 49], bgBlackBright: [100, 49], bgGray: [100, 49], bgGrey: [100, 49], bgRedBright: [101, 49], bgGreenBright: [102, 49], bgYellowBright: [103, 49], bgBlueBright: [104, 49], bgMagentaBright: [105, 49], bgCyanBright: [106, 49], bgWhiteBright: [107, 49] } };
335
+ Object.keys(r.modifier);
336
+ var iD = Object.keys(r.color);
337
+ var CD = Object.keys(r.bgColor);
338
+ [...iD, ...CD];
339
+ function rD() {
340
+ const e = new Map;
341
+ for (const [u, t] of Object.entries(r)) {
342
+ for (const [F, s] of Object.entries(t))
343
+ r[F] = { open: `\x1B[${s[0]}m`, close: `\x1B[${s[1]}m` }, t[F] = r[F], e.set(s[0], s[1]);
344
+ Object.defineProperty(r, u, { value: t, enumerable: false });
345
+ }
346
+ return Object.defineProperty(r, "codes", { value: e, enumerable: false }), r.color.close = "\x1B[39m", r.bgColor.close = "\x1B[49m", r.color.ansi = N(), r.color.ansi256 = I(), r.color.ansi16m = R(), r.bgColor.ansi = N(w), r.bgColor.ansi256 = I(w), r.bgColor.ansi16m = R(w), Object.defineProperties(r, { rgbToAnsi256: { value: (u, t, F) => u === t && t === F ? u < 8 ? 16 : u > 248 ? 231 : Math.round((u - 8) / 247 * 24) + 232 : 16 + 36 * Math.round(u / 255 * 5) + 6 * Math.round(t / 255 * 5) + Math.round(F / 255 * 5), enumerable: false }, hexToRgb: { value: (u) => {
347
+ const t = /[a-f\d]{6}|[a-f\d]{3}/i.exec(u.toString(16));
348
+ if (!t)
349
+ return [0, 0, 0];
350
+ let [F] = t;
351
+ F.length === 3 && (F = [...F].map((i) => i + i).join(""));
352
+ const s = Number.parseInt(F, 16);
353
+ return [s >> 16 & 255, s >> 8 & 255, s & 255];
354
+ }, enumerable: false }, hexToAnsi256: { value: (u) => r.rgbToAnsi256(...r.hexToRgb(u)), enumerable: false }, ansi256ToAnsi: { value: (u) => {
355
+ if (u < 8)
356
+ return 30 + u;
357
+ if (u < 16)
358
+ return 90 + (u - 8);
359
+ let t, F, s;
360
+ if (u >= 232)
361
+ t = ((u - 232) * 10 + 8) / 255, F = t, s = t;
362
+ else {
363
+ u -= 16;
364
+ const C = u % 36;
365
+ t = Math.floor(u / 36) / 5, F = Math.floor(C / 6) / 5, s = C % 6 / 5;
21
366
  }
22
- try {
23
- ensureDir(dirname(filePath));
24
- // Use restrictive permissions for config files
25
- const mode = filePath.includes(".harmony-mcp") ? 0o600 : 0o644;
26
- writeFileSync(filePath, content, { mode });
27
- return { path: filePath, action: exists ? "update" : "create" };
367
+ const i = Math.max(t, F, s) * 2;
368
+ if (i === 0)
369
+ return 30;
370
+ let D = 30 + (Math.round(s) << 2 | Math.round(F) << 1 | Math.round(t));
371
+ return i === 2 && (D += 60), D;
372
+ }, enumerable: false }, rgbToAnsi: { value: (u, t, F) => r.ansi256ToAnsi(r.rgbToAnsi256(u, t, F)), enumerable: false }, hexToAnsi: { value: (u) => r.ansi256ToAnsi(r.hexToAnsi256(u)), enumerable: false } }), r;
373
+ }
374
+ var ED = rD();
375
+ var d = new Set(["\x1B", "›"]);
376
+ var oD = 39;
377
+ var y = "\x07";
378
+ var V = "[";
379
+ var nD = "]";
380
+ var G = "m";
381
+ var _ = `${nD}8;;`;
382
+ var z = (e) => `${d.values().next().value}${V}${e}${G}`;
383
+ var K = (e) => `${d.values().next().value}${_}${e}${y}`;
384
+ var aD = (e) => e.split(" ").map((u) => p(u));
385
+ var k = (e, u, t) => {
386
+ const F = [...u];
387
+ let s = false, i = false, D = p(P(e[e.length - 1]));
388
+ for (const [C, n] of F.entries()) {
389
+ const E = p(n);
390
+ if (D + E <= t ? e[e.length - 1] += n : (e.push(n), D = 0), d.has(n) && (s = true, i = F.slice(C + 1).join("").startsWith(_)), s) {
391
+ i ? n === y && (s = false, i = false) : n === G && (s = false);
392
+ continue;
28
393
  }
29
- catch (error) {
30
- return {
31
- path: filePath,
32
- action: "skip",
33
- error: error instanceof Error ? error.message : String(error),
34
- };
394
+ D += E, D === t && C < F.length - 1 && (e.push(""), D = 0);
395
+ }
396
+ !D && e[e.length - 1].length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
397
+ };
398
+ var hD = (e) => {
399
+ const u = e.split(" ");
400
+ let t = u.length;
401
+ for (;t > 0 && !(p(u[t - 1]) > 0); )
402
+ t--;
403
+ return t === u.length ? e : u.slice(0, t).join(" ") + u.slice(t).join("");
404
+ };
405
+ var lD = (e, u, t = {}) => {
406
+ if (t.trim !== false && e.trim() === "")
407
+ return "";
408
+ let F = "", s, i;
409
+ const D = aD(e);
410
+ let C = [""];
411
+ for (const [E, a] of e.split(" ").entries()) {
412
+ t.trim !== false && (C[C.length - 1] = C[C.length - 1].trimStart());
413
+ let o = p(C[C.length - 1]);
414
+ if (E !== 0 && (o >= u && (t.wordWrap === false || t.trim === false) && (C.push(""), o = 0), (o > 0 || t.trim === false) && (C[C.length - 1] += " ", o++)), t.hard && D[E] > u) {
415
+ const c = u - o, f = 1 + Math.floor((D[E] - c - 1) / u);
416
+ Math.floor((D[E] - 1) / u) < f && C.push(""), k(C, a, u);
417
+ continue;
418
+ }
419
+ if (o + D[E] > u && o > 0 && D[E] > 0) {
420
+ if (t.wordWrap === false && o < u) {
421
+ k(C, a, u);
422
+ continue;
423
+ }
424
+ C.push("");
35
425
  }
426
+ if (o + D[E] > u && t.wordWrap === false) {
427
+ k(C, a, u);
428
+ continue;
429
+ }
430
+ C[C.length - 1] += a;
431
+ }
432
+ t.trim !== false && (C = C.map((E) => hD(E)));
433
+ const n = [...C.join(`
434
+ `)];
435
+ for (const [E, a] of n.entries()) {
436
+ if (F += a, d.has(a)) {
437
+ const { groups: c } = new RegExp(`(?:\\${V}(?<code>\\d+)m|\\${_}(?<uri>.*)${y})`).exec(n.slice(E).join("")) || { groups: {} };
438
+ if (c.code !== undefined) {
439
+ const f = Number.parseFloat(c.code);
440
+ s = f === oD ? undefined : f;
441
+ } else
442
+ c.uri !== undefined && (i = c.uri.length === 0 ? undefined : c.uri);
443
+ }
444
+ const o = ED.codes.get(Number(s));
445
+ n[E + 1] === `
446
+ ` ? (i && (F += K("")), s && o && (F += z(o))) : a === `
447
+ ` && (s && o && (F += z(s)), i && (F += K(i)));
448
+ }
449
+ return F;
450
+ };
451
+ function Y(e, u, t) {
452
+ return String(e).normalize().replace(/\r\n/g, `
453
+ `).split(`
454
+ `).map((F) => lD(F, u, t)).join(`
455
+ `);
36
456
  }
37
- /**
38
- * Merge JSON content into existing file
39
- */
40
- export function mergeJsonFile(filePath, updates, options = {}) {
41
- const exists = existsSync(filePath);
42
- if (!exists) {
43
- try {
44
- ensureDir(dirname(filePath));
45
- writeFileSync(filePath, JSON.stringify(updates, null, 2), {
46
- mode: 0o644,
47
- });
48
- return { path: filePath, action: "create" };
49
- }
50
- catch (error) {
51
- return {
52
- path: filePath,
53
- action: "skip",
54
- error: error instanceof Error ? error.message : String(error),
55
- };
56
- }
457
+ var xD = ["up", "down", "left", "right", "space", "enter", "cancel"];
458
+ var B = { actions: new Set(xD), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]) };
459
+ function $(e, u) {
460
+ if (typeof e == "string")
461
+ return B.aliases.get(e) === u;
462
+ for (const t of e)
463
+ if (t !== undefined && $(t, u))
464
+ return true;
465
+ return false;
466
+ }
467
+ function BD(e, u) {
468
+ if (e === u)
469
+ return;
470
+ const t = e.split(`
471
+ `), F = u.split(`
472
+ `), s = [];
473
+ for (let i = 0;i < Math.max(t.length, F.length); i++)
474
+ t[i] !== F[i] && s.push(i);
475
+ return s;
476
+ }
477
+ var AD = globalThis.process.platform.startsWith("win");
478
+ var S = Symbol("clack:cancel");
479
+ function pD(e) {
480
+ return e === S;
481
+ }
482
+ function m(e, u) {
483
+ const t = e;
484
+ t.isTTY && t.setRawMode(u);
485
+ }
486
+ function fD({ input: e = j, output: u = M, overwrite: t = true, hideCursor: F = true } = {}) {
487
+ const s = g.createInterface({ input: e, output: u, prompt: "", tabSize: 1 });
488
+ g.emitKeypressEvents(e, s), e.isTTY && e.setRawMode(true);
489
+ const i = (D, { name: C, sequence: n }) => {
490
+ const E = String(D);
491
+ if ($([E, C, n], "cancel")) {
492
+ F && u.write(import_sisteransi.cursor.show), process.exit(0);
493
+ return;
57
494
  }
58
- try {
59
- const existing = JSON.parse(readFileSync(filePath, "utf-8"));
60
- // Deep merge mcpServers if present (always update harmony config)
61
- if (updates.mcpServers && existing.mcpServers) {
62
- const existingServers = existing.mcpServers;
63
- const updateServers = updates.mcpServers;
64
- existing.mcpServers = { ...existingServers, ...updateServers };
65
- }
66
- else {
67
- Object.assign(existing, updates);
495
+ if (!t)
496
+ return;
497
+ const a = C === "return" ? 0 : -1, o = C === "return" ? -1 : 0;
498
+ g.moveCursor(u, a, o, () => {
499
+ g.clearLine(u, 1, () => {
500
+ e.once("keypress", i);
501
+ });
502
+ });
503
+ };
504
+ return F && u.write(import_sisteransi.cursor.hide), e.once("keypress", i), () => {
505
+ e.off("keypress", i), F && u.write(import_sisteransi.cursor.show), e.isTTY && !AD && e.setRawMode(false), s.terminal = false, s.close();
506
+ };
507
+ }
508
+ var gD = Object.defineProperty;
509
+ var vD = (e, u, t) => (u in e) ? gD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
510
+ var h = (e, u, t) => (vD(e, typeof u != "symbol" ? u + "" : u, t), t);
511
+
512
+ class x {
513
+ constructor(u, t = true) {
514
+ h(this, "input"), h(this, "output"), h(this, "_abortSignal"), h(this, "rl"), h(this, "opts"), h(this, "_render"), h(this, "_track", false), h(this, "_prevFrame", ""), h(this, "_subscribers", new Map), h(this, "_cursor", 0), h(this, "state", "initial"), h(this, "error", ""), h(this, "value");
515
+ const { input: F = j, output: s = M, render: i, signal: D, ...C } = u;
516
+ this.opts = C, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = i.bind(this), this._track = t, this._abortSignal = D, this.input = F, this.output = s;
517
+ }
518
+ unsubscribe() {
519
+ this._subscribers.clear();
520
+ }
521
+ setSubscriber(u, t) {
522
+ const F = this._subscribers.get(u) ?? [];
523
+ F.push(t), this._subscribers.set(u, F);
524
+ }
525
+ on(u, t) {
526
+ this.setSubscriber(u, { cb: t });
527
+ }
528
+ once(u, t) {
529
+ this.setSubscriber(u, { cb: t, once: true });
530
+ }
531
+ emit(u, ...t) {
532
+ const F = this._subscribers.get(u) ?? [], s = [];
533
+ for (const i of F)
534
+ i.cb(...t), i.once && s.push(() => F.splice(F.indexOf(i), 1));
535
+ for (const i of s)
536
+ i();
537
+ }
538
+ prompt() {
539
+ return new Promise((u, t) => {
540
+ if (this._abortSignal) {
541
+ if (this._abortSignal.aborted)
542
+ return this.state = "cancel", this.close(), u(S);
543
+ this._abortSignal.addEventListener("abort", () => {
544
+ this.state = "cancel", this.close();
545
+ }, { once: true });
546
+ }
547
+ const F = new X;
548
+ F._write = (s, i, D) => {
549
+ this._track && (this.value = this.rl?.line.replace(/\t/g, ""), this._cursor = this.rl?.cursor ?? 0, this.emit("value", this.value)), D();
550
+ }, this.input.pipe(F), this.rl = O.createInterface({ input: this.input, output: F, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), O.emitKeypressEvents(this.input, this.rl), this.rl.prompt(), this.opts.initialValue !== undefined && this._track && this.rl.write(this.opts.initialValue), this.input.on("keypress", this.onKeypress), m(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
551
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(this.value);
552
+ }), this.once("cancel", () => {
553
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), m(this.input, false), u(S);
554
+ });
555
+ });
556
+ }
557
+ onKeypress(u, t) {
558
+ if (this.state === "error" && (this.state = "active"), t?.name && (!this._track && B.aliases.has(t.name) && this.emit("cursor", B.aliases.get(t.name)), B.actions.has(t.name) && this.emit("cursor", t.name)), u && (u.toLowerCase() === "y" || u.toLowerCase() === "n") && this.emit("confirm", u.toLowerCase() === "y"), u === "\t" && this.opts.placeholder && (this.value || (this.rl?.write(this.opts.placeholder), this.emit("value", this.opts.placeholder))), u && this.emit("key", u.toLowerCase()), t?.name === "return") {
559
+ if (this.opts.validate) {
560
+ const F = this.opts.validate(this.value);
561
+ F && (this.error = F instanceof Error ? F.message : F, this.state = "error", this.rl?.write(this.value));
562
+ }
563
+ this.state !== "error" && (this.state = "submit");
564
+ }
565
+ $([u, t?.name, t?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
566
+ }
567
+ close() {
568
+ this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
569
+ `), m(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
570
+ }
571
+ restoreCursor() {
572
+ const u = Y(this._prevFrame, process.stdout.columns, { hard: true }).split(`
573
+ `).length - 1;
574
+ this.output.write(import_sisteransi.cursor.move(-999, u * -1));
575
+ }
576
+ render() {
577
+ const u = Y(this._render(this) ?? "", process.stdout.columns, { hard: true });
578
+ if (u !== this._prevFrame) {
579
+ if (this.state === "initial")
580
+ this.output.write(import_sisteransi.cursor.hide);
581
+ else {
582
+ const t = BD(this._prevFrame, u);
583
+ if (this.restoreCursor(), t && t?.length === 1) {
584
+ const F = t[0];
585
+ this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.lines(1));
586
+ const s = u.split(`
587
+ `);
588
+ this.output.write(s[F]), this._prevFrame = u, this.output.write(import_sisteransi.cursor.move(0, s.length - F - 1));
589
+ return;
68
590
  }
69
- writeFileSync(filePath, JSON.stringify(existing, null, 2), { mode: 0o644 });
70
- return { path: filePath, action: "merge" };
71
- }
72
- catch {
73
- if (options.force) {
74
- try {
75
- writeFileSync(filePath, JSON.stringify(updates, null, 2), {
76
- mode: 0o644,
77
- });
78
- return { path: filePath, action: "update" };
79
- }
80
- catch (error) {
81
- return {
82
- path: filePath,
83
- action: "skip",
84
- error: error instanceof Error ? error.message : String(error),
85
- };
86
- }
591
+ if (t && t?.length > 1) {
592
+ const F = t[0];
593
+ this.output.write(import_sisteransi.cursor.move(0, F)), this.output.write(import_sisteransi.erase.down());
594
+ const s = u.split(`
595
+ `).slice(F);
596
+ this.output.write(s.join(`
597
+ `)), this._prevFrame = u;
598
+ return;
87
599
  }
88
- return {
89
- path: filePath,
90
- action: "skip",
91
- error: "Could not parse existing file",
92
- };
600
+ this.output.write(import_sisteransi.erase.down());
601
+ }
602
+ this.output.write(u), this.state === "initial" && (this.state = "active"), this._prevFrame = u;
93
603
  }
604
+ }
94
605
  }
95
- /**
96
- * Append to TOML file (for Codex config)
97
- */
98
- export function appendToToml(filePath, section, content, options = {}) {
99
- const exists = existsSync(filePath);
100
- if (!exists) {
101
- try {
102
- ensureDir(dirname(filePath));
103
- writeFileSync(filePath, content, { mode: 0o644 });
104
- return { path: filePath, action: "create" };
105
- }
106
- catch (error) {
107
- return {
108
- path: filePath,
109
- action: "skip",
110
- error: error instanceof Error ? error.message : String(error),
111
- };
112
- }
606
+
607
+ class dD extends x {
608
+ get cursor() {
609
+ return this.value ? 0 : 1;
610
+ }
611
+ get _value() {
612
+ return this.cursor === 0;
613
+ }
614
+ constructor(u) {
615
+ super(u, false), this.value = !!u.initialValue, this.on("value", () => {
616
+ this.value = this._value;
617
+ }), this.on("confirm", (t) => {
618
+ this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = t, this.state = "submit", this.close();
619
+ }), this.on("cursor", () => {
620
+ this.value = !this.value;
621
+ });
622
+ }
623
+ }
624
+ var A;
625
+ A = new WeakMap;
626
+ var kD = Object.defineProperty;
627
+ var $D = (e, u, t) => (u in e) ? kD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
628
+ var H = (e, u, t) => ($D(e, typeof u != "symbol" ? u + "" : u, t), t);
629
+ var SD = class extends x {
630
+ constructor(u) {
631
+ super(u, false), H(this, "options"), H(this, "cursor", 0), this.options = u.options, this.value = [...u.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: t }) => t === u.cursorAt), 0), this.on("key", (t) => {
632
+ t === "a" && this.toggleAll();
633
+ }), this.on("cursor", (t) => {
634
+ switch (t) {
635
+ case "left":
636
+ case "up":
637
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
638
+ break;
639
+ case "down":
640
+ case "right":
641
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
642
+ break;
643
+ case "space":
644
+ this.toggleValue();
645
+ break;
646
+ }
647
+ });
648
+ }
649
+ get _value() {
650
+ return this.options[this.cursor].value;
651
+ }
652
+ toggleAll() {
653
+ const u = this.value.length === this.options.length;
654
+ this.value = u ? [] : this.options.map((t) => t.value);
655
+ }
656
+ toggleValue() {
657
+ const u = this.value.includes(this._value);
658
+ this.value = u ? this.value.filter((t) => t !== this._value) : [...this.value, this._value];
659
+ }
660
+ };
661
+ var TD = Object.defineProperty;
662
+ var jD = (e, u, t) => (u in e) ? TD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
663
+ var U = (e, u, t) => (jD(e, typeof u != "symbol" ? u + "" : u, t), t);
664
+
665
+ class MD extends x {
666
+ constructor({ mask: u, ...t }) {
667
+ super(t), U(this, "valueWithCursor", ""), U(this, "_mask", "•"), this._mask = u ?? "•", this.on("finalize", () => {
668
+ this.valueWithCursor = this.masked;
669
+ }), this.on("value", () => {
670
+ if (this.cursor >= this.value.length)
671
+ this.valueWithCursor = `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
672
+ else {
673
+ const F = this.masked.slice(0, this.cursor), s = this.masked.slice(this.cursor);
674
+ this.valueWithCursor = `${F}${import_picocolors.default.inverse(s[0])}${s.slice(1)}`;
675
+ }
676
+ });
677
+ }
678
+ get cursor() {
679
+ return this._cursor;
680
+ }
681
+ get masked() {
682
+ return this.value.replaceAll(/./g, this._mask);
683
+ }
684
+ }
685
+ var OD = Object.defineProperty;
686
+ var PD = (e, u, t) => (u in e) ? OD(e, u, { enumerable: true, configurable: true, writable: true, value: t }) : e[u] = t;
687
+ var J = (e, u, t) => (PD(e, typeof u != "symbol" ? u + "" : u, t), t);
688
+
689
+ class LD extends x {
690
+ constructor(u) {
691
+ super(u, false), J(this, "options"), J(this, "cursor", 0), this.options = u.options, this.cursor = this.options.findIndex(({ value: t }) => t === u.initialValue), this.cursor === -1 && (this.cursor = 0), this.changeValue(), this.on("cursor", (t) => {
692
+ switch (t) {
693
+ case "left":
694
+ case "up":
695
+ this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
696
+ break;
697
+ case "down":
698
+ case "right":
699
+ this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
700
+ break;
701
+ }
702
+ this.changeValue();
703
+ });
704
+ }
705
+ get _value() {
706
+ return this.options[this.cursor];
707
+ }
708
+ changeValue() {
709
+ this.value = this._value.value;
710
+ }
711
+ }
712
+ class RD extends x {
713
+ get valueWithCursor() {
714
+ if (this.state === "submit")
715
+ return this.value;
716
+ if (this.cursor >= this.value.length)
717
+ return `${this.value}█`;
718
+ const u = this.value.slice(0, this.cursor), [t, ...F] = this.value.slice(this.cursor);
719
+ return `${u}${import_picocolors.default.inverse(t)}${F.join("")}`;
720
+ }
721
+ get cursor() {
722
+ return this._cursor;
723
+ }
724
+ constructor(u) {
725
+ super(u), this.on("finalize", () => {
726
+ this.value || (this.value = u.defaultValue);
727
+ });
728
+ }
729
+ }
730
+
731
+ // ../../node_modules/@clack/prompts/dist/index.mjs
732
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
733
+ var import_sisteransi2 = __toESM(require_src(), 1);
734
+ import y2 from "node:process";
735
+ function ce() {
736
+ return y2.platform !== "win32" ? y2.env.TERM !== "linux" : !!y2.env.CI || !!y2.env.WT_SESSION || !!y2.env.TERMINUS_SUBLIME || y2.env.ConEmuTask === "{cmd::Cmder}" || y2.env.TERM_PROGRAM === "Terminus-Sublime" || y2.env.TERM_PROGRAM === "vscode" || y2.env.TERM === "xterm-256color" || y2.env.TERM === "alacritty" || y2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
737
+ }
738
+ var V2 = ce();
739
+ var u = (t, n) => V2 ? t : n;
740
+ var le = u("◆", "*");
741
+ var L2 = u("■", "x");
742
+ var W2 = u("▲", "x");
743
+ var C = u("◇", "o");
744
+ var ue = u("┌", "T");
745
+ var o = u("│", "|");
746
+ var d2 = u("└", "—");
747
+ var k2 = u("●", ">");
748
+ var P2 = u("○", " ");
749
+ var A2 = u("◻", "[•]");
750
+ var T = u("◼", "[+]");
751
+ var F = u("◻", "[ ]");
752
+ var $e = u("▪", "•");
753
+ var _2 = u("─", "-");
754
+ var me = u("╮", "+");
755
+ var de = u("├", "+");
756
+ var pe = u("╯", "+");
757
+ var q = u("●", "•");
758
+ var D = u("◆", "*");
759
+ var U2 = u("▲", "!");
760
+ var K2 = u("■", "x");
761
+ var b2 = (t) => {
762
+ switch (t) {
763
+ case "initial":
764
+ case "active":
765
+ return import_picocolors2.default.cyan(le);
766
+ case "cancel":
767
+ return import_picocolors2.default.red(L2);
768
+ case "error":
769
+ return import_picocolors2.default.yellow(W2);
770
+ case "submit":
771
+ return import_picocolors2.default.green(C);
772
+ }
773
+ };
774
+ var G2 = (t) => {
775
+ const { cursor: n, options: r2, style: i } = t, s = t.maxItems ?? Number.POSITIVE_INFINITY, c = Math.max(process.stdout.rows - 4, 0), a = Math.min(c, Math.max(s, 5));
776
+ let l2 = 0;
777
+ n >= l2 + a - 3 ? l2 = Math.max(Math.min(n - a + 3, r2.length - a), 0) : n < l2 + 2 && (l2 = Math.max(n - 2, 0));
778
+ const $2 = a < r2.length && l2 > 0, g2 = a < r2.length && l2 + a < r2.length;
779
+ return r2.slice(l2, l2 + a).map((p2, v2, f) => {
780
+ const j2 = v2 === 0 && $2, E = v2 === f.length - 1 && g2;
781
+ return j2 || E ? import_picocolors2.default.dim("...") : i(p2, v2 + l2 === n);
782
+ });
783
+ };
784
+ var he = (t) => new RD({ validate: t.validate, placeholder: t.placeholder, defaultValue: t.defaultValue, initialValue: t.initialValue, render() {
785
+ const n = `${import_picocolors2.default.gray(o)}
786
+ ${b2(this.state)} ${t.message}
787
+ `, r2 = t.placeholder ? import_picocolors2.default.inverse(t.placeholder[0]) + import_picocolors2.default.dim(t.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), i = this.value ? this.valueWithCursor : r2;
788
+ switch (this.state) {
789
+ case "error":
790
+ return `${n.trim()}
791
+ ${import_picocolors2.default.yellow(o)} ${i}
792
+ ${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
793
+ `;
794
+ case "submit":
795
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(this.value || t.placeholder)}`;
796
+ case "cancel":
797
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(this.value ?? ""))}${this.value?.trim() ? `
798
+ ${import_picocolors2.default.gray(o)}` : ""}`;
799
+ default:
800
+ return `${n}${import_picocolors2.default.cyan(o)} ${i}
801
+ ${import_picocolors2.default.cyan(d2)}
802
+ `;
803
+ }
804
+ } }).prompt();
805
+ var ge = (t) => new MD({ validate: t.validate, mask: t.mask ?? $e, render() {
806
+ const n = `${import_picocolors2.default.gray(o)}
807
+ ${b2(this.state)} ${t.message}
808
+ `, r2 = this.valueWithCursor, i = this.masked;
809
+ switch (this.state) {
810
+ case "error":
811
+ return `${n.trim()}
812
+ ${import_picocolors2.default.yellow(o)} ${i}
813
+ ${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(this.error)}
814
+ `;
815
+ case "submit":
816
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(i)}`;
817
+ case "cancel":
818
+ return `${n}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(i ?? ""))}${i ? `
819
+ ${import_picocolors2.default.gray(o)}` : ""}`;
820
+ default:
821
+ return `${n}${import_picocolors2.default.cyan(o)} ${r2}
822
+ ${import_picocolors2.default.cyan(d2)}
823
+ `;
824
+ }
825
+ } }).prompt();
826
+ var ye = (t) => {
827
+ const n = t.active ?? "Yes", r2 = t.inactive ?? "No";
828
+ return new dD({ active: n, inactive: r2, initialValue: t.initialValue ?? true, render() {
829
+ const i = `${import_picocolors2.default.gray(o)}
830
+ ${b2(this.state)} ${t.message}
831
+ `, s = this.value ? n : r2;
832
+ switch (this.state) {
833
+ case "submit":
834
+ return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.dim(s)}`;
835
+ case "cancel":
836
+ return `${i}${import_picocolors2.default.gray(o)} ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}
837
+ ${import_picocolors2.default.gray(o)}`;
838
+ default:
839
+ return `${i}${import_picocolors2.default.cyan(o)} ${this.value ? `${import_picocolors2.default.green(k2)} ${n}` : `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(n)}`} ${import_picocolors2.default.dim("/")} ${this.value ? `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(r2)}` : `${import_picocolors2.default.green(k2)} ${r2}`}
840
+ ${import_picocolors2.default.cyan(d2)}
841
+ `;
842
+ }
843
+ } }).prompt();
844
+ };
845
+ var ve = (t) => {
846
+ const n = (r2, i) => {
847
+ const s = r2.label ?? String(r2.value);
848
+ switch (i) {
849
+ case "selected":
850
+ return `${import_picocolors2.default.dim(s)}`;
851
+ case "active":
852
+ return `${import_picocolors2.default.green(k2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}`;
853
+ case "cancelled":
854
+ return `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}`;
855
+ default:
856
+ return `${import_picocolors2.default.dim(P2)} ${import_picocolors2.default.dim(s)}`;
857
+ }
858
+ };
859
+ return new LD({ options: t.options, initialValue: t.initialValue, render() {
860
+ const r2 = `${import_picocolors2.default.gray(o)}
861
+ ${b2(this.state)} ${t.message}
862
+ `;
863
+ switch (this.state) {
864
+ case "submit":
865
+ return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "selected")}`;
866
+ case "cancel":
867
+ return `${r2}${import_picocolors2.default.gray(o)} ${n(this.options[this.cursor], "cancelled")}
868
+ ${import_picocolors2.default.gray(o)}`;
869
+ default:
870
+ return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ cursor: this.cursor, options: this.options, maxItems: t.maxItems, style: (i, s) => n(i, s ? "active" : "inactive") }).join(`
871
+ ${import_picocolors2.default.cyan(o)} `)}
872
+ ${import_picocolors2.default.cyan(d2)}
873
+ `;
113
874
  }
875
+ } }).prompt();
876
+ };
877
+ var fe = (t) => {
878
+ const n = (r2, i) => {
879
+ const s = r2.label ?? String(r2.value);
880
+ return i === "active" ? `${import_picocolors2.default.cyan(A2)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "selected" ? `${import_picocolors2.default.green(T)} ${import_picocolors2.default.dim(s)} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "cancelled" ? `${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(s))}` : i === "active-selected" ? `${import_picocolors2.default.green(T)} ${s} ${r2.hint ? import_picocolors2.default.dim(`(${r2.hint})`) : ""}` : i === "submitted" ? `${import_picocolors2.default.dim(s)}` : `${import_picocolors2.default.dim(F)} ${import_picocolors2.default.dim(s)}`;
881
+ };
882
+ return new SD({ options: t.options, initialValues: t.initialValues, required: t.required ?? true, cursorAt: t.cursorAt, validate(r2) {
883
+ if (this.required && r2.length === 0)
884
+ return `Please select at least one option.
885
+ ${import_picocolors2.default.reset(import_picocolors2.default.dim(`Press ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" space ")))} to select, ${import_picocolors2.default.gray(import_picocolors2.default.bgWhite(import_picocolors2.default.inverse(" enter ")))} to submit`))}`;
886
+ }, render() {
887
+ const r2 = `${import_picocolors2.default.gray(o)}
888
+ ${b2(this.state)} ${t.message}
889
+ `, i = (s, c) => {
890
+ const a = this.value.includes(s.value);
891
+ return c && a ? n(s, "active-selected") : a ? n(s, "selected") : n(s, c ? "active" : "inactive");
892
+ };
893
+ switch (this.state) {
894
+ case "submit":
895
+ return `${r2}${import_picocolors2.default.gray(o)} ${this.options.filter(({ value: s }) => this.value.includes(s)).map((s) => n(s, "submitted")).join(import_picocolors2.default.dim(", ")) || import_picocolors2.default.dim("none")}`;
896
+ case "cancel": {
897
+ const s = this.options.filter(({ value: c }) => this.value.includes(c)).map((c) => n(c, "cancelled")).join(import_picocolors2.default.dim(", "));
898
+ return `${r2}${import_picocolors2.default.gray(o)} ${s.trim() ? `${s}
899
+ ${import_picocolors2.default.gray(o)}` : ""}`;
900
+ }
901
+ case "error": {
902
+ const s = this.error.split(`
903
+ `).map((c, a) => a === 0 ? `${import_picocolors2.default.yellow(d2)} ${import_picocolors2.default.yellow(c)}` : ` ${c}`).join(`
904
+ `);
905
+ return `${r2 + import_picocolors2.default.yellow(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
906
+ ${import_picocolors2.default.yellow(o)} `)}
907
+ ${s}
908
+ `;
909
+ }
910
+ default:
911
+ return `${r2}${import_picocolors2.default.cyan(o)} ${G2({ options: this.options, cursor: this.cursor, maxItems: t.maxItems, style: i }).join(`
912
+ ${import_picocolors2.default.cyan(o)} `)}
913
+ ${import_picocolors2.default.cyan(d2)}
914
+ `;
915
+ }
916
+ } }).prompt();
917
+ };
918
+ var xe = (t = "") => {
919
+ process.stdout.write(`${import_picocolors2.default.gray(d2)} ${import_picocolors2.default.red(t)}
920
+
921
+ `);
922
+ };
923
+ var Se = (t = "") => {
924
+ process.stdout.write(`${import_picocolors2.default.gray(o)}
925
+ ${import_picocolors2.default.gray(d2)} ${t}
926
+
927
+ `);
928
+ };
929
+ var M2 = { message: (t = "", { symbol: n = import_picocolors2.default.gray(o) } = {}) => {
930
+ const r2 = [`${import_picocolors2.default.gray(o)}`];
931
+ if (t) {
932
+ const [i, ...s] = t.split(`
933
+ `);
934
+ r2.push(`${n} ${i}`, ...s.map((c) => `${import_picocolors2.default.gray(o)} ${c}`));
935
+ }
936
+ process.stdout.write(`${r2.join(`
937
+ `)}
938
+ `);
939
+ }, info: (t) => {
940
+ M2.message(t, { symbol: import_picocolors2.default.blue(q) });
941
+ }, success: (t) => {
942
+ M2.message(t, { symbol: import_picocolors2.default.green(D) });
943
+ }, step: (t) => {
944
+ M2.message(t, { symbol: import_picocolors2.default.green(C) });
945
+ }, warn: (t) => {
946
+ M2.message(t, { symbol: import_picocolors2.default.yellow(U2) });
947
+ }, warning: (t) => {
948
+ M2.warn(t);
949
+ }, error: (t) => {
950
+ M2.message(t, { symbol: import_picocolors2.default.red(K2) });
951
+ } };
952
+ var J2 = `${import_picocolors2.default.gray(o)} `;
953
+ var Y2 = ({ indicator: t = "dots" } = {}) => {
954
+ const n = V2 ? ["◒", "◐", "◓", "◑"] : ["•", "o", "O", "0"], r2 = V2 ? 80 : 120, i = process.env.CI === "true";
955
+ let s, c, a = false, l2 = "", $2, g2 = performance.now();
956
+ const p2 = (m2) => {
957
+ const h2 = m2 > 1 ? "Something went wrong" : "Canceled";
958
+ a && N2(h2, m2);
959
+ }, v2 = () => p2(2), f = () => p2(1), j2 = () => {
960
+ process.on("uncaughtExceptionMonitor", v2), process.on("unhandledRejection", v2), process.on("SIGINT", f), process.on("SIGTERM", f), process.on("exit", p2);
961
+ }, E = () => {
962
+ process.removeListener("uncaughtExceptionMonitor", v2), process.removeListener("unhandledRejection", v2), process.removeListener("SIGINT", f), process.removeListener("SIGTERM", f), process.removeListener("exit", p2);
963
+ }, B2 = () => {
964
+ if ($2 === undefined)
965
+ return;
966
+ i && process.stdout.write(`
967
+ `);
968
+ const m2 = $2.split(`
969
+ `);
970
+ process.stdout.write(import_sisteransi2.cursor.move(-999, m2.length - 1)), process.stdout.write(import_sisteransi2.erase.down(m2.length));
971
+ }, R2 = (m2) => m2.replace(/\.+$/, ""), O2 = (m2) => {
972
+ const h2 = (performance.now() - m2) / 1000, w2 = Math.floor(h2 / 60), I2 = Math.floor(h2 % 60);
973
+ return w2 > 0 ? `[${w2}m ${I2}s]` : `[${I2}s]`;
974
+ }, H2 = (m2 = "") => {
975
+ a = true, s = fD(), l2 = R2(m2), g2 = performance.now(), process.stdout.write(`${import_picocolors2.default.gray(o)}
976
+ `);
977
+ let h2 = 0, w2 = 0;
978
+ j2(), c = setInterval(() => {
979
+ if (i && l2 === $2)
980
+ return;
981
+ B2(), $2 = l2;
982
+ const I2 = import_picocolors2.default.magenta(n[h2]);
983
+ if (i)
984
+ process.stdout.write(`${I2} ${l2}...`);
985
+ else if (t === "timer")
986
+ process.stdout.write(`${I2} ${l2} ${O2(g2)}`);
987
+ else {
988
+ const z2 = ".".repeat(Math.floor(w2)).slice(0, 3);
989
+ process.stdout.write(`${I2} ${l2}${z2}`);
990
+ }
991
+ h2 = h2 + 1 < n.length ? h2 + 1 : 0, w2 = w2 < n.length ? w2 + 0.125 : 0;
992
+ }, r2);
993
+ }, N2 = (m2 = "", h2 = 0) => {
994
+ a = false, clearInterval(c), B2();
995
+ const w2 = h2 === 0 ? import_picocolors2.default.green(C) : h2 === 1 ? import_picocolors2.default.red(L2) : import_picocolors2.default.red(W2);
996
+ l2 = R2(m2 ?? l2), t === "timer" ? process.stdout.write(`${w2} ${l2} ${O2(g2)}
997
+ `) : process.stdout.write(`${w2} ${l2}
998
+ `), E(), s();
999
+ };
1000
+ return { start: H2, stop: N2, message: (m2 = "") => {
1001
+ l2 = R2(m2 ?? l2);
1002
+ } };
1003
+ };
1004
+
1005
+ // src/tui/writer.ts
1006
+ function ensureDir(dirPath) {
1007
+ if (!existsSync(dirPath)) {
1008
+ mkdirSync(dirPath, { recursive: true, mode: 493 });
1009
+ }
1010
+ }
1011
+ function writeFile(filePath, content, options = {}) {
1012
+ const exists = existsSync(filePath);
1013
+ if (exists && !options.force) {
1014
+ return { path: filePath, action: "skip" };
1015
+ }
1016
+ try {
1017
+ ensureDir(dirname(filePath));
1018
+ const mode = filePath.includes(".harmony-mcp") ? 384 : 420;
1019
+ writeFileSync(filePath, content, { mode });
1020
+ return { path: filePath, action: exists ? "update" : "create" };
1021
+ } catch (error) {
1022
+ return {
1023
+ path: filePath,
1024
+ action: "skip",
1025
+ error: error instanceof Error ? error.message : String(error)
1026
+ };
1027
+ }
1028
+ }
1029
+ function mergeJsonFile(filePath, updates, options = {}) {
1030
+ const exists = existsSync(filePath);
1031
+ if (!exists) {
114
1032
  try {
115
- const existing = readFileSync(filePath, "utf-8");
116
- if (existing.includes(section)) {
117
- if (options.force) {
118
- // Replace existing section
119
- const updated = existing.replace(new RegExp(`\\[${section.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\][\\s\\S]*?(?=\\[|$)`), content.trim() + "\n\n");
120
- writeFileSync(filePath, updated, { mode: 0o644 });
121
- return { path: filePath, action: "update" };
122
- }
123
- return { path: filePath, action: "skip" };
124
- }
125
- // Append new section
126
- writeFileSync(filePath, existing + "\n" + content, { mode: 0o644 });
127
- return { path: filePath, action: "merge" };
1033
+ ensureDir(dirname(filePath));
1034
+ writeFileSync(filePath, JSON.stringify(updates, null, 2), {
1035
+ mode: 420
1036
+ });
1037
+ return { path: filePath, action: "create" };
1038
+ } catch (error) {
1039
+ return {
1040
+ path: filePath,
1041
+ action: "skip",
1042
+ error: error instanceof Error ? error.message : String(error)
1043
+ };
1044
+ }
1045
+ }
1046
+ try {
1047
+ const existing = JSON.parse(readFileSync(filePath, "utf-8"));
1048
+ if (updates.mcpServers && existing.mcpServers) {
1049
+ const existingServers = existing.mcpServers;
1050
+ const updateServers = updates.mcpServers;
1051
+ existing.mcpServers = { ...existingServers, ...updateServers };
1052
+ } else {
1053
+ Object.assign(existing, updates);
128
1054
  }
129
- catch (error) {
1055
+ writeFileSync(filePath, JSON.stringify(existing, null, 2), { mode: 420 });
1056
+ return { path: filePath, action: "merge" };
1057
+ } catch {
1058
+ if (options.force) {
1059
+ try {
1060
+ writeFileSync(filePath, JSON.stringify(updates, null, 2), {
1061
+ mode: 420
1062
+ });
1063
+ return { path: filePath, action: "update" };
1064
+ } catch (error) {
130
1065
  return {
131
- path: filePath,
132
- action: "skip",
133
- error: error instanceof Error ? error.message : String(error),
1066
+ path: filePath,
1067
+ action: "skip",
1068
+ error: error instanceof Error ? error.message : String(error)
134
1069
  };
1070
+ }
135
1071
  }
1072
+ return {
1073
+ path: filePath,
1074
+ action: "skip",
1075
+ error: "Could not parse existing file"
1076
+ };
1077
+ }
136
1078
  }
137
- /**
138
- * Write multiple files with progress display
139
- */
140
- export async function writeFilesWithProgress(files, options = {}) {
141
- const results = [];
142
- const home = homedir();
143
- const spinner = p.spinner();
144
- spinner.start("Writing configuration files...");
145
- for (const file of files) {
146
- let result;
147
- if (file.type === "json") {
148
- const jsonContent = JSON.parse(file.content);
149
- result = mergeJsonFile(file.path, jsonContent, options);
150
- }
151
- else if (file.type === "toml" && file.tomlSection) {
152
- result = appendToToml(file.path, file.tomlSection, file.content, options);
153
- }
154
- else {
155
- result = writeFile(file.path, file.content, options);
156
- }
157
- results.push(result);
158
- // Small delay for visual effect
159
- await new Promise((resolve) => setTimeout(resolve, 50));
160
- }
161
- spinner.stop("Files written");
162
- // Display results
163
- for (const result of results) {
164
- const displayPath = formatPath(result.path, home);
165
- if (result.error) {
166
- console.log(messages.fileError(displayPath, result.error));
167
- }
168
- else if (result.action === "skip") {
169
- console.log(messages.fileSkipped(displayPath));
170
- }
171
- else {
172
- const actionLabel = result.action === "merge" ? "updated" : "created";
173
- console.log(` ${colors.success("\u2713")} ${colors.dim(displayPath)} ${colors.dim(`(${actionLabel})`)}`);
174
- }
1079
+ function appendToToml(filePath, section, content, options = {}) {
1080
+ const exists = existsSync(filePath);
1081
+ if (!exists) {
1082
+ try {
1083
+ ensureDir(dirname(filePath));
1084
+ writeFileSync(filePath, content, { mode: 420 });
1085
+ return { path: filePath, action: "create" };
1086
+ } catch (error) {
1087
+ return {
1088
+ path: filePath,
1089
+ action: "skip",
1090
+ error: error instanceof Error ? error.message : String(error)
1091
+ };
175
1092
  }
176
- return results;
177
- }
178
- /**
179
- * Get summary of what will be written
180
- */
181
- export function getWriteSummary(files, options = {}) {
182
- const toCreate = [];
183
- const toUpdate = [];
184
- const toSkip = [];
185
- const home = homedir();
186
- for (const file of files) {
187
- const displayPath = formatPath(file.path, home);
188
- const exists = existsSync(file.path);
189
- if (exists && !options.force) {
190
- toSkip.push(displayPath);
191
- }
192
- else if (exists) {
193
- toUpdate.push(displayPath);
194
- }
195
- else {
196
- toCreate.push(displayPath);
197
- }
1093
+ }
1094
+ try {
1095
+ const existing = readFileSync(filePath, "utf-8");
1096
+ if (existing.includes(section)) {
1097
+ if (options.force) {
1098
+ const updated = existing.replace(new RegExp(`\\[${section.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}\\][\\s\\S]*?(?=\\[|$)`), content.trim() + `
1099
+
1100
+ `);
1101
+ writeFileSync(filePath, updated, { mode: 420 });
1102
+ return { path: filePath, action: "update" };
1103
+ }
1104
+ return { path: filePath, action: "skip" };
1105
+ }
1106
+ writeFileSync(filePath, existing + `
1107
+ ` + content, { mode: 420 });
1108
+ return { path: filePath, action: "merge" };
1109
+ } catch (error) {
1110
+ return {
1111
+ path: filePath,
1112
+ action: "skip",
1113
+ error: error instanceof Error ? error.message : String(error)
1114
+ };
1115
+ }
1116
+ }
1117
+ async function writeFilesWithProgress(files, options = {}) {
1118
+ const results = [];
1119
+ const home = homedir();
1120
+ const spinner = Y2();
1121
+ spinner.start("Writing configuration files...");
1122
+ for (const file of files) {
1123
+ let result;
1124
+ if (file.type === "json") {
1125
+ const jsonContent = JSON.parse(file.content);
1126
+ result = mergeJsonFile(file.path, jsonContent, options);
1127
+ } else if (file.type === "toml" && file.tomlSection) {
1128
+ result = appendToToml(file.path, file.tomlSection, file.content, options);
1129
+ } else {
1130
+ result = writeFile(file.path, file.content, options);
1131
+ }
1132
+ results.push(result);
1133
+ await new Promise((resolve) => setTimeout(resolve, 50));
1134
+ }
1135
+ spinner.stop("Files written");
1136
+ for (const result of results) {
1137
+ const displayPath = formatPath(result.path, home);
1138
+ if (result.error) {
1139
+ console.log(messages.fileError(displayPath, result.error));
1140
+ } else if (result.action === "skip") {
1141
+ console.log(messages.fileSkipped(displayPath));
1142
+ } else {
1143
+ const actionLabel = result.action === "merge" ? "updated" : "created";
1144
+ console.log(` ${colors.success("✓")} ${colors.dim(displayPath)} ${colors.dim(`(${actionLabel})`)}`);
1145
+ }
1146
+ }
1147
+ return results;
1148
+ }
1149
+ function getWriteSummary(files, options = {}) {
1150
+ const toCreate = [];
1151
+ const toUpdate = [];
1152
+ const toSkip = [];
1153
+ const home = homedir();
1154
+ for (const file of files) {
1155
+ const displayPath = formatPath(file.path, home);
1156
+ const exists = existsSync(file.path);
1157
+ if (exists && !options.force) {
1158
+ toSkip.push(displayPath);
1159
+ } else if (exists) {
1160
+ toUpdate.push(displayPath);
1161
+ } else {
1162
+ toCreate.push(displayPath);
198
1163
  }
199
- return { toCreate, toUpdate, toSkip };
1164
+ }
1165
+ return { toCreate, toUpdate, toSkip };
200
1166
  }
1167
+ export {
1168
+ writeFilesWithProgress,
1169
+ writeFile,
1170
+ mergeJsonFile,
1171
+ getWriteSummary,
1172
+ appendToToml
1173
+ };