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