@devness/useai 0.8.6 → 0.8.8
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/index.js +399 -799
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -39,545 +39,76 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
39
|
mod
|
|
40
40
|
));
|
|
41
41
|
|
|
42
|
-
// ../../node_modules/.pnpm/
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
styles.color.ansi = wrapAnsi16();
|
|
66
|
-
styles.color.ansi256 = wrapAnsi256();
|
|
67
|
-
styles.color.ansi16m = wrapAnsi16m();
|
|
68
|
-
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
69
|
-
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
70
|
-
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
71
|
-
Object.defineProperties(styles, {
|
|
72
|
-
rgbToAnsi256: {
|
|
73
|
-
value(red, green, blue) {
|
|
74
|
-
if (red === green && green === blue) {
|
|
75
|
-
if (red < 8) {
|
|
76
|
-
return 16;
|
|
77
|
-
}
|
|
78
|
-
if (red > 248) {
|
|
79
|
-
return 231;
|
|
80
|
-
}
|
|
81
|
-
return Math.round((red - 8) / 247 * 24) + 232;
|
|
82
|
-
}
|
|
83
|
-
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
84
|
-
},
|
|
85
|
-
enumerable: false
|
|
86
|
-
},
|
|
87
|
-
hexToRgb: {
|
|
88
|
-
value(hex) {
|
|
89
|
-
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
90
|
-
if (!matches) {
|
|
91
|
-
return [0, 0, 0];
|
|
92
|
-
}
|
|
93
|
-
let [colorString] = matches;
|
|
94
|
-
if (colorString.length === 3) {
|
|
95
|
-
colorString = [...colorString].map((character) => character + character).join("");
|
|
96
|
-
}
|
|
97
|
-
const integer2 = Number.parseInt(colorString, 16);
|
|
98
|
-
return [
|
|
99
|
-
/* eslint-disable no-bitwise */
|
|
100
|
-
integer2 >> 16 & 255,
|
|
101
|
-
integer2 >> 8 & 255,
|
|
102
|
-
integer2 & 255
|
|
103
|
-
/* eslint-enable no-bitwise */
|
|
104
|
-
];
|
|
105
|
-
},
|
|
106
|
-
enumerable: false
|
|
107
|
-
},
|
|
108
|
-
hexToAnsi256: {
|
|
109
|
-
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
110
|
-
enumerable: false
|
|
111
|
-
},
|
|
112
|
-
ansi256ToAnsi: {
|
|
113
|
-
value(code) {
|
|
114
|
-
if (code < 8) {
|
|
115
|
-
return 30 + code;
|
|
116
|
-
}
|
|
117
|
-
if (code < 16) {
|
|
118
|
-
return 90 + (code - 8);
|
|
119
|
-
}
|
|
120
|
-
let red;
|
|
121
|
-
let green;
|
|
122
|
-
let blue;
|
|
123
|
-
if (code >= 232) {
|
|
124
|
-
red = ((code - 232) * 10 + 8) / 255;
|
|
125
|
-
green = red;
|
|
126
|
-
blue = red;
|
|
127
|
-
} else {
|
|
128
|
-
code -= 16;
|
|
129
|
-
const remainder = code % 36;
|
|
130
|
-
red = Math.floor(code / 36) / 5;
|
|
131
|
-
green = Math.floor(remainder / 6) / 5;
|
|
132
|
-
blue = remainder % 6 / 5;
|
|
133
|
-
}
|
|
134
|
-
const value = Math.max(red, green, blue) * 2;
|
|
135
|
-
if (value === 0) {
|
|
136
|
-
return 30;
|
|
137
|
-
}
|
|
138
|
-
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
139
|
-
if (value === 2) {
|
|
140
|
-
result += 60;
|
|
141
|
-
}
|
|
142
|
-
return result;
|
|
143
|
-
},
|
|
144
|
-
enumerable: false
|
|
145
|
-
},
|
|
146
|
-
rgbToAnsi: {
|
|
147
|
-
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
148
|
-
enumerable: false
|
|
149
|
-
},
|
|
150
|
-
hexToAnsi: {
|
|
151
|
-
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
152
|
-
enumerable: false
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
return styles;
|
|
156
|
-
}
|
|
157
|
-
var ANSI_BACKGROUND_OFFSET, wrapAnsi16, wrapAnsi256, wrapAnsi16m, styles, modifierNames, foregroundColorNames, backgroundColorNames, colorNames, ansiStyles, ansi_styles_default;
|
|
158
|
-
var init_ansi_styles = __esm({
|
|
159
|
-
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/ansi-styles/index.js"() {
|
|
160
|
-
"use strict";
|
|
161
|
-
ANSI_BACKGROUND_OFFSET = 10;
|
|
162
|
-
wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
163
|
-
wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
164
|
-
wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
165
|
-
styles = {
|
|
166
|
-
modifier: {
|
|
167
|
-
reset: [0, 0],
|
|
168
|
-
// 21 isn't widely supported and 22 does the same thing
|
|
169
|
-
bold: [1, 22],
|
|
170
|
-
dim: [2, 22],
|
|
171
|
-
italic: [3, 23],
|
|
172
|
-
underline: [4, 24],
|
|
173
|
-
overline: [53, 55],
|
|
174
|
-
inverse: [7, 27],
|
|
175
|
-
hidden: [8, 28],
|
|
176
|
-
strikethrough: [9, 29]
|
|
177
|
-
},
|
|
178
|
-
color: {
|
|
179
|
-
black: [30, 39],
|
|
180
|
-
red: [31, 39],
|
|
181
|
-
green: [32, 39],
|
|
182
|
-
yellow: [33, 39],
|
|
183
|
-
blue: [34, 39],
|
|
184
|
-
magenta: [35, 39],
|
|
185
|
-
cyan: [36, 39],
|
|
186
|
-
white: [37, 39],
|
|
187
|
-
// Bright color
|
|
188
|
-
blackBright: [90, 39],
|
|
189
|
-
gray: [90, 39],
|
|
190
|
-
// Alias of `blackBright`
|
|
191
|
-
grey: [90, 39],
|
|
192
|
-
// Alias of `blackBright`
|
|
193
|
-
redBright: [91, 39],
|
|
194
|
-
greenBright: [92, 39],
|
|
195
|
-
yellowBright: [93, 39],
|
|
196
|
-
blueBright: [94, 39],
|
|
197
|
-
magentaBright: [95, 39],
|
|
198
|
-
cyanBright: [96, 39],
|
|
199
|
-
whiteBright: [97, 39]
|
|
200
|
-
},
|
|
201
|
-
bgColor: {
|
|
202
|
-
bgBlack: [40, 49],
|
|
203
|
-
bgRed: [41, 49],
|
|
204
|
-
bgGreen: [42, 49],
|
|
205
|
-
bgYellow: [43, 49],
|
|
206
|
-
bgBlue: [44, 49],
|
|
207
|
-
bgMagenta: [45, 49],
|
|
208
|
-
bgCyan: [46, 49],
|
|
209
|
-
bgWhite: [47, 49],
|
|
210
|
-
// Bright color
|
|
211
|
-
bgBlackBright: [100, 49],
|
|
212
|
-
bgGray: [100, 49],
|
|
213
|
-
// Alias of `bgBlackBright`
|
|
214
|
-
bgGrey: [100, 49],
|
|
215
|
-
// Alias of `bgBlackBright`
|
|
216
|
-
bgRedBright: [101, 49],
|
|
217
|
-
bgGreenBright: [102, 49],
|
|
218
|
-
bgYellowBright: [103, 49],
|
|
219
|
-
bgBlueBright: [104, 49],
|
|
220
|
-
bgMagentaBright: [105, 49],
|
|
221
|
-
bgCyanBright: [106, 49],
|
|
222
|
-
bgWhiteBright: [107, 49]
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
modifierNames = Object.keys(styles.modifier);
|
|
226
|
-
foregroundColorNames = Object.keys(styles.color);
|
|
227
|
-
backgroundColorNames = Object.keys(styles.bgColor);
|
|
228
|
-
colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
229
|
-
ansiStyles = assembleStyles();
|
|
230
|
-
ansi_styles_default = ansiStyles;
|
|
231
|
-
}
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js
|
|
235
|
-
import process2 from "process";
|
|
236
|
-
import os from "os";
|
|
237
|
-
import tty from "tty";
|
|
238
|
-
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
239
|
-
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
240
|
-
const position = argv.indexOf(prefix + flag);
|
|
241
|
-
const terminatorPosition = argv.indexOf("--");
|
|
242
|
-
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
243
|
-
}
|
|
244
|
-
function envForceColor() {
|
|
245
|
-
if ("FORCE_COLOR" in env) {
|
|
246
|
-
if (env.FORCE_COLOR === "true") {
|
|
247
|
-
return 1;
|
|
248
|
-
}
|
|
249
|
-
if (env.FORCE_COLOR === "false") {
|
|
250
|
-
return 0;
|
|
251
|
-
}
|
|
252
|
-
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
function translateLevel(level) {
|
|
256
|
-
if (level === 0) {
|
|
257
|
-
return false;
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
level,
|
|
261
|
-
hasBasic: true,
|
|
262
|
-
has256: level >= 2,
|
|
263
|
-
has16m: level >= 3
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
267
|
-
const noFlagForceColor = envForceColor();
|
|
268
|
-
if (noFlagForceColor !== void 0) {
|
|
269
|
-
flagForceColor = noFlagForceColor;
|
|
270
|
-
}
|
|
271
|
-
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
272
|
-
if (forceColor === 0) {
|
|
273
|
-
return 0;
|
|
274
|
-
}
|
|
275
|
-
if (sniffFlags) {
|
|
276
|
-
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
277
|
-
return 3;
|
|
278
|
-
}
|
|
279
|
-
if (hasFlag("color=256")) {
|
|
280
|
-
return 2;
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
284
|
-
return 1;
|
|
285
|
-
}
|
|
286
|
-
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
287
|
-
return 0;
|
|
288
|
-
}
|
|
289
|
-
const min = forceColor || 0;
|
|
290
|
-
if (env.TERM === "dumb") {
|
|
291
|
-
return min;
|
|
292
|
-
}
|
|
293
|
-
if (process2.platform === "win32") {
|
|
294
|
-
const osRelease = os.release().split(".");
|
|
295
|
-
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
296
|
-
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
297
|
-
}
|
|
298
|
-
return 1;
|
|
299
|
-
}
|
|
300
|
-
if ("CI" in env) {
|
|
301
|
-
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
302
|
-
return 3;
|
|
303
|
-
}
|
|
304
|
-
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
305
|
-
return 1;
|
|
306
|
-
}
|
|
307
|
-
return min;
|
|
308
|
-
}
|
|
309
|
-
if ("TEAMCITY_VERSION" in env) {
|
|
310
|
-
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
311
|
-
}
|
|
312
|
-
if (env.COLORTERM === "truecolor") {
|
|
313
|
-
return 3;
|
|
314
|
-
}
|
|
315
|
-
if (env.TERM === "xterm-kitty") {
|
|
316
|
-
return 3;
|
|
317
|
-
}
|
|
318
|
-
if (env.TERM === "xterm-ghostty") {
|
|
319
|
-
return 3;
|
|
320
|
-
}
|
|
321
|
-
if (env.TERM === "wezterm") {
|
|
322
|
-
return 3;
|
|
323
|
-
}
|
|
324
|
-
if ("TERM_PROGRAM" in env) {
|
|
325
|
-
const version2 = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
326
|
-
switch (env.TERM_PROGRAM) {
|
|
327
|
-
case "iTerm.app": {
|
|
328
|
-
return version2 >= 3 ? 3 : 2;
|
|
329
|
-
}
|
|
330
|
-
case "Apple_Terminal": {
|
|
331
|
-
return 2;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
if (/-256(color)?$/i.test(env.TERM)) {
|
|
336
|
-
return 2;
|
|
337
|
-
}
|
|
338
|
-
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
339
|
-
return 1;
|
|
340
|
-
}
|
|
341
|
-
if ("COLORTERM" in env) {
|
|
342
|
-
return 1;
|
|
343
|
-
}
|
|
344
|
-
return min;
|
|
345
|
-
}
|
|
346
|
-
function createSupportsColor(stream, options = {}) {
|
|
347
|
-
const level = _supportsColor(stream, {
|
|
348
|
-
streamIsTTY: stream && stream.isTTY,
|
|
349
|
-
...options
|
|
350
|
-
});
|
|
351
|
-
return translateLevel(level);
|
|
352
|
-
}
|
|
353
|
-
var env, flagForceColor, supportsColor, supports_color_default;
|
|
354
|
-
var init_supports_color = __esm({
|
|
355
|
-
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/vendor/supports-color/index.js"() {
|
|
356
|
-
"use strict";
|
|
357
|
-
({ env } = process2);
|
|
358
|
-
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
359
|
-
flagForceColor = 0;
|
|
360
|
-
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
361
|
-
flagForceColor = 1;
|
|
362
|
-
}
|
|
363
|
-
supportsColor = {
|
|
364
|
-
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
365
|
-
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
366
|
-
};
|
|
367
|
-
supports_color_default = supportsColor;
|
|
368
|
-
}
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js
|
|
372
|
-
function stringReplaceAll(string3, substring, replacer) {
|
|
373
|
-
let index = string3.indexOf(substring);
|
|
374
|
-
if (index === -1) {
|
|
375
|
-
return string3;
|
|
376
|
-
}
|
|
377
|
-
const substringLength = substring.length;
|
|
378
|
-
let endIndex = 0;
|
|
379
|
-
let returnValue = "";
|
|
380
|
-
do {
|
|
381
|
-
returnValue += string3.slice(endIndex, index) + substring + replacer;
|
|
382
|
-
endIndex = index + substringLength;
|
|
383
|
-
index = string3.indexOf(substring, endIndex);
|
|
384
|
-
} while (index !== -1);
|
|
385
|
-
returnValue += string3.slice(endIndex);
|
|
386
|
-
return returnValue;
|
|
387
|
-
}
|
|
388
|
-
function stringEncaseCRLFWithFirstIndex(string3, prefix, postfix, index) {
|
|
389
|
-
let endIndex = 0;
|
|
390
|
-
let returnValue = "";
|
|
391
|
-
do {
|
|
392
|
-
const gotCR = string3[index - 1] === "\r";
|
|
393
|
-
returnValue += string3.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
394
|
-
endIndex = index + 1;
|
|
395
|
-
index = string3.indexOf("\n", endIndex);
|
|
396
|
-
} while (index !== -1);
|
|
397
|
-
returnValue += string3.slice(endIndex);
|
|
398
|
-
return returnValue;
|
|
399
|
-
}
|
|
400
|
-
var init_utilities = __esm({
|
|
401
|
-
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/utilities.js"() {
|
|
402
|
-
"use strict";
|
|
403
|
-
}
|
|
404
|
-
});
|
|
405
|
-
|
|
406
|
-
// ../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js
|
|
407
|
-
var source_exports = {};
|
|
408
|
-
__export(source_exports, {
|
|
409
|
-
Chalk: () => Chalk,
|
|
410
|
-
backgroundColorNames: () => backgroundColorNames,
|
|
411
|
-
backgroundColors: () => backgroundColorNames,
|
|
412
|
-
chalkStderr: () => chalkStderr,
|
|
413
|
-
colorNames: () => colorNames,
|
|
414
|
-
colors: () => colorNames,
|
|
415
|
-
default: () => source_default,
|
|
416
|
-
foregroundColorNames: () => foregroundColorNames,
|
|
417
|
-
foregroundColors: () => foregroundColorNames,
|
|
418
|
-
modifierNames: () => modifierNames,
|
|
419
|
-
modifiers: () => modifierNames,
|
|
420
|
-
supportsColor: () => stdoutColor,
|
|
421
|
-
supportsColorStderr: () => stderrColor
|
|
422
|
-
});
|
|
423
|
-
function createChalk(options) {
|
|
424
|
-
return chalkFactory(options);
|
|
425
|
-
}
|
|
426
|
-
var stdoutColor, stderrColor, GENERATOR, STYLER, IS_EMPTY, levelMapping, styles2, applyOptions, Chalk, chalkFactory, getModelAnsi, usedModels, proto, createStyler, createBuilder, applyStyle, chalk, chalkStderr, source_default;
|
|
427
|
-
var init_source = __esm({
|
|
428
|
-
"../../node_modules/.pnpm/chalk@5.6.2/node_modules/chalk/source/index.js"() {
|
|
429
|
-
"use strict";
|
|
430
|
-
init_ansi_styles();
|
|
431
|
-
init_supports_color();
|
|
432
|
-
init_utilities();
|
|
433
|
-
init_ansi_styles();
|
|
434
|
-
({ stdout: stdoutColor, stderr: stderrColor } = supports_color_default);
|
|
435
|
-
GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
436
|
-
STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
437
|
-
IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
438
|
-
levelMapping = [
|
|
439
|
-
"ansi",
|
|
440
|
-
"ansi",
|
|
441
|
-
"ansi256",
|
|
442
|
-
"ansi16m"
|
|
443
|
-
];
|
|
444
|
-
styles2 = /* @__PURE__ */ Object.create(null);
|
|
445
|
-
applyOptions = (object3, options = {}) => {
|
|
446
|
-
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
447
|
-
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
448
|
-
}
|
|
449
|
-
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
450
|
-
object3.level = options.level === void 0 ? colorLevel : options.level;
|
|
451
|
-
};
|
|
452
|
-
Chalk = class {
|
|
453
|
-
constructor(options) {
|
|
454
|
-
return chalkFactory(options);
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
chalkFactory = (options) => {
|
|
458
|
-
const chalk2 = (...strings) => strings.join(" ");
|
|
459
|
-
applyOptions(chalk2, options);
|
|
460
|
-
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
461
|
-
return chalk2;
|
|
462
|
-
};
|
|
463
|
-
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
464
|
-
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
465
|
-
styles2[styleName] = {
|
|
466
|
-
get() {
|
|
467
|
-
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
468
|
-
Object.defineProperty(this, styleName, { value: builder });
|
|
469
|
-
return builder;
|
|
470
|
-
}
|
|
471
|
-
};
|
|
472
|
-
}
|
|
473
|
-
styles2.visible = {
|
|
474
|
-
get() {
|
|
475
|
-
const builder = createBuilder(this, this[STYLER], true);
|
|
476
|
-
Object.defineProperty(this, "visible", { value: builder });
|
|
477
|
-
return builder;
|
|
478
|
-
}
|
|
479
|
-
};
|
|
480
|
-
getModelAnsi = (model, level, type, ...arguments_) => {
|
|
481
|
-
if (model === "rgb") {
|
|
482
|
-
if (level === "ansi16m") {
|
|
483
|
-
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
484
|
-
}
|
|
485
|
-
if (level === "ansi256") {
|
|
486
|
-
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
487
|
-
}
|
|
488
|
-
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
489
|
-
}
|
|
490
|
-
if (model === "hex") {
|
|
491
|
-
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
492
|
-
}
|
|
493
|
-
return ansi_styles_default[type][model](...arguments_);
|
|
494
|
-
};
|
|
495
|
-
usedModels = ["rgb", "hex", "ansi256"];
|
|
496
|
-
for (const model of usedModels) {
|
|
497
|
-
styles2[model] = {
|
|
498
|
-
get() {
|
|
499
|
-
const { level } = this;
|
|
500
|
-
return function(...arguments_) {
|
|
501
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
502
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
503
|
-
};
|
|
504
|
-
}
|
|
505
|
-
};
|
|
506
|
-
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
507
|
-
styles2[bgModel] = {
|
|
508
|
-
get() {
|
|
509
|
-
const { level } = this;
|
|
510
|
-
return function(...arguments_) {
|
|
511
|
-
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
512
|
-
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
proto = Object.defineProperties(() => {
|
|
518
|
-
}, {
|
|
519
|
-
...styles2,
|
|
520
|
-
level: {
|
|
521
|
-
enumerable: true,
|
|
522
|
-
get() {
|
|
523
|
-
return this[GENERATOR].level;
|
|
524
|
-
},
|
|
525
|
-
set(level) {
|
|
526
|
-
this[GENERATOR].level = level;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
});
|
|
530
|
-
createStyler = (open, close, parent) => {
|
|
531
|
-
let openAll;
|
|
532
|
-
let closeAll;
|
|
533
|
-
if (parent === void 0) {
|
|
534
|
-
openAll = open;
|
|
535
|
-
closeAll = close;
|
|
536
|
-
} else {
|
|
537
|
-
openAll = parent.openAll + open;
|
|
538
|
-
closeAll = close + parent.closeAll;
|
|
539
|
-
}
|
|
42
|
+
// ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
43
|
+
var require_picocolors = __commonJS({
|
|
44
|
+
"../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js"(exports, module) {
|
|
45
|
+
"use strict";
|
|
46
|
+
var p = process || {};
|
|
47
|
+
var argv = p.argv || [];
|
|
48
|
+
var env = p.env || {};
|
|
49
|
+
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);
|
|
50
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
51
|
+
let string3 = "" + input, index = string3.indexOf(close, open.length);
|
|
52
|
+
return ~index ? open + replaceClose(string3, close, replace, index) + close : open + string3 + close;
|
|
53
|
+
};
|
|
54
|
+
var replaceClose = (string3, close, replace, index) => {
|
|
55
|
+
let result = "", cursor = 0;
|
|
56
|
+
do {
|
|
57
|
+
result += string3.substring(cursor, index) + replace;
|
|
58
|
+
cursor = index + close.length;
|
|
59
|
+
index = string3.indexOf(close, cursor);
|
|
60
|
+
} while (~index);
|
|
61
|
+
return result + string3.substring(cursor);
|
|
62
|
+
};
|
|
63
|
+
var createColors = (enabled = isColorSupported) => {
|
|
64
|
+
let f = enabled ? formatter : () => String;
|
|
540
65
|
return {
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
66
|
+
isColorSupported: enabled,
|
|
67
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
68
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
69
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
70
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
71
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
72
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
73
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
74
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
75
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
76
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
77
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
78
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
79
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
80
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
81
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
82
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
83
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
84
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
85
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
86
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
87
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
88
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
89
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
90
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
91
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
92
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
93
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
94
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
95
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
96
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
97
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
98
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
99
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
100
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
101
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
102
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
103
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
104
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
105
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
106
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
107
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
546
108
|
};
|
|
547
109
|
};
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
Object.setPrototypeOf(builder, proto);
|
|
551
|
-
builder[GENERATOR] = self;
|
|
552
|
-
builder[STYLER] = _styler;
|
|
553
|
-
builder[IS_EMPTY] = _isEmpty;
|
|
554
|
-
return builder;
|
|
555
|
-
};
|
|
556
|
-
applyStyle = (self, string3) => {
|
|
557
|
-
if (self.level <= 0 || !string3) {
|
|
558
|
-
return self[IS_EMPTY] ? "" : string3;
|
|
559
|
-
}
|
|
560
|
-
let styler = self[STYLER];
|
|
561
|
-
if (styler === void 0) {
|
|
562
|
-
return string3;
|
|
563
|
-
}
|
|
564
|
-
const { openAll, closeAll } = styler;
|
|
565
|
-
if (string3.includes("\x1B")) {
|
|
566
|
-
while (styler !== void 0) {
|
|
567
|
-
string3 = stringReplaceAll(string3, styler.close, styler.open);
|
|
568
|
-
styler = styler.parent;
|
|
569
|
-
}
|
|
570
|
-
}
|
|
571
|
-
const lfIndex = string3.indexOf("\n");
|
|
572
|
-
if (lfIndex !== -1) {
|
|
573
|
-
string3 = stringEncaseCRLFWithFirstIndex(string3, closeAll, openAll, lfIndex);
|
|
574
|
-
}
|
|
575
|
-
return openAll + string3 + closeAll;
|
|
576
|
-
};
|
|
577
|
-
Object.defineProperties(createChalk.prototype, styles2);
|
|
578
|
-
chalk = createChalk();
|
|
579
|
-
chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
580
|
-
source_default = chalk;
|
|
110
|
+
module.exports = createColors();
|
|
111
|
+
module.exports.createColors = createColors;
|
|
581
112
|
}
|
|
582
113
|
});
|
|
583
114
|
|
|
@@ -684,7 +215,7 @@ var VERSION;
|
|
|
684
215
|
var init_version = __esm({
|
|
685
216
|
"../shared/dist/constants/version.js"() {
|
|
686
217
|
"use strict";
|
|
687
|
-
VERSION = "0.8.
|
|
218
|
+
VERSION = "0.8.8";
|
|
688
219
|
}
|
|
689
220
|
});
|
|
690
221
|
|
|
@@ -5488,13 +5019,13 @@ function normalizeMcpClientName(mcpName) {
|
|
|
5488
5019
|
return MCP_CLIENT_NAME_MAP[lower] ?? lower;
|
|
5489
5020
|
}
|
|
5490
5021
|
function detectClient() {
|
|
5491
|
-
const
|
|
5022
|
+
const env = process.env;
|
|
5492
5023
|
for (const [envVar, clientName] of Object.entries(AI_CLIENT_ENV_VARS)) {
|
|
5493
|
-
if (
|
|
5024
|
+
if (env[envVar])
|
|
5494
5025
|
return clientName;
|
|
5495
5026
|
}
|
|
5496
|
-
if (
|
|
5497
|
-
return
|
|
5027
|
+
if (env.MCP_CLIENT_NAME)
|
|
5028
|
+
return env.MCP_CLIENT_NAME;
|
|
5498
5029
|
return "unknown";
|
|
5499
5030
|
}
|
|
5500
5031
|
var MCP_CLIENT_NAME_MAP;
|
|
@@ -14465,7 +13996,7 @@ var init_tools2 = __esm({
|
|
|
14465
13996
|
name: "Copilot CLI",
|
|
14466
13997
|
configFormat: "standard",
|
|
14467
13998
|
configPath: join4(home, ".copilot", "mcp-config.json"),
|
|
14468
|
-
detect: () =>
|
|
13999
|
+
detect: () => existsSync6(join4(home, ".copilot")) || hasBinary("copilot"),
|
|
14469
14000
|
manualHint: "No global instructions file \u2014 add UseAI instructions to your project-level agent rules."
|
|
14470
14001
|
}),
|
|
14471
14002
|
createExtraTool({
|
|
@@ -14499,7 +14030,7 @@ var init_tools2 = __esm({
|
|
|
14499
14030
|
name: "Crush",
|
|
14500
14031
|
configFormat: "crush",
|
|
14501
14032
|
configPath: join4(home, ".config", "crush", "crush.json"),
|
|
14502
|
-
detect: () =>
|
|
14033
|
+
detect: () => existsSync6(join4(home, ".config", "crush")) || hasBinary("crush"),
|
|
14503
14034
|
manualHint: "No global instructions file \u2014 add UseAI instructions to your project-level .crush.json."
|
|
14504
14035
|
})
|
|
14505
14036
|
];
|
|
@@ -14512,211 +14043,192 @@ var setup_exports = {};
|
|
|
14512
14043
|
__export(setup_exports, {
|
|
14513
14044
|
runSetup: () => runSetup
|
|
14514
14045
|
});
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
resolveTools,
|
|
14523
|
-
instructionsText: USEAI_INSTRUCTIONS_TEXT
|
|
14524
|
-
});
|
|
14525
|
-
}
|
|
14526
|
-
return _shared;
|
|
14046
|
+
async function getClack() {
|
|
14047
|
+
if (!_p) _p = await import("@clack/prompts");
|
|
14048
|
+
return _p;
|
|
14049
|
+
}
|
|
14050
|
+
function shortenPath(path) {
|
|
14051
|
+
const home2 = process.env["HOME"] ?? "";
|
|
14052
|
+
return home2 && path.startsWith(home2) ? "~" + path.slice(home2.length) : path;
|
|
14527
14053
|
}
|
|
14528
|
-
|
|
14054
|
+
function showManualHints(p, installedTools) {
|
|
14055
|
+
const hints = installedTools.map((t) => ({ name: t.name, hint: t.getManualHint() })).filter((h) => h.hint !== null);
|
|
14056
|
+
if (hints.length === 0) return;
|
|
14057
|
+
const lines = hints.map(({ name, hint }) => `${import_picocolors.default.bold(name)}: ${hint}`);
|
|
14058
|
+
lines.push("", ...USEAI_INSTRUCTIONS_TEXT.split("\n"));
|
|
14059
|
+
p.note(lines.join("\n"), `Manual setup needed for ${hints.length} tool${hints.length === 1 ? "" : "s"}`);
|
|
14060
|
+
}
|
|
14061
|
+
function configureToolAndCollect(tool, useDaemon) {
|
|
14529
14062
|
try {
|
|
14530
|
-
|
|
14531
|
-
|
|
14532
|
-
|
|
14533
|
-
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
14534
|
-
try {
|
|
14535
|
-
console.log(` ${message}
|
|
14536
|
-
`);
|
|
14537
|
-
choices.forEach((c, i) => {
|
|
14538
|
-
const marker = c.checked !== false ? source_default.green("*") : " ";
|
|
14539
|
-
console.log(` ${marker} ${i + 1}. ${c.name}`);
|
|
14540
|
-
});
|
|
14541
|
-
console.log();
|
|
14542
|
-
const answer = await rl.question(" Enter numbers to select (comma-separated), or press Enter for all: ");
|
|
14543
|
-
if (!answer.trim()) return choices.map((c) => c.value);
|
|
14544
|
-
const indices = answer.split(",").map((n) => parseInt(n.trim(), 10) - 1);
|
|
14545
|
-
return choices.filter((_, i) => indices.includes(i)).map((c) => c.value);
|
|
14546
|
-
} finally {
|
|
14547
|
-
rl.close();
|
|
14063
|
+
if (useDaemon && tool.supportsUrl) {
|
|
14064
|
+
tool.installHttp();
|
|
14065
|
+
return { tool, ok: true, mode: "http" };
|
|
14548
14066
|
}
|
|
14067
|
+
tool.install();
|
|
14068
|
+
return { tool, ok: true, mode: "stdio" };
|
|
14069
|
+
} catch (e) {
|
|
14070
|
+
return { tool, ok: false, mode: "stdio", error: e.message };
|
|
14549
14071
|
}
|
|
14550
14072
|
}
|
|
14551
|
-
function
|
|
14552
|
-
const
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
`));
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
14562
|
-
|
|
14563
|
-
|
|
14564
|
-
console.log();
|
|
14565
|
-
}
|
|
14566
|
-
function startSpinner(message) {
|
|
14567
|
-
let frame = 0;
|
|
14568
|
-
const interval = setInterval(() => {
|
|
14569
|
-
const symbol = source_default.cyan(SPINNER_FRAMES[frame % SPINNER_FRAMES.length]);
|
|
14570
|
-
process.stdout.write(`\r ${symbol} ${source_default.dim(message)}`);
|
|
14571
|
-
frame++;
|
|
14572
|
-
}, 80);
|
|
14573
|
-
return {
|
|
14574
|
-
stop(finalMessage) {
|
|
14575
|
-
clearInterval(interval);
|
|
14576
|
-
process.stdout.write(`\r${" ".repeat(message.length + 10)}\r`);
|
|
14577
|
-
console.log(finalMessage);
|
|
14073
|
+
function showGroupedResults(p, results) {
|
|
14074
|
+
const httpOk = results.filter((r) => r.ok && r.mode === "http");
|
|
14075
|
+
const stdioOk = results.filter((r) => r.ok && r.mode === "stdio");
|
|
14076
|
+
const failed = results.filter((r) => !r.ok);
|
|
14077
|
+
if (httpOk.length > 0) {
|
|
14078
|
+
p.log.success(`HTTP (daemon): ${httpOk.map((r) => r.tool.name).join(", ")}`);
|
|
14079
|
+
}
|
|
14080
|
+
if (stdioOk.length > 0) {
|
|
14081
|
+
p.log.success(`stdio: ${stdioOk.map((r) => r.tool.name).join(", ")}`);
|
|
14082
|
+
}
|
|
14083
|
+
if (failed.length > 0) {
|
|
14084
|
+
for (const r of failed) {
|
|
14085
|
+
p.log.error(`${r.tool.name} \u2014 ${r.error}`);
|
|
14578
14086
|
}
|
|
14579
|
-
}
|
|
14087
|
+
}
|
|
14580
14088
|
}
|
|
14581
14089
|
async function daemonInstallFlow(tools, autoYes, explicit) {
|
|
14582
|
-
const
|
|
14090
|
+
const p = await getClack();
|
|
14091
|
+
p.intro(import_picocolors.default.bgCyan(import_picocolors.default.black(" useai ")));
|
|
14092
|
+
const s = p.spinner();
|
|
14093
|
+
s.start("Starting UseAI daemon...");
|
|
14583
14094
|
const daemonOk = await ensureDaemon();
|
|
14584
14095
|
if (!daemonOk) {
|
|
14585
|
-
|
|
14586
|
-
|
|
14587
|
-
|
|
14588
|
-
|
|
14589
|
-
|
|
14590
|
-
|
|
14096
|
+
s.stop("Could not start daemon");
|
|
14097
|
+
p.note(
|
|
14098
|
+
[
|
|
14099
|
+
"Check if the port is in use:",
|
|
14100
|
+
` lsof -i :${DAEMON_PORT}`,
|
|
14101
|
+
"",
|
|
14102
|
+
"Run in foreground to debug:",
|
|
14103
|
+
` npx @devness/useai daemon --port ${DAEMON_PORT}`,
|
|
14104
|
+
"",
|
|
14105
|
+
"For containers/CI, use stdio mode:",
|
|
14106
|
+
" npx @devness/useai mcp --stdio"
|
|
14107
|
+
].join("\n"),
|
|
14108
|
+
"Troubleshooting"
|
|
14109
|
+
);
|
|
14110
|
+
p.outro("Setup failed.");
|
|
14591
14111
|
return;
|
|
14592
14112
|
}
|
|
14593
14113
|
const useDaemon = true;
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14602
|
-
|
|
14603
|
-
console.log(source_default.yellow(` \u26A0 Could not install auto-start service`));
|
|
14604
|
-
}
|
|
14114
|
+
s.stop(`Daemon running on port ${DAEMON_PORT}`);
|
|
14115
|
+
p.log.info(`Dashboard: ${import_picocolors.default.cyan(`http://127.0.0.1:${DAEMON_PORT}/dashboard`)}`);
|
|
14116
|
+
const platform = detectPlatform();
|
|
14117
|
+
if (platform !== "unsupported") {
|
|
14118
|
+
try {
|
|
14119
|
+
installAutostart();
|
|
14120
|
+
p.log.success(`Auto-start service installed (${platform})`);
|
|
14121
|
+
} catch {
|
|
14122
|
+
p.log.warn("Could not install auto-start service");
|
|
14605
14123
|
}
|
|
14606
14124
|
}
|
|
14607
14125
|
if (explicit) {
|
|
14608
|
-
|
|
14609
|
-
let configuredCount2 = 0;
|
|
14126
|
+
const results2 = [];
|
|
14610
14127
|
for (const tool of tools) {
|
|
14611
|
-
|
|
14612
|
-
configureToolDaemon(tool, useDaemon);
|
|
14613
|
-
configuredCount2++;
|
|
14614
|
-
} catch (e) {
|
|
14615
|
-
console.log(source_default.red(` \u2717 ${tool.name.padEnd(18)} \u2014 ${e.message}`));
|
|
14616
|
-
}
|
|
14128
|
+
results2.push(configureToolAndCollect(tool, useDaemon));
|
|
14617
14129
|
}
|
|
14618
|
-
|
|
14130
|
+
showGroupedResults(p, results2);
|
|
14131
|
+
installHooksAndFinish(p, tools, results2.filter((r) => r.ok).length, useDaemon);
|
|
14619
14132
|
return;
|
|
14620
14133
|
}
|
|
14621
|
-
|
|
14134
|
+
const scanSpinner = p.spinner();
|
|
14135
|
+
scanSpinner.start("Scanning for AI tools...");
|
|
14622
14136
|
const detected = tools.filter((t) => t.detect());
|
|
14137
|
+
scanSpinner.stop(`Found ${detected.length} AI tool${detected.length === 1 ? "" : "s"}`);
|
|
14623
14138
|
if (detected.length === 0) {
|
|
14624
|
-
|
|
14139
|
+
p.log.error("No AI tools detected on this machine.");
|
|
14140
|
+
p.outro("Setup complete.");
|
|
14625
14141
|
return;
|
|
14626
14142
|
}
|
|
14627
14143
|
const alreadyConfigured = detected.filter((t) => t.isConfigured());
|
|
14628
14144
|
const unconfigured = detected.filter((t) => !t.isConfigured());
|
|
14629
|
-
|
|
14630
|
-
`)
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
}
|
|
14634
|
-
for (const tool of unconfigured) {
|
|
14635
|
-
console.log(source_default.dim(` \u2610 ${tool.name}`));
|
|
14636
|
-
}
|
|
14637
|
-
console.log();
|
|
14145
|
+
const toolLines = [
|
|
14146
|
+
...alreadyConfigured.map((t) => `${import_picocolors.default.green("\u2713")} ${t.name} ${import_picocolors.default.dim("(already configured)")}`),
|
|
14147
|
+
...unconfigured.map((t) => `${import_picocolors.default.dim("\u25CB")} ${t.name}`)
|
|
14148
|
+
];
|
|
14149
|
+
p.note(toolLines.join("\n"), `${detected.length} AI tool${detected.length === 1 ? "" : "s"} detected`);
|
|
14638
14150
|
if (unconfigured.length === 0) {
|
|
14639
|
-
|
|
14151
|
+
p.log.success("All detected tools are already configured.");
|
|
14640
14152
|
for (const tool of alreadyConfigured) {
|
|
14641
14153
|
try {
|
|
14642
|
-
|
|
14154
|
+
configureToolAndCollect(tool, useDaemon);
|
|
14643
14155
|
} catch {
|
|
14644
14156
|
}
|
|
14645
14157
|
}
|
|
14646
|
-
installHooksAndFinish(alreadyConfigured, alreadyConfigured.length, useDaemon);
|
|
14158
|
+
installHooksAndFinish(p, alreadyConfigured, alreadyConfigured.length, useDaemon);
|
|
14647
14159
|
return;
|
|
14648
14160
|
}
|
|
14649
14161
|
let toInstall;
|
|
14650
14162
|
if (autoYes) {
|
|
14651
14163
|
toInstall = unconfigured;
|
|
14652
14164
|
} else {
|
|
14653
|
-
|
|
14654
|
-
|
|
14655
|
-
|
|
14656
|
-
|
|
14657
|
-
|
|
14658
|
-
|
|
14659
|
-
|
|
14660
|
-
|
|
14165
|
+
const selected = await p.multiselect({
|
|
14166
|
+
message: `Select tools to configure ${import_picocolors.default.dim("(space to toggle)")}`,
|
|
14167
|
+
options: unconfigured.map((t) => ({
|
|
14168
|
+
value: t.id,
|
|
14169
|
+
label: t.name,
|
|
14170
|
+
hint: shortenPath(t.getConfigPath())
|
|
14171
|
+
})),
|
|
14172
|
+
initialValues: unconfigured.map((t) => t.id),
|
|
14173
|
+
required: true
|
|
14174
|
+
});
|
|
14175
|
+
if (p.isCancel(selected)) {
|
|
14176
|
+
p.cancel("Setup cancelled.");
|
|
14661
14177
|
return;
|
|
14662
14178
|
}
|
|
14663
14179
|
toInstall = unconfigured.filter((t) => selected.includes(t.id));
|
|
14664
14180
|
}
|
|
14665
14181
|
if (toInstall.length === 0) {
|
|
14666
|
-
|
|
14182
|
+
p.log.info("No tools selected.");
|
|
14183
|
+
p.outro("Setup complete.");
|
|
14667
14184
|
return;
|
|
14668
14185
|
}
|
|
14669
|
-
|
|
14670
|
-
|
|
14671
|
-
`)
|
|
14672
|
-
|
|
14186
|
+
const mode = useDaemon ? "HTTP (daemon)" : "stdio";
|
|
14187
|
+
const summaryLines = [
|
|
14188
|
+
`Tools: ${toInstall.map((t) => t.name).join(", ")}`,
|
|
14189
|
+
`Mode: ${mode}`
|
|
14190
|
+
];
|
|
14191
|
+
if (useDaemon && platform !== "unsupported") {
|
|
14192
|
+
summaryLines.push(`Auto-start: ${platform}`);
|
|
14193
|
+
}
|
|
14194
|
+
summaryLines.push("Hooks: Claude Code (UserPromptSubmit + Stop + SessionEnd)");
|
|
14195
|
+
p.note(summaryLines.join("\n"), "Installation Summary");
|
|
14196
|
+
const shouldProceed = await p.confirm({ message: "Proceed with installation?" });
|
|
14197
|
+
if (p.isCancel(shouldProceed) || !shouldProceed) {
|
|
14198
|
+
p.cancel("Setup cancelled.");
|
|
14199
|
+
return;
|
|
14200
|
+
}
|
|
14201
|
+
const results = [];
|
|
14673
14202
|
for (const tool of toInstall) {
|
|
14674
|
-
|
|
14675
|
-
configureToolDaemon(tool, useDaemon);
|
|
14676
|
-
configuredCount++;
|
|
14677
|
-
} catch (e) {
|
|
14678
|
-
console.log(source_default.red(` \u2717 ${tool.name.padEnd(18)} \u2014 ${e.message}`));
|
|
14679
|
-
}
|
|
14203
|
+
results.push(configureToolAndCollect(tool, useDaemon));
|
|
14680
14204
|
}
|
|
14681
14205
|
for (const tool of alreadyConfigured) {
|
|
14682
14206
|
try {
|
|
14683
|
-
|
|
14207
|
+
configureToolAndCollect(tool, useDaemon);
|
|
14684
14208
|
} catch {
|
|
14685
14209
|
}
|
|
14686
14210
|
}
|
|
14687
|
-
|
|
14688
|
-
|
|
14689
|
-
function configureToolDaemon(tool, useDaemon) {
|
|
14690
|
-
if (useDaemon && tool.supportsUrl) {
|
|
14691
|
-
tool.installHttp();
|
|
14692
|
-
console.log(source_default.green(` \u2713 ${tool.name.padEnd(18)} \u2192 ${source_default.dim("HTTP (daemon)")}`));
|
|
14693
|
-
} else if (useDaemon && !tool.supportsUrl) {
|
|
14694
|
-
tool.install();
|
|
14695
|
-
console.log(source_default.green(` \u2713 ${tool.name.padEnd(18)} \u2192 ${source_default.dim("stdio (no URL support)")}`));
|
|
14696
|
-
} else {
|
|
14697
|
-
tool.install();
|
|
14698
|
-
console.log(source_default.green(` \u2713 ${tool.name.padEnd(18)} \u2192 ${source_default.dim("stdio")}`));
|
|
14699
|
-
}
|
|
14211
|
+
showGroupedResults(p, results);
|
|
14212
|
+
installHooksAndFinish(p, [...toInstall, ...alreadyConfigured], results.filter((r) => r.ok).length, useDaemon);
|
|
14700
14213
|
}
|
|
14701
|
-
function installHooksAndFinish(allTools, configuredCount, useDaemon) {
|
|
14214
|
+
function installHooksAndFinish(p, allTools, configuredCount, useDaemon) {
|
|
14702
14215
|
try {
|
|
14703
14216
|
const hooksInstalled = installClaudeCodeHooks();
|
|
14704
14217
|
if (hooksInstalled) {
|
|
14705
|
-
|
|
14218
|
+
p.log.success("Claude Code hooks installed (UserPromptSubmit + Stop + SessionEnd)");
|
|
14706
14219
|
}
|
|
14707
14220
|
} catch {
|
|
14708
|
-
|
|
14221
|
+
p.log.warn("Could not install Claude Code hooks");
|
|
14709
14222
|
}
|
|
14710
|
-
showManualHints(allTools);
|
|
14223
|
+
showManualHints(p, allTools);
|
|
14711
14224
|
const mode = useDaemon ? "daemon mode" : "stdio mode";
|
|
14712
|
-
|
|
14713
|
-
|
|
14714
|
-
|
|
14715
|
-
console.log(` Dashboard \u2192 ${source_default.cyan(`http://127.0.0.1:${DAEMON_PORT}/dashboard`)}`);
|
|
14716
|
-
}
|
|
14717
|
-
console.log();
|
|
14225
|
+
const dashboard = useDaemon ? `
|
|
14226
|
+
Dashboard \u2192 ${import_picocolors.default.cyan(`http://127.0.0.1:${DAEMON_PORT}/dashboard`)}` : "";
|
|
14227
|
+
p.outro(`UseAI configured in ${import_picocolors.default.bold(String(configuredCount))} tool${configuredCount === 1 ? "" : "s"} (${mode}).${dashboard}`);
|
|
14718
14228
|
}
|
|
14719
14229
|
async function fullRemoveFlow(tools, autoYes, explicit) {
|
|
14230
|
+
const p = await getClack();
|
|
14231
|
+
p.intro(import_picocolors.default.bgCyan(import_picocolors.default.black(" useai ")));
|
|
14720
14232
|
if (explicit) {
|
|
14721
14233
|
const toRemove = tools.filter((t) => {
|
|
14722
14234
|
try {
|
|
@@ -14733,17 +14245,14 @@ async function fullRemoveFlow(tools, autoYes, explicit) {
|
|
|
14733
14245
|
}
|
|
14734
14246
|
});
|
|
14735
14247
|
for (const tool of notConfigured) {
|
|
14736
|
-
|
|
14248
|
+
p.log.info(`${tool.name} is not configured \u2014 skipping.`);
|
|
14737
14249
|
}
|
|
14738
|
-
|
|
14739
|
-
|
|
14740
|
-
|
|
14741
|
-
|
|
14742
|
-
|
|
14743
|
-
|
|
14744
|
-
} catch (e) {
|
|
14745
|
-
console.log(source_default.red(` \u2717 ${tool.name} \u2014 ${e.message}`));
|
|
14746
|
-
}
|
|
14250
|
+
for (const tool of toRemove) {
|
|
14251
|
+
try {
|
|
14252
|
+
tool.remove();
|
|
14253
|
+
p.log.success(`Removed from ${tool.name}`);
|
|
14254
|
+
} catch (e) {
|
|
14255
|
+
p.log.error(`${tool.name} \u2014 ${e.message}`);
|
|
14747
14256
|
}
|
|
14748
14257
|
}
|
|
14749
14258
|
} else {
|
|
@@ -14755,39 +14264,37 @@ async function fullRemoveFlow(tools, autoYes, explicit) {
|
|
|
14755
14264
|
}
|
|
14756
14265
|
});
|
|
14757
14266
|
if (configured.length === 0) {
|
|
14758
|
-
|
|
14267
|
+
p.log.info("UseAI is not configured in any AI tools.");
|
|
14759
14268
|
} else {
|
|
14760
|
-
console.log(`
|
|
14761
|
-
Found UseAI configured in ${source_default.bold(String(configured.length))} tool${configured.length === 1 ? "" : "s"}:
|
|
14762
|
-
`);
|
|
14763
14269
|
let toRemove;
|
|
14764
14270
|
if (autoYes) {
|
|
14765
14271
|
toRemove = configured;
|
|
14766
14272
|
} else {
|
|
14767
|
-
|
|
14768
|
-
|
|
14769
|
-
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14273
|
+
const selected = await p.multiselect({
|
|
14274
|
+
message: `Select tools to remove UseAI from ${import_picocolors.default.dim("(space to toggle)")}`,
|
|
14275
|
+
options: configured.map((t) => ({
|
|
14276
|
+
value: t.id,
|
|
14277
|
+
label: t.name,
|
|
14278
|
+
hint: shortenPath(t.getConfigPath())
|
|
14279
|
+
})),
|
|
14280
|
+
initialValues: configured.map((t) => t.id),
|
|
14281
|
+
required: true
|
|
14282
|
+
});
|
|
14283
|
+
if (p.isCancel(selected)) {
|
|
14284
|
+
p.cancel("Removal cancelled.");
|
|
14775
14285
|
return;
|
|
14776
14286
|
}
|
|
14777
14287
|
toRemove = configured.filter((t) => selected.includes(t.id));
|
|
14778
14288
|
}
|
|
14779
14289
|
if (toRemove.length === 0) {
|
|
14780
|
-
|
|
14290
|
+
p.log.info("No tools selected.");
|
|
14781
14291
|
} else {
|
|
14782
|
-
console.log(`
|
|
14783
|
-
Removing from ${toRemove.length} tool${toRemove.length === 1 ? "" : "s"}...
|
|
14784
|
-
`);
|
|
14785
14292
|
for (const tool of toRemove) {
|
|
14786
14293
|
try {
|
|
14787
14294
|
tool.remove();
|
|
14788
|
-
|
|
14295
|
+
p.log.success(`Removed from ${tool.name}`);
|
|
14789
14296
|
} catch (e) {
|
|
14790
|
-
|
|
14297
|
+
p.log.error(`${tool.name} \u2014 ${e.message}`);
|
|
14791
14298
|
}
|
|
14792
14299
|
}
|
|
14793
14300
|
}
|
|
@@ -14800,43 +14307,42 @@ async function fullRemoveFlow(tools, autoYes, explicit) {
|
|
|
14800
14307
|
return false;
|
|
14801
14308
|
}
|
|
14802
14309
|
});
|
|
14803
|
-
if (anyRemaining) {
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
|
|
14809
|
-
console.log(source_default.green(" \u2713 Claude Code hooks removed"));
|
|
14810
|
-
} catch {
|
|
14811
|
-
}
|
|
14812
|
-
console.log();
|
|
14813
|
-
try {
|
|
14814
|
-
await killDaemon();
|
|
14815
|
-
console.log(source_default.green(" \u2713 Daemon stopped"));
|
|
14816
|
-
} catch {
|
|
14817
|
-
console.log(source_default.dim(" Daemon was not running"));
|
|
14818
|
-
}
|
|
14819
|
-
if (isAutostartInstalled()) {
|
|
14310
|
+
if (!anyRemaining) {
|
|
14311
|
+
try {
|
|
14312
|
+
removeClaudeCodeHooks();
|
|
14313
|
+
p.log.success("Claude Code hooks removed");
|
|
14314
|
+
} catch {
|
|
14315
|
+
}
|
|
14820
14316
|
try {
|
|
14821
|
-
|
|
14822
|
-
|
|
14317
|
+
await killDaemon();
|
|
14318
|
+
p.log.success("Daemon stopped");
|
|
14823
14319
|
} catch {
|
|
14824
|
-
|
|
14320
|
+
p.log.info("Daemon was not running");
|
|
14825
14321
|
}
|
|
14322
|
+
if (isAutostartInstalled()) {
|
|
14323
|
+
try {
|
|
14324
|
+
removeAutostart();
|
|
14325
|
+
p.log.success("Auto-start service removed");
|
|
14326
|
+
} catch {
|
|
14327
|
+
p.log.error("Failed to remove auto-start service");
|
|
14328
|
+
}
|
|
14329
|
+
}
|
|
14330
|
+
p.outro("UseAI fully removed.");
|
|
14331
|
+
} else {
|
|
14332
|
+
p.outro("Other tools still configured \u2014 daemon and hooks kept running.");
|
|
14826
14333
|
}
|
|
14827
|
-
console.log(source_default.dim("\nDone! UseAI fully removed.\n"));
|
|
14828
14334
|
}
|
|
14829
14335
|
function showHelp() {
|
|
14830
14336
|
console.log(`
|
|
14831
|
-
${
|
|
14337
|
+
${import_picocolors.default.bold("Usage:")} npx @devness/useai mcp [tools...] [options]
|
|
14832
14338
|
|
|
14833
14339
|
Configure UseAI MCP server in your AI tools.
|
|
14834
14340
|
Default: starts daemon, installs auto-start, configures tools with HTTP.
|
|
14835
14341
|
|
|
14836
|
-
${
|
|
14342
|
+
${import_picocolors.default.bold("Arguments:")}
|
|
14837
14343
|
tools Specific tool names (e.g. codex cursor vscode)
|
|
14838
14344
|
|
|
14839
|
-
${
|
|
14345
|
+
${import_picocolors.default.bold("Options:")}
|
|
14840
14346
|
--stdio Use stdio config (legacy mode for containers/CI)
|
|
14841
14347
|
--remove Remove UseAI from configured tools, stop daemon, remove auto-start
|
|
14842
14348
|
--status Show configuration status without modifying
|
|
@@ -14860,30 +14366,115 @@ async function runSetup(args) {
|
|
|
14860
14366
|
if (explicit) {
|
|
14861
14367
|
const { matched, unmatched } = resolveTools(toolNames);
|
|
14862
14368
|
if (unmatched.length > 0) {
|
|
14863
|
-
console.log(
|
|
14864
|
-
console.log(
|
|
14369
|
+
console.log(import_picocolors.default.red(` Unknown tool${unmatched.length === 1 ? "" : "s"}: ${unmatched.join(", ")}`));
|
|
14370
|
+
console.log(import_picocolors.default.dim(` Available: ${AI_TOOLS.map((t) => t.id).join(", ")}`));
|
|
14865
14371
|
return;
|
|
14866
14372
|
}
|
|
14867
14373
|
tools = matched;
|
|
14868
14374
|
}
|
|
14869
14375
|
if (isStatus) {
|
|
14870
|
-
|
|
14376
|
+
const p = await getClack();
|
|
14377
|
+
const detected = tools.filter((t) => t.detect());
|
|
14378
|
+
if (detected.length === 0) {
|
|
14379
|
+
p.log.warn("No supported AI tools detected on this system.");
|
|
14380
|
+
return;
|
|
14381
|
+
}
|
|
14382
|
+
const nameWidth = Math.max(...detected.map((t) => t.name.length));
|
|
14383
|
+
const lines = detected.map((tool) => {
|
|
14384
|
+
const name = tool.name.padEnd(nameWidth);
|
|
14385
|
+
const path = import_picocolors.default.dim(shortenPath(tool.getConfigPath()));
|
|
14386
|
+
if (tool.isConfigured()) {
|
|
14387
|
+
return `${name} ${import_picocolors.default.green("\u2713 Configured")} ${path}`;
|
|
14388
|
+
}
|
|
14389
|
+
return `${name} ${import_picocolors.default.yellow("\u2717 Not set up")} ${path}`;
|
|
14390
|
+
});
|
|
14391
|
+
p.note(lines.join("\n"), "AI Tool MCP Status");
|
|
14871
14392
|
} else if (isRemove) {
|
|
14872
14393
|
await fullRemoveFlow(tools, autoYes, explicit);
|
|
14873
14394
|
} else if (isStdio) {
|
|
14874
|
-
|
|
14395
|
+
const p = await getClack();
|
|
14396
|
+
p.intro(import_picocolors.default.bgCyan(import_picocolors.default.black(" useai ")));
|
|
14397
|
+
if (explicit) {
|
|
14398
|
+
const results2 = [];
|
|
14399
|
+
for (const tool of tools) {
|
|
14400
|
+
results2.push(configureToolAndCollect(tool, false));
|
|
14401
|
+
}
|
|
14402
|
+
showGroupedResults(p, results2);
|
|
14403
|
+
showManualHints(p, tools);
|
|
14404
|
+
p.outro("Setup complete.");
|
|
14405
|
+
return;
|
|
14406
|
+
}
|
|
14407
|
+
const s = p.spinner();
|
|
14408
|
+
s.start("Scanning for AI tools...");
|
|
14409
|
+
const detected = tools.filter((t) => t.detect());
|
|
14410
|
+
s.stop(`Found ${detected.length} AI tool${detected.length === 1 ? "" : "s"}`);
|
|
14411
|
+
if (detected.length === 0) {
|
|
14412
|
+
p.log.error("No AI tools detected on this machine.");
|
|
14413
|
+
p.outro("Setup complete.");
|
|
14414
|
+
return;
|
|
14415
|
+
}
|
|
14416
|
+
const alreadyConfigured = detected.filter((t) => t.isConfigured());
|
|
14417
|
+
const unconfigured = detected.filter((t) => !t.isConfigured());
|
|
14418
|
+
const toolLines = [
|
|
14419
|
+
...alreadyConfigured.map((t) => `${import_picocolors.default.green("\u2713")} ${t.name} ${import_picocolors.default.dim("(already configured)")}`),
|
|
14420
|
+
...unconfigured.map((t) => `${import_picocolors.default.dim("\u25CB")} ${t.name}`)
|
|
14421
|
+
];
|
|
14422
|
+
p.note(toolLines.join("\n"), `${detected.length} AI tool${detected.length === 1 ? "" : "s"} detected`);
|
|
14423
|
+
if (unconfigured.length === 0) {
|
|
14424
|
+
p.log.success("All detected tools are already configured.");
|
|
14425
|
+
p.outro("Nothing to do.");
|
|
14426
|
+
return;
|
|
14427
|
+
}
|
|
14428
|
+
let toInstall;
|
|
14429
|
+
if (autoYes) {
|
|
14430
|
+
toInstall = unconfigured;
|
|
14431
|
+
} else {
|
|
14432
|
+
const selected = await p.multiselect({
|
|
14433
|
+
message: `Select tools to configure ${import_picocolors.default.dim("(space to toggle)")}`,
|
|
14434
|
+
options: unconfigured.map((t) => ({
|
|
14435
|
+
value: t.id,
|
|
14436
|
+
label: t.name,
|
|
14437
|
+
hint: shortenPath(t.getConfigPath())
|
|
14438
|
+
})),
|
|
14439
|
+
initialValues: unconfigured.map((t) => t.id),
|
|
14440
|
+
required: true
|
|
14441
|
+
});
|
|
14442
|
+
if (p.isCancel(selected)) {
|
|
14443
|
+
p.cancel("Setup cancelled.");
|
|
14444
|
+
return;
|
|
14445
|
+
}
|
|
14446
|
+
toInstall = unconfigured.filter((t) => selected.includes(t.id));
|
|
14447
|
+
}
|
|
14448
|
+
if (toInstall.length === 0) {
|
|
14449
|
+
p.log.info("No tools selected.");
|
|
14450
|
+
p.outro("Setup complete.");
|
|
14451
|
+
return;
|
|
14452
|
+
}
|
|
14453
|
+
const results = [];
|
|
14454
|
+
for (const tool of toInstall) {
|
|
14455
|
+
results.push(configureToolAndCollect(tool, false));
|
|
14456
|
+
}
|
|
14457
|
+
for (const tool of alreadyConfigured) {
|
|
14458
|
+
try {
|
|
14459
|
+
tool.install();
|
|
14460
|
+
} catch {
|
|
14461
|
+
}
|
|
14462
|
+
}
|
|
14463
|
+
showGroupedResults(p, results);
|
|
14464
|
+
showManualHints(p, [...toInstall, ...alreadyConfigured]);
|
|
14465
|
+
const configuredCount = results.filter((r) => r.ok).length;
|
|
14466
|
+
p.outro(`UseAI configured in ${import_picocolors.default.bold(String(configuredCount))} tool${configuredCount === 1 ? "" : "s"} (stdio mode).`);
|
|
14875
14467
|
} else {
|
|
14876
14468
|
await daemonInstallFlow(tools, autoYes, explicit);
|
|
14877
14469
|
}
|
|
14878
14470
|
}
|
|
14879
|
-
var
|
|
14471
|
+
var import_picocolors, _p;
|
|
14880
14472
|
var init_setup = __esm({
|
|
14881
14473
|
"src/setup.ts"() {
|
|
14882
14474
|
"use strict";
|
|
14883
|
-
|
|
14475
|
+
import_picocolors = __toESM(require_picocolors(), 1);
|
|
14884
14476
|
init_dist();
|
|
14885
14477
|
init_tools2();
|
|
14886
|
-
SPINNER_FRAMES = ["\u280B", "\u2819", "\u2839", "\u2838", "\u283C", "\u2834", "\u2826", "\u2827", "\u2807", "\u280F"];
|
|
14887
14478
|
}
|
|
14888
14479
|
});
|
|
14889
14480
|
|
|
@@ -26885,20 +26476,20 @@ var require_compile = __commonJS({
|
|
|
26885
26476
|
var util_1 = require_util();
|
|
26886
26477
|
var validate_1 = require_validate();
|
|
26887
26478
|
var SchemaEnv = class {
|
|
26888
|
-
constructor(
|
|
26479
|
+
constructor(env) {
|
|
26889
26480
|
var _a;
|
|
26890
26481
|
this.refs = {};
|
|
26891
26482
|
this.dynamicAnchors = {};
|
|
26892
26483
|
let schema;
|
|
26893
|
-
if (typeof
|
|
26894
|
-
schema =
|
|
26895
|
-
this.schema =
|
|
26896
|
-
this.schemaId =
|
|
26897
|
-
this.root =
|
|
26898
|
-
this.baseId = (_a =
|
|
26899
|
-
this.schemaPath =
|
|
26900
|
-
this.localRefs =
|
|
26901
|
-
this.meta =
|
|
26484
|
+
if (typeof env.schema == "object")
|
|
26485
|
+
schema = env.schema;
|
|
26486
|
+
this.schema = env.schema;
|
|
26487
|
+
this.schemaId = env.schemaId;
|
|
26488
|
+
this.root = env.root || this;
|
|
26489
|
+
this.baseId = (_a = env.baseId) !== null && _a !== void 0 ? _a : (0, resolve_1.normalizeId)(schema === null || schema === void 0 ? void 0 : schema[env.schemaId || "$id"]);
|
|
26490
|
+
this.schemaPath = env.schemaPath;
|
|
26491
|
+
this.localRefs = env.localRefs;
|
|
26492
|
+
this.meta = env.meta;
|
|
26902
26493
|
this.$async = schema === null || schema === void 0 ? void 0 : schema.$async;
|
|
26903
26494
|
this.refs = {};
|
|
26904
26495
|
}
|
|
@@ -27082,15 +26673,15 @@ var require_compile = __commonJS({
|
|
|
27082
26673
|
baseId = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schId);
|
|
27083
26674
|
}
|
|
27084
26675
|
}
|
|
27085
|
-
let
|
|
26676
|
+
let env;
|
|
27086
26677
|
if (typeof schema != "boolean" && schema.$ref && !(0, util_1.schemaHasRulesButRef)(schema, this.RULES)) {
|
|
27087
26678
|
const $ref = (0, resolve_1.resolveUrl)(this.opts.uriResolver, baseId, schema.$ref);
|
|
27088
|
-
|
|
26679
|
+
env = resolveSchema.call(this, root, $ref);
|
|
27089
26680
|
}
|
|
27090
26681
|
const { schemaId } = this.opts;
|
|
27091
|
-
|
|
27092
|
-
if (
|
|
27093
|
-
return
|
|
26682
|
+
env = env || new SchemaEnv({ schema, schemaId, root, baseId });
|
|
26683
|
+
if (env.schema !== env.root.schema)
|
|
26684
|
+
return env;
|
|
27094
26685
|
return void 0;
|
|
27095
26686
|
}
|
|
27096
26687
|
}
|
|
@@ -27929,7 +27520,7 @@ var require_core = __commonJS({
|
|
|
27929
27520
|
};
|
|
27930
27521
|
var MAX_EXPRESSION = 200;
|
|
27931
27522
|
function requiredOptions(o) {
|
|
27932
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o,
|
|
27523
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p2, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
27933
27524
|
const s = o.strict;
|
|
27934
27525
|
const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
|
|
27935
27526
|
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
@@ -27940,7 +27531,7 @@ var require_core = __commonJS({
|
|
|
27940
27531
|
strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
|
|
27941
27532
|
strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
|
|
27942
27533
|
strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
|
|
27943
|
-
strictRequired: (
|
|
27534
|
+
strictRequired: (_p2 = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p2 !== void 0 ? _p2 : false,
|
|
27944
27535
|
code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
|
|
27945
27536
|
loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
|
|
27946
27537
|
loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
|
|
@@ -28491,8 +28082,8 @@ var require_ref = __commonJS({
|
|
|
28491
28082
|
schemaType: "string",
|
|
28492
28083
|
code(cxt) {
|
|
28493
28084
|
const { gen, schema: $ref, it } = cxt;
|
|
28494
|
-
const { baseId, schemaEnv:
|
|
28495
|
-
const { root } =
|
|
28085
|
+
const { baseId, schemaEnv: env, validateName, opts, self } = it;
|
|
28086
|
+
const { root } = env;
|
|
28496
28087
|
if (($ref === "#" || $ref === "#/") && baseId === root.baseId)
|
|
28497
28088
|
return callRootRef();
|
|
28498
28089
|
const schOrEnv = compile_1.resolveRef.call(self, root, baseId, $ref);
|
|
@@ -28502,8 +28093,8 @@ var require_ref = __commonJS({
|
|
|
28502
28093
|
return callValidate(schOrEnv);
|
|
28503
28094
|
return inlineRefSchema(schOrEnv);
|
|
28504
28095
|
function callRootRef() {
|
|
28505
|
-
if (
|
|
28506
|
-
return callRef(cxt, validateName,
|
|
28096
|
+
if (env === root)
|
|
28097
|
+
return callRef(cxt, validateName, env, env.$async);
|
|
28507
28098
|
const rootName = gen.scopeValue("root", { ref: root });
|
|
28508
28099
|
return callRef(cxt, (0, codegen_1._)`${rootName}.validate`, root, root.$async);
|
|
28509
28100
|
}
|
|
@@ -28533,14 +28124,14 @@ var require_ref = __commonJS({
|
|
|
28533
28124
|
exports.getValidate = getValidate;
|
|
28534
28125
|
function callRef(cxt, v, sch, $async) {
|
|
28535
28126
|
const { gen, it } = cxt;
|
|
28536
|
-
const { allErrors, schemaEnv:
|
|
28127
|
+
const { allErrors, schemaEnv: env, opts } = it;
|
|
28537
28128
|
const passCxt = opts.passContext ? names_1.default.this : codegen_1.nil;
|
|
28538
28129
|
if ($async)
|
|
28539
28130
|
callAsyncRef();
|
|
28540
28131
|
else
|
|
28541
28132
|
callSyncRef();
|
|
28542
28133
|
function callAsyncRef() {
|
|
28543
|
-
if (!
|
|
28134
|
+
if (!env.$async)
|
|
28544
28135
|
throw new Error("async schema referenced by sync schema");
|
|
28545
28136
|
const valid = gen.let("valid");
|
|
28546
28137
|
gen.try(() => {
|
|
@@ -36629,14 +36220,14 @@ var stdio_exports = {};
|
|
|
36629
36220
|
__export(stdio_exports, {
|
|
36630
36221
|
StdioServerTransport: () => StdioServerTransport
|
|
36631
36222
|
});
|
|
36632
|
-
import
|
|
36223
|
+
import process2 from "process";
|
|
36633
36224
|
var StdioServerTransport;
|
|
36634
36225
|
var init_stdio2 = __esm({
|
|
36635
36226
|
"../../node_modules/.pnpm/@modelcontextprotocol+sdk@1.26.0_zod@3.25.76/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js"() {
|
|
36636
36227
|
"use strict";
|
|
36637
36228
|
init_stdio();
|
|
36638
36229
|
StdioServerTransport = class {
|
|
36639
|
-
constructor(_stdin =
|
|
36230
|
+
constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
|
|
36640
36231
|
this._stdin = _stdin;
|
|
36641
36232
|
this._stdout = _stdout;
|
|
36642
36233
|
this._readBuffer = new ReadBuffer();
|
|
@@ -36698,6 +36289,7 @@ var init_stdio2 = __esm({
|
|
|
36698
36289
|
});
|
|
36699
36290
|
|
|
36700
36291
|
// src/index.ts
|
|
36292
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
36701
36293
|
var command = process.argv[2];
|
|
36702
36294
|
if (command === "mcp" || command?.startsWith("--")) {
|
|
36703
36295
|
const args = command === "mcp" ? process.argv.slice(3) : process.argv.slice(2);
|
|
@@ -36723,24 +36315,26 @@ if (!command && process.stdin.isTTY) {
|
|
|
36723
36315
|
}
|
|
36724
36316
|
}
|
|
36725
36317
|
if (command === "update") {
|
|
36726
|
-
const
|
|
36318
|
+
const p = await import("@clack/prompts");
|
|
36727
36319
|
const { fetchLatestVersion: fetchLatestVersion2, fetchDaemonHealth: fetchDaemonHealth2, killDaemon: killDaemon2, ensureDaemon: ensureDaemon2, installClaudeCodeHooks: installClaudeCodeHooks2, VERSION: VERSION3 } = await Promise.resolve().then(() => (init_dist(), dist_exports));
|
|
36728
36320
|
const { AI_TOOLS: AI_TOOLS2 } = await Promise.resolve().then(() => (init_tools2(), tools_exports));
|
|
36729
|
-
|
|
36321
|
+
p.intro(import_picocolors2.default.bgCyan(import_picocolors2.default.black(" useai update ")));
|
|
36322
|
+
const checkSpinner = p.spinner();
|
|
36323
|
+
checkSpinner.start("Checking for updates...");
|
|
36730
36324
|
const latest = await fetchLatestVersion2();
|
|
36731
36325
|
if (!latest) {
|
|
36732
|
-
|
|
36326
|
+
checkSpinner.stop("Could not reach npm registry");
|
|
36327
|
+
p.log.error("Failed to check for updates. Please check your network connection.");
|
|
36733
36328
|
process.exit(1);
|
|
36734
36329
|
}
|
|
36735
36330
|
const healthBefore = await fetchDaemonHealth2();
|
|
36736
36331
|
const runningVersion = healthBefore?.version ?? VERSION3;
|
|
36737
36332
|
if (runningVersion === latest && VERSION3 === latest) {
|
|
36738
|
-
|
|
36333
|
+
checkSpinner.stop(`Already up to date (v${latest})`);
|
|
36334
|
+
p.outro("Nothing to do.");
|
|
36739
36335
|
process.exit(0);
|
|
36740
36336
|
}
|
|
36741
|
-
|
|
36742
|
-
console.log(` ${chalk2.dim("Latest:")} v${latest}`);
|
|
36743
|
-
console.log();
|
|
36337
|
+
checkSpinner.stop(`Update available: v${runningVersion} \u2192 v${latest}`);
|
|
36744
36338
|
const configuredTools = AI_TOOLS2.filter((t) => {
|
|
36745
36339
|
try {
|
|
36746
36340
|
return t.isConfigured();
|
|
@@ -36748,66 +36342,72 @@ if (command === "update") {
|
|
|
36748
36342
|
return false;
|
|
36749
36343
|
}
|
|
36750
36344
|
});
|
|
36345
|
+
const updateSpinner = p.spinner();
|
|
36751
36346
|
if (configuredTools.length > 0) {
|
|
36752
|
-
|
|
36347
|
+
updateSpinner.start(`Removing MCP configs from ${configuredTools.length} tools...`);
|
|
36753
36348
|
for (const tool of configuredTools) {
|
|
36754
36349
|
try {
|
|
36755
36350
|
tool.remove();
|
|
36756
|
-
console.log(chalk2.dim(` \u21BB ${tool.name}`));
|
|
36757
36351
|
} catch {
|
|
36758
|
-
console.log(chalk2.red(` \u2717 Failed to remove ${tool.name}`));
|
|
36759
36352
|
}
|
|
36760
36353
|
}
|
|
36761
|
-
|
|
36354
|
+
updateSpinner.stop(`Removed configs from ${configuredTools.length} tools`);
|
|
36762
36355
|
}
|
|
36763
|
-
|
|
36356
|
+
const daemonSpinner = p.spinner();
|
|
36357
|
+
daemonSpinner.start("Stopping daemon and clearing cache...");
|
|
36764
36358
|
await killDaemon2();
|
|
36765
|
-
console.log(chalk2.dim(" Clearing npx cache..."));
|
|
36766
36359
|
const { execSync: execSync4 } = await import("child_process");
|
|
36767
36360
|
try {
|
|
36768
36361
|
execSync4("npm cache clean --force", { stdio: "ignore", timeout: 15e3 });
|
|
36769
36362
|
} catch {
|
|
36770
36363
|
}
|
|
36771
|
-
|
|
36364
|
+
daemonSpinner.message("Starting updated daemon...");
|
|
36772
36365
|
const daemonOk = await ensureDaemon2({ preferOnline: true });
|
|
36773
36366
|
if (!daemonOk) {
|
|
36774
|
-
|
|
36775
|
-
|
|
36776
|
-
|
|
36777
|
-
|
|
36367
|
+
daemonSpinner.stop("Failed to start updated daemon");
|
|
36368
|
+
p.note(
|
|
36369
|
+
[
|
|
36370
|
+
"Run in foreground to debug:",
|
|
36371
|
+
` npx @devness/useai daemon --port 19200`
|
|
36372
|
+
].join("\n"),
|
|
36373
|
+
"Troubleshooting"
|
|
36374
|
+
);
|
|
36778
36375
|
process.exit(1);
|
|
36779
36376
|
}
|
|
36780
36377
|
const healthAfter = await fetchDaemonHealth2();
|
|
36781
36378
|
const newVersion = healthAfter?.version ?? "unknown";
|
|
36782
|
-
|
|
36783
|
-
\u2713 Daemon updated: v${runningVersion} \u2192 v${newVersion}`));
|
|
36379
|
+
daemonSpinner.stop(`Daemon updated: v${runningVersion} \u2192 v${newVersion}`);
|
|
36784
36380
|
if (configuredTools.length > 0) {
|
|
36785
|
-
|
|
36381
|
+
const httpOk = [];
|
|
36382
|
+
const stdioOk = [];
|
|
36383
|
+
const failed = [];
|
|
36786
36384
|
for (const tool of configuredTools) {
|
|
36787
36385
|
try {
|
|
36788
36386
|
if (tool.supportsUrl) {
|
|
36789
36387
|
tool.installHttp();
|
|
36790
|
-
|
|
36388
|
+
httpOk.push(tool.name);
|
|
36791
36389
|
} else {
|
|
36792
36390
|
tool.install();
|
|
36793
|
-
|
|
36391
|
+
stdioOk.push(tool.name);
|
|
36794
36392
|
}
|
|
36795
36393
|
} catch {
|
|
36796
|
-
|
|
36394
|
+
failed.push(tool.name);
|
|
36797
36395
|
}
|
|
36798
36396
|
}
|
|
36397
|
+
if (httpOk.length > 0) p.log.success(`HTTP (daemon): ${httpOk.join(", ")}`);
|
|
36398
|
+
if (stdioOk.length > 0) p.log.success(`stdio: ${stdioOk.join(", ")}`);
|
|
36399
|
+
if (failed.length > 0) p.log.error(`Failed: ${failed.join(", ")}`);
|
|
36799
36400
|
}
|
|
36800
36401
|
try {
|
|
36801
36402
|
const hooksInstalled = installClaudeCodeHooks2();
|
|
36802
36403
|
if (hooksInstalled) {
|
|
36803
|
-
|
|
36404
|
+
p.log.success("Claude Code hooks reinstalled");
|
|
36804
36405
|
}
|
|
36805
36406
|
} catch {
|
|
36806
36407
|
}
|
|
36807
|
-
|
|
36808
|
-
|
|
36809
|
-
|
|
36810
|
-
`));
|
|
36408
|
+
const dashboard = `
|
|
36409
|
+
Dashboard \u2192 ${import_picocolors2.default.cyan("http://127.0.0.1:19200/dashboard")}`;
|
|
36410
|
+
p.outro(`UseAI updated to v${newVersion} in ${import_picocolors2.default.bold(String(configuredTools.length))} tool${configuredTools.length === 1 ? "" : "s"}.${dashboard}`);
|
|
36811
36411
|
process.exit(0);
|
|
36812
36412
|
}
|
|
36813
36413
|
if (command === "daemon") {
|