@agents-inc/cli 0.86.0 → 0.87.0
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/CHANGELOG.md +10 -0
- package/dist/chunk-5UJJQFET.js +564 -0
- package/dist/chunk-5UJJQFET.js.map +1 -0
- package/dist/{chunk-GED2F75H.js → chunk-7FFNNDJQ.js} +176 -120
- package/dist/chunk-7FFNNDJQ.js.map +1 -0
- package/dist/{chunk-BV2MIQ3O.js → chunk-I5AZKNNL.js} +1 -1
- package/dist/chunk-I5AZKNNL.js.map +1 -0
- package/dist/chunk-J6PI73YV.js +68 -0
- package/dist/chunk-J6PI73YV.js.map +1 -0
- package/dist/commands/compile.js +26 -20
- package/dist/commands/compile.js.map +1 -1
- package/dist/commands/diff.js +681 -82
- package/dist/commands/diff.js.map +1 -1
- package/dist/commands/doctor.js +30 -58
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/edit.js +164 -32
- package/dist/commands/edit.js.map +1 -1
- package/dist/commands/eject.js +177 -27
- package/dist/commands/eject.js.map +1 -1
- package/dist/commands/import/skill.js +197 -33
- package/dist/commands/import/skill.js.map +1 -1
- package/dist/commands/info.js +41 -34
- package/dist/commands/info.js.map +1 -1
- package/dist/commands/init.js +3 -6
- package/dist/commands/new/agent.js +140 -44
- package/dist/commands/new/agent.js.map +1 -1
- package/dist/commands/new/marketplace.js +4 -4
- package/dist/commands/new/marketplace.js.map +1 -1
- package/dist/commands/new/skill.js +194 -30
- package/dist/commands/new/skill.js.map +1 -1
- package/dist/commands/outdated.js +1 -3
- package/dist/commands/outdated.js.map +1 -1
- package/dist/commands/search.js +162 -65
- package/dist/commands/search.js.map +1 -1
- package/dist/commands/uninstall.js +259 -62
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.js +232 -163
- package/dist/commands/update.js.map +1 -1
- package/dist/components/skill-search/skill-search.js +1 -1
- package/dist/hooks/init.js +2 -4
- package/dist/hooks/init.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-BV2MIQ3O.js.map +0 -1
- package/dist/chunk-DCVCFBQ7.js +0 -1800
- package/dist/chunk-DCVCFBQ7.js.map +0 -1
- package/dist/chunk-GED2F75H.js.map +0 -1
- package/dist/chunk-O5ZWS26C.js +0 -166
- package/dist/chunk-O5ZWS26C.js.map +0 -1
- package/dist/chunk-XQK4S22C.js +0 -202
- package/dist/chunk-XQK4S22C.js.map +0 -1
package/dist/commands/diff.js
CHANGED
|
@@ -2,16 +2,13 @@
|
|
|
2
2
|
import {
|
|
3
3
|
buildSourceSkillsMap,
|
|
4
4
|
collectScopedSkillDirs,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
loadSource,
|
|
8
|
-
source_default
|
|
9
|
-
} from "../chunk-DCVCFBQ7.js";
|
|
5
|
+
loadSource
|
|
6
|
+
} from "../chunk-5UJJQFET.js";
|
|
10
7
|
import "../chunk-N6A7A4RA.js";
|
|
11
|
-
import "../chunk-O5ZWS26C.js";
|
|
12
|
-
import "../chunk-XQK4S22C.js";
|
|
13
8
|
import "../chunk-FBZR46GC.js";
|
|
14
|
-
import
|
|
9
|
+
import {
|
|
10
|
+
readForkedFromMetadata
|
|
11
|
+
} from "../chunk-TMTUTUEV.js";
|
|
15
12
|
import "../chunk-B6MYECV6.js";
|
|
16
13
|
import "../chunk-ANXHMG32.js";
|
|
17
14
|
import {
|
|
@@ -19,11 +16,15 @@ import {
|
|
|
19
16
|
EXIT_CODES
|
|
20
17
|
} from "../chunk-MMTMXLI4.js";
|
|
21
18
|
import {
|
|
22
|
-
|
|
19
|
+
fileExists,
|
|
20
|
+
getErrorMessage,
|
|
21
|
+
readFile
|
|
23
22
|
} from "../chunk-NUU3U43A.js";
|
|
24
23
|
import "../chunk-6XWHJHNZ.js";
|
|
25
24
|
import {
|
|
26
|
-
CLI_BIN_NAME
|
|
25
|
+
CLI_BIN_NAME,
|
|
26
|
+
LOCAL_SKILLS_PATH,
|
|
27
|
+
STANDARD_FILES
|
|
27
28
|
} from "../chunk-6PGL2XMY.js";
|
|
28
29
|
import "../chunk-NPMMU4GY.js";
|
|
29
30
|
import {
|
|
@@ -33,6 +34,511 @@ import {
|
|
|
33
34
|
// src/cli/commands/diff.ts
|
|
34
35
|
init_esm_shims();
|
|
35
36
|
import { Args, Flags } from "@oclif/core";
|
|
37
|
+
import path from "path";
|
|
38
|
+
|
|
39
|
+
// node_modules/chalk/source/index.js
|
|
40
|
+
init_esm_shims();
|
|
41
|
+
|
|
42
|
+
// node_modules/chalk/source/vendor/ansi-styles/index.js
|
|
43
|
+
init_esm_shims();
|
|
44
|
+
var ANSI_BACKGROUND_OFFSET = 10;
|
|
45
|
+
var wrapAnsi16 = (offset = 0) => (code) => `\x1B[${code + offset}m`;
|
|
46
|
+
var wrapAnsi256 = (offset = 0) => (code) => `\x1B[${38 + offset};5;${code}m`;
|
|
47
|
+
var wrapAnsi16m = (offset = 0) => (red, green, blue) => `\x1B[${38 + offset};2;${red};${green};${blue}m`;
|
|
48
|
+
var styles = {
|
|
49
|
+
modifier: {
|
|
50
|
+
reset: [0, 0],
|
|
51
|
+
// 21 isn't widely supported and 22 does the same thing
|
|
52
|
+
bold: [1, 22],
|
|
53
|
+
dim: [2, 22],
|
|
54
|
+
italic: [3, 23],
|
|
55
|
+
underline: [4, 24],
|
|
56
|
+
overline: [53, 55],
|
|
57
|
+
inverse: [7, 27],
|
|
58
|
+
hidden: [8, 28],
|
|
59
|
+
strikethrough: [9, 29]
|
|
60
|
+
},
|
|
61
|
+
color: {
|
|
62
|
+
black: [30, 39],
|
|
63
|
+
red: [31, 39],
|
|
64
|
+
green: [32, 39],
|
|
65
|
+
yellow: [33, 39],
|
|
66
|
+
blue: [34, 39],
|
|
67
|
+
magenta: [35, 39],
|
|
68
|
+
cyan: [36, 39],
|
|
69
|
+
white: [37, 39],
|
|
70
|
+
// Bright color
|
|
71
|
+
blackBright: [90, 39],
|
|
72
|
+
gray: [90, 39],
|
|
73
|
+
// Alias of `blackBright`
|
|
74
|
+
grey: [90, 39],
|
|
75
|
+
// Alias of `blackBright`
|
|
76
|
+
redBright: [91, 39],
|
|
77
|
+
greenBright: [92, 39],
|
|
78
|
+
yellowBright: [93, 39],
|
|
79
|
+
blueBright: [94, 39],
|
|
80
|
+
magentaBright: [95, 39],
|
|
81
|
+
cyanBright: [96, 39],
|
|
82
|
+
whiteBright: [97, 39]
|
|
83
|
+
},
|
|
84
|
+
bgColor: {
|
|
85
|
+
bgBlack: [40, 49],
|
|
86
|
+
bgRed: [41, 49],
|
|
87
|
+
bgGreen: [42, 49],
|
|
88
|
+
bgYellow: [43, 49],
|
|
89
|
+
bgBlue: [44, 49],
|
|
90
|
+
bgMagenta: [45, 49],
|
|
91
|
+
bgCyan: [46, 49],
|
|
92
|
+
bgWhite: [47, 49],
|
|
93
|
+
// Bright color
|
|
94
|
+
bgBlackBright: [100, 49],
|
|
95
|
+
bgGray: [100, 49],
|
|
96
|
+
// Alias of `bgBlackBright`
|
|
97
|
+
bgGrey: [100, 49],
|
|
98
|
+
// Alias of `bgBlackBright`
|
|
99
|
+
bgRedBright: [101, 49],
|
|
100
|
+
bgGreenBright: [102, 49],
|
|
101
|
+
bgYellowBright: [103, 49],
|
|
102
|
+
bgBlueBright: [104, 49],
|
|
103
|
+
bgMagentaBright: [105, 49],
|
|
104
|
+
bgCyanBright: [106, 49],
|
|
105
|
+
bgWhiteBright: [107, 49]
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
var modifierNames = Object.keys(styles.modifier);
|
|
109
|
+
var foregroundColorNames = Object.keys(styles.color);
|
|
110
|
+
var backgroundColorNames = Object.keys(styles.bgColor);
|
|
111
|
+
var colorNames = [...foregroundColorNames, ...backgroundColorNames];
|
|
112
|
+
function assembleStyles() {
|
|
113
|
+
const codes = /* @__PURE__ */ new Map();
|
|
114
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
115
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
116
|
+
styles[styleName] = {
|
|
117
|
+
open: `\x1B[${style[0]}m`,
|
|
118
|
+
close: `\x1B[${style[1]}m`
|
|
119
|
+
};
|
|
120
|
+
group[styleName] = styles[styleName];
|
|
121
|
+
codes.set(style[0], style[1]);
|
|
122
|
+
}
|
|
123
|
+
Object.defineProperty(styles, groupName, {
|
|
124
|
+
value: group,
|
|
125
|
+
enumerable: false
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
Object.defineProperty(styles, "codes", {
|
|
129
|
+
value: codes,
|
|
130
|
+
enumerable: false
|
|
131
|
+
});
|
|
132
|
+
styles.color.close = "\x1B[39m";
|
|
133
|
+
styles.bgColor.close = "\x1B[49m";
|
|
134
|
+
styles.color.ansi = wrapAnsi16();
|
|
135
|
+
styles.color.ansi256 = wrapAnsi256();
|
|
136
|
+
styles.color.ansi16m = wrapAnsi16m();
|
|
137
|
+
styles.bgColor.ansi = wrapAnsi16(ANSI_BACKGROUND_OFFSET);
|
|
138
|
+
styles.bgColor.ansi256 = wrapAnsi256(ANSI_BACKGROUND_OFFSET);
|
|
139
|
+
styles.bgColor.ansi16m = wrapAnsi16m(ANSI_BACKGROUND_OFFSET);
|
|
140
|
+
Object.defineProperties(styles, {
|
|
141
|
+
rgbToAnsi256: {
|
|
142
|
+
value(red, green, blue) {
|
|
143
|
+
if (red === green && green === blue) {
|
|
144
|
+
if (red < 8) {
|
|
145
|
+
return 16;
|
|
146
|
+
}
|
|
147
|
+
if (red > 248) {
|
|
148
|
+
return 231;
|
|
149
|
+
}
|
|
150
|
+
return Math.round((red - 8) / 247 * 24) + 232;
|
|
151
|
+
}
|
|
152
|
+
return 16 + 36 * Math.round(red / 255 * 5) + 6 * Math.round(green / 255 * 5) + Math.round(blue / 255 * 5);
|
|
153
|
+
},
|
|
154
|
+
enumerable: false
|
|
155
|
+
},
|
|
156
|
+
hexToRgb: {
|
|
157
|
+
value(hex) {
|
|
158
|
+
const matches = /[a-f\d]{6}|[a-f\d]{3}/i.exec(hex.toString(16));
|
|
159
|
+
if (!matches) {
|
|
160
|
+
return [0, 0, 0];
|
|
161
|
+
}
|
|
162
|
+
let [colorString] = matches;
|
|
163
|
+
if (colorString.length === 3) {
|
|
164
|
+
colorString = [...colorString].map((character) => character + character).join("");
|
|
165
|
+
}
|
|
166
|
+
const integer = Number.parseInt(colorString, 16);
|
|
167
|
+
return [
|
|
168
|
+
/* eslint-disable no-bitwise */
|
|
169
|
+
integer >> 16 & 255,
|
|
170
|
+
integer >> 8 & 255,
|
|
171
|
+
integer & 255
|
|
172
|
+
/* eslint-enable no-bitwise */
|
|
173
|
+
];
|
|
174
|
+
},
|
|
175
|
+
enumerable: false
|
|
176
|
+
},
|
|
177
|
+
hexToAnsi256: {
|
|
178
|
+
value: (hex) => styles.rgbToAnsi256(...styles.hexToRgb(hex)),
|
|
179
|
+
enumerable: false
|
|
180
|
+
},
|
|
181
|
+
ansi256ToAnsi: {
|
|
182
|
+
value(code) {
|
|
183
|
+
if (code < 8) {
|
|
184
|
+
return 30 + code;
|
|
185
|
+
}
|
|
186
|
+
if (code < 16) {
|
|
187
|
+
return 90 + (code - 8);
|
|
188
|
+
}
|
|
189
|
+
let red;
|
|
190
|
+
let green;
|
|
191
|
+
let blue;
|
|
192
|
+
if (code >= 232) {
|
|
193
|
+
red = ((code - 232) * 10 + 8) / 255;
|
|
194
|
+
green = red;
|
|
195
|
+
blue = red;
|
|
196
|
+
} else {
|
|
197
|
+
code -= 16;
|
|
198
|
+
const remainder = code % 36;
|
|
199
|
+
red = Math.floor(code / 36) / 5;
|
|
200
|
+
green = Math.floor(remainder / 6) / 5;
|
|
201
|
+
blue = remainder % 6 / 5;
|
|
202
|
+
}
|
|
203
|
+
const value = Math.max(red, green, blue) * 2;
|
|
204
|
+
if (value === 0) {
|
|
205
|
+
return 30;
|
|
206
|
+
}
|
|
207
|
+
let result = 30 + (Math.round(blue) << 2 | Math.round(green) << 1 | Math.round(red));
|
|
208
|
+
if (value === 2) {
|
|
209
|
+
result += 60;
|
|
210
|
+
}
|
|
211
|
+
return result;
|
|
212
|
+
},
|
|
213
|
+
enumerable: false
|
|
214
|
+
},
|
|
215
|
+
rgbToAnsi: {
|
|
216
|
+
value: (red, green, blue) => styles.ansi256ToAnsi(styles.rgbToAnsi256(red, green, blue)),
|
|
217
|
+
enumerable: false
|
|
218
|
+
},
|
|
219
|
+
hexToAnsi: {
|
|
220
|
+
value: (hex) => styles.ansi256ToAnsi(styles.hexToAnsi256(hex)),
|
|
221
|
+
enumerable: false
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
return styles;
|
|
225
|
+
}
|
|
226
|
+
var ansiStyles = assembleStyles();
|
|
227
|
+
var ansi_styles_default = ansiStyles;
|
|
228
|
+
|
|
229
|
+
// node_modules/chalk/source/vendor/supports-color/index.js
|
|
230
|
+
init_esm_shims();
|
|
231
|
+
import process2 from "process";
|
|
232
|
+
import os from "os";
|
|
233
|
+
import tty from "tty";
|
|
234
|
+
function hasFlag(flag, argv = globalThis.Deno ? globalThis.Deno.args : process2.argv) {
|
|
235
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
236
|
+
const position = argv.indexOf(prefix + flag);
|
|
237
|
+
const terminatorPosition = argv.indexOf("--");
|
|
238
|
+
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
239
|
+
}
|
|
240
|
+
var { env } = process2;
|
|
241
|
+
var flagForceColor;
|
|
242
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
243
|
+
flagForceColor = 0;
|
|
244
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
245
|
+
flagForceColor = 1;
|
|
246
|
+
}
|
|
247
|
+
function envForceColor() {
|
|
248
|
+
if ("FORCE_COLOR" in env) {
|
|
249
|
+
if (env.FORCE_COLOR === "true") {
|
|
250
|
+
return 1;
|
|
251
|
+
}
|
|
252
|
+
if (env.FORCE_COLOR === "false") {
|
|
253
|
+
return 0;
|
|
254
|
+
}
|
|
255
|
+
return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
function translateLevel(level) {
|
|
259
|
+
if (level === 0) {
|
|
260
|
+
return false;
|
|
261
|
+
}
|
|
262
|
+
return {
|
|
263
|
+
level,
|
|
264
|
+
hasBasic: true,
|
|
265
|
+
has256: level >= 2,
|
|
266
|
+
has16m: level >= 3
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
function _supportsColor(haveStream, { streamIsTTY, sniffFlags = true } = {}) {
|
|
270
|
+
const noFlagForceColor = envForceColor();
|
|
271
|
+
if (noFlagForceColor !== void 0) {
|
|
272
|
+
flagForceColor = noFlagForceColor;
|
|
273
|
+
}
|
|
274
|
+
const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
|
|
275
|
+
if (forceColor === 0) {
|
|
276
|
+
return 0;
|
|
277
|
+
}
|
|
278
|
+
if (sniffFlags) {
|
|
279
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
280
|
+
return 3;
|
|
281
|
+
}
|
|
282
|
+
if (hasFlag("color=256")) {
|
|
283
|
+
return 2;
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
if ("TF_BUILD" in env && "AGENT_NAME" in env) {
|
|
287
|
+
return 1;
|
|
288
|
+
}
|
|
289
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
290
|
+
return 0;
|
|
291
|
+
}
|
|
292
|
+
const min = forceColor || 0;
|
|
293
|
+
if (env.TERM === "dumb") {
|
|
294
|
+
return min;
|
|
295
|
+
}
|
|
296
|
+
if (process2.platform === "win32") {
|
|
297
|
+
const osRelease = os.release().split(".");
|
|
298
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
299
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
300
|
+
}
|
|
301
|
+
return 1;
|
|
302
|
+
}
|
|
303
|
+
if ("CI" in env) {
|
|
304
|
+
if (["GITHUB_ACTIONS", "GITEA_ACTIONS", "CIRCLECI"].some((key) => key in env)) {
|
|
305
|
+
return 3;
|
|
306
|
+
}
|
|
307
|
+
if (["TRAVIS", "APPVEYOR", "GITLAB_CI", "BUILDKITE", "DRONE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
308
|
+
return 1;
|
|
309
|
+
}
|
|
310
|
+
return min;
|
|
311
|
+
}
|
|
312
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
313
|
+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
314
|
+
}
|
|
315
|
+
if (env.COLORTERM === "truecolor") {
|
|
316
|
+
return 3;
|
|
317
|
+
}
|
|
318
|
+
if (env.TERM === "xterm-kitty") {
|
|
319
|
+
return 3;
|
|
320
|
+
}
|
|
321
|
+
if (env.TERM === "xterm-ghostty") {
|
|
322
|
+
return 3;
|
|
323
|
+
}
|
|
324
|
+
if (env.TERM === "wezterm") {
|
|
325
|
+
return 3;
|
|
326
|
+
}
|
|
327
|
+
if ("TERM_PROGRAM" in env) {
|
|
328
|
+
const version = Number.parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
329
|
+
switch (env.TERM_PROGRAM) {
|
|
330
|
+
case "iTerm.app": {
|
|
331
|
+
return version >= 3 ? 3 : 2;
|
|
332
|
+
}
|
|
333
|
+
case "Apple_Terminal": {
|
|
334
|
+
return 2;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
339
|
+
return 2;
|
|
340
|
+
}
|
|
341
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
342
|
+
return 1;
|
|
343
|
+
}
|
|
344
|
+
if ("COLORTERM" in env) {
|
|
345
|
+
return 1;
|
|
346
|
+
}
|
|
347
|
+
return min;
|
|
348
|
+
}
|
|
349
|
+
function createSupportsColor(stream, options = {}) {
|
|
350
|
+
const level = _supportsColor(stream, {
|
|
351
|
+
streamIsTTY: stream && stream.isTTY,
|
|
352
|
+
...options
|
|
353
|
+
});
|
|
354
|
+
return translateLevel(level);
|
|
355
|
+
}
|
|
356
|
+
var supportsColor = {
|
|
357
|
+
stdout: createSupportsColor({ isTTY: tty.isatty(1) }),
|
|
358
|
+
stderr: createSupportsColor({ isTTY: tty.isatty(2) })
|
|
359
|
+
};
|
|
360
|
+
var supports_color_default = supportsColor;
|
|
361
|
+
|
|
362
|
+
// node_modules/chalk/source/utilities.js
|
|
363
|
+
init_esm_shims();
|
|
364
|
+
function stringReplaceAll(string, substring, replacer) {
|
|
365
|
+
let index = string.indexOf(substring);
|
|
366
|
+
if (index === -1) {
|
|
367
|
+
return string;
|
|
368
|
+
}
|
|
369
|
+
const substringLength = substring.length;
|
|
370
|
+
let endIndex = 0;
|
|
371
|
+
let returnValue = "";
|
|
372
|
+
do {
|
|
373
|
+
returnValue += string.slice(endIndex, index) + substring + replacer;
|
|
374
|
+
endIndex = index + substringLength;
|
|
375
|
+
index = string.indexOf(substring, endIndex);
|
|
376
|
+
} while (index !== -1);
|
|
377
|
+
returnValue += string.slice(endIndex);
|
|
378
|
+
return returnValue;
|
|
379
|
+
}
|
|
380
|
+
function stringEncaseCRLFWithFirstIndex(string, prefix, postfix, index) {
|
|
381
|
+
let endIndex = 0;
|
|
382
|
+
let returnValue = "";
|
|
383
|
+
do {
|
|
384
|
+
const gotCR = string[index - 1] === "\r";
|
|
385
|
+
returnValue += string.slice(endIndex, gotCR ? index - 1 : index) + prefix + (gotCR ? "\r\n" : "\n") + postfix;
|
|
386
|
+
endIndex = index + 1;
|
|
387
|
+
index = string.indexOf("\n", endIndex);
|
|
388
|
+
} while (index !== -1);
|
|
389
|
+
returnValue += string.slice(endIndex);
|
|
390
|
+
return returnValue;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
// node_modules/chalk/source/index.js
|
|
394
|
+
var { stdout: stdoutColor, stderr: stderrColor } = supports_color_default;
|
|
395
|
+
var GENERATOR = /* @__PURE__ */ Symbol("GENERATOR");
|
|
396
|
+
var STYLER = /* @__PURE__ */ Symbol("STYLER");
|
|
397
|
+
var IS_EMPTY = /* @__PURE__ */ Symbol("IS_EMPTY");
|
|
398
|
+
var levelMapping = [
|
|
399
|
+
"ansi",
|
|
400
|
+
"ansi",
|
|
401
|
+
"ansi256",
|
|
402
|
+
"ansi16m"
|
|
403
|
+
];
|
|
404
|
+
var styles2 = /* @__PURE__ */ Object.create(null);
|
|
405
|
+
var applyOptions = (object, options = {}) => {
|
|
406
|
+
if (options.level && !(Number.isInteger(options.level) && options.level >= 0 && options.level <= 3)) {
|
|
407
|
+
throw new Error("The `level` option should be an integer from 0 to 3");
|
|
408
|
+
}
|
|
409
|
+
const colorLevel = stdoutColor ? stdoutColor.level : 0;
|
|
410
|
+
object.level = options.level === void 0 ? colorLevel : options.level;
|
|
411
|
+
};
|
|
412
|
+
var chalkFactory = (options) => {
|
|
413
|
+
const chalk2 = (...strings) => strings.join(" ");
|
|
414
|
+
applyOptions(chalk2, options);
|
|
415
|
+
Object.setPrototypeOf(chalk2, createChalk.prototype);
|
|
416
|
+
return chalk2;
|
|
417
|
+
};
|
|
418
|
+
function createChalk(options) {
|
|
419
|
+
return chalkFactory(options);
|
|
420
|
+
}
|
|
421
|
+
Object.setPrototypeOf(createChalk.prototype, Function.prototype);
|
|
422
|
+
for (const [styleName, style] of Object.entries(ansi_styles_default)) {
|
|
423
|
+
styles2[styleName] = {
|
|
424
|
+
get() {
|
|
425
|
+
const builder = createBuilder(this, createStyler(style.open, style.close, this[STYLER]), this[IS_EMPTY]);
|
|
426
|
+
Object.defineProperty(this, styleName, { value: builder });
|
|
427
|
+
return builder;
|
|
428
|
+
}
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
styles2.visible = {
|
|
432
|
+
get() {
|
|
433
|
+
const builder = createBuilder(this, this[STYLER], true);
|
|
434
|
+
Object.defineProperty(this, "visible", { value: builder });
|
|
435
|
+
return builder;
|
|
436
|
+
}
|
|
437
|
+
};
|
|
438
|
+
var getModelAnsi = (model, level, type, ...arguments_) => {
|
|
439
|
+
if (model === "rgb") {
|
|
440
|
+
if (level === "ansi16m") {
|
|
441
|
+
return ansi_styles_default[type].ansi16m(...arguments_);
|
|
442
|
+
}
|
|
443
|
+
if (level === "ansi256") {
|
|
444
|
+
return ansi_styles_default[type].ansi256(ansi_styles_default.rgbToAnsi256(...arguments_));
|
|
445
|
+
}
|
|
446
|
+
return ansi_styles_default[type].ansi(ansi_styles_default.rgbToAnsi(...arguments_));
|
|
447
|
+
}
|
|
448
|
+
if (model === "hex") {
|
|
449
|
+
return getModelAnsi("rgb", level, type, ...ansi_styles_default.hexToRgb(...arguments_));
|
|
450
|
+
}
|
|
451
|
+
return ansi_styles_default[type][model](...arguments_);
|
|
452
|
+
};
|
|
453
|
+
var usedModels = ["rgb", "hex", "ansi256"];
|
|
454
|
+
for (const model of usedModels) {
|
|
455
|
+
styles2[model] = {
|
|
456
|
+
get() {
|
|
457
|
+
const { level } = this;
|
|
458
|
+
return function(...arguments_) {
|
|
459
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "color", ...arguments_), ansi_styles_default.color.close, this[STYLER]);
|
|
460
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
};
|
|
464
|
+
const bgModel = "bg" + model[0].toUpperCase() + model.slice(1);
|
|
465
|
+
styles2[bgModel] = {
|
|
466
|
+
get() {
|
|
467
|
+
const { level } = this;
|
|
468
|
+
return function(...arguments_) {
|
|
469
|
+
const styler = createStyler(getModelAnsi(model, levelMapping[level], "bgColor", ...arguments_), ansi_styles_default.bgColor.close, this[STYLER]);
|
|
470
|
+
return createBuilder(this, styler, this[IS_EMPTY]);
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
var proto = Object.defineProperties(() => {
|
|
476
|
+
}, {
|
|
477
|
+
...styles2,
|
|
478
|
+
level: {
|
|
479
|
+
enumerable: true,
|
|
480
|
+
get() {
|
|
481
|
+
return this[GENERATOR].level;
|
|
482
|
+
},
|
|
483
|
+
set(level) {
|
|
484
|
+
this[GENERATOR].level = level;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
var createStyler = (open, close, parent) => {
|
|
489
|
+
let openAll;
|
|
490
|
+
let closeAll;
|
|
491
|
+
if (parent === void 0) {
|
|
492
|
+
openAll = open;
|
|
493
|
+
closeAll = close;
|
|
494
|
+
} else {
|
|
495
|
+
openAll = parent.openAll + open;
|
|
496
|
+
closeAll = close + parent.closeAll;
|
|
497
|
+
}
|
|
498
|
+
return {
|
|
499
|
+
open,
|
|
500
|
+
close,
|
|
501
|
+
openAll,
|
|
502
|
+
closeAll,
|
|
503
|
+
parent
|
|
504
|
+
};
|
|
505
|
+
};
|
|
506
|
+
var createBuilder = (self, _styler, _isEmpty) => {
|
|
507
|
+
const builder = (...arguments_) => applyStyle(builder, arguments_.length === 1 ? "" + arguments_[0] : arguments_.join(" "));
|
|
508
|
+
Object.setPrototypeOf(builder, proto);
|
|
509
|
+
builder[GENERATOR] = self;
|
|
510
|
+
builder[STYLER] = _styler;
|
|
511
|
+
builder[IS_EMPTY] = _isEmpty;
|
|
512
|
+
return builder;
|
|
513
|
+
};
|
|
514
|
+
var applyStyle = (self, string) => {
|
|
515
|
+
if (self.level <= 0 || !string) {
|
|
516
|
+
return self[IS_EMPTY] ? "" : string;
|
|
517
|
+
}
|
|
518
|
+
let styler = self[STYLER];
|
|
519
|
+
if (styler === void 0) {
|
|
520
|
+
return string;
|
|
521
|
+
}
|
|
522
|
+
const { openAll, closeAll } = styler;
|
|
523
|
+
if (string.includes("\x1B")) {
|
|
524
|
+
while (styler !== void 0) {
|
|
525
|
+
string = stringReplaceAll(string, styler.close, styler.open);
|
|
526
|
+
styler = styler.parent;
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
const lfIndex = string.indexOf("\n");
|
|
530
|
+
if (lfIndex !== -1) {
|
|
531
|
+
string = stringEncaseCRLFWithFirstIndex(string, closeAll, openAll, lfIndex);
|
|
532
|
+
}
|
|
533
|
+
return openAll + string + closeAll;
|
|
534
|
+
};
|
|
535
|
+
Object.defineProperties(createChalk.prototype, styles2);
|
|
536
|
+
var chalk = createChalk();
|
|
537
|
+
var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
538
|
+
var source_default = chalk;
|
|
539
|
+
|
|
540
|
+
// src/cli/commands/diff.ts
|
|
541
|
+
import { createTwoFilesPatch } from "diff";
|
|
36
542
|
var Diff = class _Diff extends BaseCommand {
|
|
37
543
|
static summary = "Show differences between local forked skills and their source versions";
|
|
38
544
|
static description = "Compare local forked skills with their source versions and display differences using unified diff format with colored output";
|
|
@@ -67,96 +573,189 @@ var Diff = class _Diff extends BaseCommand {
|
|
|
67
573
|
async run() {
|
|
68
574
|
const { args, flags } = await this.parse(_Diff);
|
|
69
575
|
const projectDir = process.cwd();
|
|
70
|
-
const
|
|
71
|
-
if (!
|
|
576
|
+
const scopedDirs = await this.loadScopedDirs(projectDir, flags.quiet);
|
|
577
|
+
if (!scopedDirs) return;
|
|
578
|
+
try {
|
|
579
|
+
const { sourceResult, sourceSkills } = await this.loadSource(flags, projectDir);
|
|
580
|
+
const filteredDirs = this.filterBySkillArg(args.skill, scopedDirs, flags.quiet);
|
|
581
|
+
const results = await this.generateDiffs(filteredDirs, sourceResult.sourcePath, sourceSkills);
|
|
582
|
+
this.reportResults(results, flags.quiet);
|
|
583
|
+
} catch (error) {
|
|
72
584
|
if (!flags.quiet) {
|
|
585
|
+
this.error(`Failed to compare skills: ${getErrorMessage(error)}`, {
|
|
586
|
+
exit: EXIT_CODES.ERROR
|
|
587
|
+
});
|
|
588
|
+
} else {
|
|
589
|
+
this.exit(EXIT_CODES.ERROR);
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
async loadScopedDirs(projectDir, quiet) {
|
|
594
|
+
const { dirs, hasProject, hasGlobal } = await collectScopedSkillDirs(projectDir);
|
|
595
|
+
if (!hasProject && !hasGlobal) {
|
|
596
|
+
if (!quiet) {
|
|
73
597
|
this.warn(
|
|
74
598
|
`No local skills found. Run '${CLI_BIN_NAME} init' or '${CLI_BIN_NAME} edit' first.`
|
|
75
599
|
);
|
|
76
600
|
}
|
|
77
|
-
return;
|
|
601
|
+
return null;
|
|
78
602
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
603
|
+
return dirs;
|
|
604
|
+
}
|
|
605
|
+
async loadSource(flags, projectDir) {
|
|
606
|
+
if (!flags.quiet) {
|
|
607
|
+
this.log("Loading skills...");
|
|
608
|
+
}
|
|
609
|
+
const { sourceResult } = await loadSource({
|
|
610
|
+
sourceFlag: flags.source,
|
|
611
|
+
projectDir
|
|
612
|
+
});
|
|
613
|
+
const { matrix, sourcePath, isLocal } = sourceResult;
|
|
614
|
+
if (!flags.quiet) {
|
|
615
|
+
this.log(source_default.dim(`Loaded from ${isLocal ? "local" : "remote"}: ${sourcePath}`));
|
|
616
|
+
}
|
|
617
|
+
const sourceSkills = buildSourceSkillsMap(matrix);
|
|
618
|
+
return { sourceResult: { sourcePath, isLocal }, sourceSkills };
|
|
619
|
+
}
|
|
620
|
+
filterBySkillArg(skillArg, scopedDirs, quiet) {
|
|
621
|
+
if (!skillArg) return scopedDirs;
|
|
622
|
+
const filtered = scopedDirs.filter((d) => d.dirName === skillArg);
|
|
623
|
+
if (filtered.length === 0) {
|
|
624
|
+
if (!quiet) {
|
|
625
|
+
this.error(`Skill '${skillArg}' not found in local skills`, {
|
|
626
|
+
exit: EXIT_CODES.ERROR
|
|
627
|
+
});
|
|
102
628
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
629
|
+
}
|
|
630
|
+
return filtered;
|
|
631
|
+
}
|
|
632
|
+
async generateDiffs(dirs, sourcePath, sourceSkills) {
|
|
633
|
+
const results = [];
|
|
634
|
+
for (const { dirName, localSkillsPath } of dirs) {
|
|
635
|
+
const result = await generateSkillDiff(localSkillsPath, dirName, sourcePath, sourceSkills);
|
|
636
|
+
results.push(result);
|
|
637
|
+
}
|
|
638
|
+
return results;
|
|
639
|
+
}
|
|
640
|
+
reportResults(results, quiet) {
|
|
641
|
+
const skillsWithDiffs = results.filter((r) => r.hasDiff);
|
|
642
|
+
const skillsWithoutForkedFrom = results.filter((r) => !r.forkedFrom).map((r) => r.skillDirName);
|
|
643
|
+
if (!quiet) {
|
|
644
|
+
this.log("");
|
|
645
|
+
if (skillsWithoutForkedFrom.length > 0) {
|
|
646
|
+
for (const skillName of skillsWithoutForkedFrom) {
|
|
647
|
+
this.warn(`Skill '${skillName}' has no forkedFrom metadata - cannot compare`);
|
|
110
648
|
}
|
|
111
|
-
}
|
|
112
|
-
const skillsWithDiffs = results.filter((r) => r.hasDiff);
|
|
113
|
-
if (!flags.quiet) {
|
|
114
649
|
this.log("");
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
this.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
} else {
|
|
127
|
-
for (const result of skillsWithDiffs) {
|
|
128
|
-
this.log(
|
|
129
|
-
source_default.bold(
|
|
130
|
-
`
|
|
650
|
+
}
|
|
651
|
+
const forkedSkills = results.filter((r) => r.forkedFrom);
|
|
652
|
+
if (forkedSkills.length === 0) {
|
|
653
|
+
this.logInfo("No forked skills to compare.");
|
|
654
|
+
} else if (skillsWithDiffs.length === 0) {
|
|
655
|
+
this.logSuccess(`All ${forkedSkills.length} forked skill(s) are up to date with source.`);
|
|
656
|
+
} else {
|
|
657
|
+
for (const result of skillsWithDiffs) {
|
|
658
|
+
this.log(
|
|
659
|
+
source_default.bold(
|
|
660
|
+
`
|
|
131
661
|
=== ${result.skillDirName} (forked from ${result.forkedFrom?.skillId}) ===
|
|
132
662
|
`
|
|
133
|
-
|
|
134
|
-
);
|
|
135
|
-
this.log(formatColoredDiff(result.diffOutput));
|
|
136
|
-
}
|
|
137
|
-
this.log("");
|
|
138
|
-
this.logInfo(
|
|
139
|
-
`Found differences in ${source_default.yellow(String(skillsWithDiffs.length))} skill(s).`
|
|
663
|
+
)
|
|
140
664
|
);
|
|
665
|
+
this.log(formatColoredDiff(result.diffOutput));
|
|
141
666
|
}
|
|
142
667
|
this.log("");
|
|
668
|
+
this.logInfo(
|
|
669
|
+
`Found differences in ${source_default.yellow(String(skillsWithDiffs.length))} skill(s).`
|
|
670
|
+
);
|
|
143
671
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
this.exit(EXIT_CODES.
|
|
148
|
-
} catch (error) {
|
|
149
|
-
if (!flags.quiet) {
|
|
150
|
-
const message = getErrorMessage(error);
|
|
151
|
-
this.error(`Failed to compare skills: ${message}`, {
|
|
152
|
-
exit: EXIT_CODES.ERROR
|
|
153
|
-
});
|
|
154
|
-
} else {
|
|
155
|
-
this.exit(EXIT_CODES.ERROR);
|
|
156
|
-
}
|
|
672
|
+
this.log("");
|
|
673
|
+
}
|
|
674
|
+
if (skillsWithDiffs.length > 0) {
|
|
675
|
+
this.exit(EXIT_CODES.ERROR);
|
|
157
676
|
}
|
|
677
|
+
this.exit(EXIT_CODES.SUCCESS);
|
|
158
678
|
}
|
|
159
679
|
};
|
|
680
|
+
async function generateSkillDiff(localSkillsPath, skillDirName, sourcePath, sourceSkills) {
|
|
681
|
+
const skillDir = path.join(localSkillsPath, skillDirName);
|
|
682
|
+
const forkedFrom = await readForkedFromMetadata(skillDir);
|
|
683
|
+
if (!forkedFrom) {
|
|
684
|
+
return {
|
|
685
|
+
skillDirName,
|
|
686
|
+
forkedFrom: null,
|
|
687
|
+
hasDiff: false,
|
|
688
|
+
diffOutput: ""
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
const sourceSkill = sourceSkills[forkedFrom.skillId];
|
|
692
|
+
if (!sourceSkill) {
|
|
693
|
+
return {
|
|
694
|
+
skillDirName,
|
|
695
|
+
forkedFrom,
|
|
696
|
+
hasDiff: false,
|
|
697
|
+
diffOutput: `Source skill '${forkedFrom.skillId}' no longer exists`
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
const sourceSkillMdPath = path.join(sourcePath, "src", sourceSkill.path, STANDARD_FILES.SKILL_MD);
|
|
701
|
+
if (!await fileExists(sourceSkillMdPath)) {
|
|
702
|
+
return {
|
|
703
|
+
skillDirName,
|
|
704
|
+
forkedFrom,
|
|
705
|
+
hasDiff: false,
|
|
706
|
+
diffOutput: `Source ${STANDARD_FILES.SKILL_MD} not found at ${sourceSkillMdPath}`
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
const sourceContent = await readFile(sourceSkillMdPath);
|
|
710
|
+
const localSkillMdPath = path.join(skillDir, STANDARD_FILES.SKILL_MD);
|
|
711
|
+
if (!await fileExists(localSkillMdPath)) {
|
|
712
|
+
return {
|
|
713
|
+
skillDirName,
|
|
714
|
+
forkedFrom,
|
|
715
|
+
hasDiff: false,
|
|
716
|
+
diffOutput: `Local ${STANDARD_FILES.SKILL_MD} not found at ${localSkillMdPath}`
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
const localContent = await readFile(localSkillMdPath);
|
|
720
|
+
const sourceLabel = `source/${sourceSkill.path}/SKILL.md`;
|
|
721
|
+
const localLabel = `local/${LOCAL_SKILLS_PATH}/${skillDirName}/SKILL.md`;
|
|
722
|
+
const diff = createTwoFilesPatch(
|
|
723
|
+
sourceLabel,
|
|
724
|
+
localLabel,
|
|
725
|
+
sourceContent,
|
|
726
|
+
localContent,
|
|
727
|
+
"",
|
|
728
|
+
// No source header
|
|
729
|
+
""
|
|
730
|
+
// No local header
|
|
731
|
+
);
|
|
732
|
+
const hasDiff = diff.split("\n").some((line) => {
|
|
733
|
+
return (line.startsWith("+") || line.startsWith("-")) && !line.startsWith("+++") && !line.startsWith("---");
|
|
734
|
+
});
|
|
735
|
+
return {
|
|
736
|
+
skillDirName,
|
|
737
|
+
forkedFrom,
|
|
738
|
+
hasDiff,
|
|
739
|
+
diffOutput: diff
|
|
740
|
+
};
|
|
741
|
+
}
|
|
742
|
+
function formatColoredDiff(diffText) {
|
|
743
|
+
return diffText.split("\n").map((line) => {
|
|
744
|
+
if (line.startsWith("+++") || line.startsWith("---")) {
|
|
745
|
+
return source_default.bold(line);
|
|
746
|
+
}
|
|
747
|
+
if (line.startsWith("+")) {
|
|
748
|
+
return source_default.green(line);
|
|
749
|
+
}
|
|
750
|
+
if (line.startsWith("-")) {
|
|
751
|
+
return source_default.red(line);
|
|
752
|
+
}
|
|
753
|
+
if (line.startsWith("@@")) {
|
|
754
|
+
return source_default.cyan(line);
|
|
755
|
+
}
|
|
756
|
+
return line;
|
|
757
|
+
}).join("\n");
|
|
758
|
+
}
|
|
160
759
|
export {
|
|
161
760
|
Diff as default
|
|
162
761
|
};
|