@kubb/plugin-mcp 4.11.2 → 4.12.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.
@@ -1,4 +1,4 @@
1
- import { a as OperationSchemas } from "./index-CXth3-Jh.cjs";
1
+ import { a as OperationSchemas } from "./index-CkVh6UKa.cjs";
2
2
  import { KubbFile } from "@kubb/fabric-core/types";
3
3
  import { KubbNode } from "@kubb/react-fabric/types";
4
4
 
@@ -1,4 +1,4 @@
1
- import { a as OperationSchemas } from "./index-CS2SZYLV.js";
1
+ import { a as OperationSchemas } from "./index-Bg8E5WWf.js";
2
2
  import { KubbFile } from "@kubb/fabric-core/types";
3
3
  import { KubbNode } from "@kubb/react-fabric/types";
4
4
 
@@ -1,5 +1,5 @@
1
- import { n as ReactGenerator } from "./index-CXth3-Jh.cjs";
2
- import { n as PluginMcp } from "./types-ut1IL45-.cjs";
1
+ import { n as ReactGenerator } from "./index-CkVh6UKa.cjs";
2
+ import { n as PluginMcp } from "./types-UMVHNvJx.cjs";
3
3
 
4
4
  //#region src/generators/mcpGenerator.d.ts
5
5
  declare const mcpGenerator: ReactGenerator<PluginMcp>;
@@ -1,5 +1,5 @@
1
- import { n as ReactGenerator } from "./index-CS2SZYLV.js";
2
- import { n as PluginMcp } from "./types-CeCRegVI.js";
1
+ import { n as ReactGenerator } from "./index-Bg8E5WWf.js";
2
+ import { n as PluginMcp } from "./types-COUCgQPC.js";
3
3
 
4
4
  //#region src/generators/mcpGenerator.d.ts
5
5
  declare const mcpGenerator: ReactGenerator<PluginMcp>;
@@ -1,6 +1,5 @@
1
1
  import { Fabric } from "@kubb/react-fabric";
2
2
  import { KubbFile } from "@kubb/fabric-core/types";
3
- import { ConsolaInstance, LogLevel } from "consola";
4
3
  import * as OasTypes from "oas/types";
5
4
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
6
5
  import { Operation, Operation as Operation$1 } from "oas/operation";
@@ -23,75 +22,229 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
23
22
  abstract build(...params: unknown[]): unknown;
24
23
  }
25
24
  //#endregion
26
- //#region ../core/src/utils/EventEmitter.d.ts
27
- declare class EventEmitter<TEvents extends Record<string, any>> {
28
- #private;
29
- constructor();
30
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
31
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
32
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
33
- removeAll(): void;
34
- }
35
- //#endregion
36
- //#region ../core/src/logger.d.ts
25
+ //#region ../core/src/Kubb.d.ts
37
26
  type DebugEvent = {
38
27
  date: Date;
39
28
  logs: string[];
40
29
  fileName?: string;
30
+ };
31
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
32
+ hookName: H;
33
+ plugins: Array<Plugin>;
34
+ };
35
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
36
+ hookName: H;
37
+ };
38
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
39
+ strategy: Strategy;
40
+ hookName: H;
41
+ plugin: Plugin;
42
+ parameters?: unknown[] | undefined;
43
+ output?: unknown;
44
+ };
45
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
46
+ duration: number;
47
+ strategy: Strategy;
48
+ hookName: H;
49
+ plugin: Plugin;
50
+ parameters?: unknown[] | undefined;
51
+ output?: unknown;
52
+ };
53
+ /**
54
+ * Events emitted during the Kubb code generation lifecycle.
55
+ * These events can be listened to for logging, progress tracking, and custom integrations.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * import type { AsyncEventEmitter } from '@kubb/core'
60
+ * import type { KubbEvents } from '@kubb/core'
61
+ *
62
+ * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
63
+ *
64
+ * events.on('lifecycle:start', () => {
65
+ * console.log('Starting Kubb generation')
66
+ * })
67
+ *
68
+ * events.on('plugin:end', (plugin, duration) => {
69
+ * console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
70
+ * })
71
+ * ```
72
+ */
73
+ interface KubbEvents {
41
74
  /**
42
- * Category of the debug log, used for GitHub Actions grouping
43
- * - 'setup': Initial configuration and environment setup
44
- * - 'plugin': Plugin installation and execution
45
- * - 'hook': Plugin hook execution details
46
- * - 'schema': Schema parsing and generation
47
- * - 'file': File operations (read/write/generate)
48
- * - 'error': Error details and stack traces
49
- * - undefined: Generic logs (always inline)
75
+ * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
50
76
  */
51
- category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
77
+ 'lifecycle:start': [version: string];
52
78
  /**
53
- * Plugin name for grouping plugin-specific logs together
79
+ * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
54
80
  */
55
- pluginName?: string;
81
+ 'lifecycle:end': [];
56
82
  /**
57
- * Indicates if this is the start or end of a plugin's execution
58
- * - 'start': Start of plugin execution group
59
- * - 'end': End of plugin execution group
83
+ * Emitted when configuration loading starts.
60
84
  */
61
- pluginGroupMarker?: 'start' | 'end';
62
- };
63
- type Events$1 = {
64
- start: [message: string];
65
- success: [message: string];
66
- error: [message: string, error: Error];
67
- warning: [message: string];
68
- debug: [DebugEvent];
69
- verbose: [DebugEvent];
70
- info: [message: string];
71
- progress_start: [{
72
- id: string;
73
- size: number;
74
- message?: string;
75
- }];
76
- progressed: [{
77
- id: string;
78
- message?: string;
85
+ 'config:start': [];
86
+ /**
87
+ * Emitted when configuration loading is complete.
88
+ */
89
+ 'config:end': [configs: Array<Config>];
90
+ /**
91
+ * Emitted when code generation phase starts.
92
+ */
93
+ 'generation:start': [config: Config];
94
+ /**
95
+ * Emitted when code generation phase completes.
96
+ */
97
+ 'generation:end': [Config: Config];
98
+ /**
99
+ * Emitted with a summary of the generation results.
100
+ * Contains summary lines, title, and success status.
101
+ */
102
+ 'generation:summary': [Config: Config, {
103
+ failedPlugins: Set<{
104
+ plugin: Plugin;
105
+ error: Error;
106
+ }>;
107
+ status: 'success' | 'failed';
108
+ hrStart: [number, number];
109
+ filesCreated: number;
110
+ pluginTimings?: Map<string, number>;
79
111
  }];
80
- progress_stop: [{
81
- id: string;
112
+ /**
113
+ * Emitted when code formatting starts (e.g., running Biome or Prettier).
114
+ */
115
+ 'format:start': [];
116
+ /**
117
+ * Emitted when code formatting completes.
118
+ */
119
+ 'format:end': [];
120
+ /**
121
+ * Emitted when linting starts.
122
+ */
123
+ 'lint:start': [];
124
+ /**
125
+ * Emitted when linting completes.
126
+ */
127
+ 'lint:end': [];
128
+ /**
129
+ * Emitted when plugin hooks execution starts.
130
+ */
131
+ 'hooks:start': [];
132
+ /**
133
+ * Emitted when plugin hooks execution completes.
134
+ */
135
+ 'hooks:end': [];
136
+ /**
137
+ * Emitted when a single hook execution starts.
138
+ */
139
+ 'hook:start': [command: string];
140
+ /**
141
+ * Emitted to execute a hook command (e.g., format or lint).
142
+ * The callback should be invoked when the command completes.
143
+ */
144
+ 'hook:execute': [{
145
+ command: string | URL;
146
+ args?: readonly string[];
147
+ }, cb: () => void];
148
+ /**
149
+ * Emitted when a single hook execution completes.
150
+ */
151
+ 'hook:end': [command: string];
152
+ /**
153
+ * Emitted when a new version of Kubb is available.
154
+ */
155
+ 'version:new': [currentVersion: string, latestVersion: string];
156
+ /**
157
+ * Informational message event.
158
+ */
159
+ info: [message: string, info?: string];
160
+ /**
161
+ * Error event. Emitted when an error occurs during code generation.
162
+ */
163
+ error: [error: Error, meta?: Record<string, unknown>];
164
+ /**
165
+ * Success message event.
166
+ */
167
+ success: [message: string, info?: string];
168
+ /**
169
+ * Warning message event.
170
+ */
171
+ warn: [message: string, info?: string];
172
+ /**
173
+ * Debug event for detailed logging.
174
+ * Contains timestamp, log messages, and optional filename.
175
+ */
176
+ debug: [meta: DebugEvent];
177
+ /**
178
+ * Emitted when file processing starts.
179
+ * Contains the list of files to be processed.
180
+ */
181
+ 'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
182
+ /**
183
+ * Emitted for each file being processed, providing progress updates.
184
+ * Contains processed count, total count, percentage, and file details.
185
+ */
186
+ 'file:processing:update': [{
187
+ /** Number of files processed so far */
188
+ processed: number;
189
+ /** Total number of files to process */
190
+ total: number;
191
+ /** Processing percentage (0-100) */
192
+ percentage: number;
193
+ /** Optional source identifier */
194
+ source?: string;
195
+ /** The file being processed */
196
+ file: KubbFile.ResolvedFile;
197
+ /**
198
+ * Kubb configuration (not present in Fabric).
199
+ * Provides access to the current config during file processing.
200
+ */
201
+ config: Config;
82
202
  }];
83
- };
84
- type Logger = {
85
203
  /**
86
- * Optional config name to show in CLI output
204
+ * Emitted when file processing completes.
205
+ * Contains the list of processed files.
87
206
  */
88
- name?: string;
89
- logLevel: LogLevel;
90
- consola?: ConsolaInstance;
91
- on: EventEmitter<Events$1>['on'];
92
- emit: EventEmitter<Events$1>['emit'];
93
- writeLogs: () => Promise<void>;
94
- };
207
+ 'files:processing:end': [files: KubbFile.ResolvedFile[]];
208
+ /**
209
+ * Emitted when a plugin starts executing.
210
+ */
211
+ 'plugin:start': [plugin: Plugin];
212
+ /**
213
+ * Emitted when a plugin completes execution.
214
+ */
215
+ 'plugin:end': [plugin: Plugin, duration: number];
216
+ /**
217
+ * Emitted when plugin hook progress tracking starts.
218
+ * Contains the hook name and list of plugins to execute.
219
+ */
220
+ 'plugins:hook:progress:start': [meta: ProgressStartMeta];
221
+ /**
222
+ * Emitted when plugin hook progress tracking ends.
223
+ * Contains the hook name that completed.
224
+ */
225
+ 'plugins:hook:progress:end': [meta: ProgressStopMeta];
226
+ /**
227
+ * Emitted when a plugin hook starts processing.
228
+ * Contains strategy, hook name, plugin, parameters, and output.
229
+ */
230
+ 'plugins:hook:processing:start': [meta: ExecutingMeta];
231
+ /**
232
+ * Emitted when a plugin hook completes processing.
233
+ * Contains duration, strategy, hook name, plugin, parameters, and output.
234
+ */
235
+ 'plugins:hook:processing:end': [meta: ExecutedMeta];
236
+ }
237
+ //#endregion
238
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
239
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
240
+ #private;
241
+ constructor(maxListener?: number);
242
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
243
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
244
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
245
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
246
+ removeAll(): void;
247
+ }
95
248
  //#endregion
96
249
  //#region ../core/src/utils/types.d.ts
97
250
  type PossiblePromise<T> = Promise<T> | T;
@@ -355,7 +508,7 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
355
508
  * merging multiple sources into the same output file
356
509
  */
357
510
  upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
358
- logger: Logger;
511
+ events: AsyncEventEmitter<KubbEvents>;
359
512
  mode: KubbFile.Mode;
360
513
  /**
361
514
  * Current plugin
@@ -401,35 +554,6 @@ type Group = {
401
554
  //#region ../core/src/PluginManager.d.ts
402
555
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
403
556
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
404
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
405
- strategy: Strategy;
406
- hookName: H;
407
- plugin: Plugin;
408
- parameters?: unknown[] | undefined;
409
- output?: unknown;
410
- };
411
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
412
- duration: number;
413
- strategy: Strategy;
414
- hookName: H;
415
- plugin: Plugin;
416
- parameters?: unknown[] | undefined;
417
- output?: unknown;
418
- };
419
- type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
420
- hookName: H;
421
- duration: number;
422
- strategy: Strategy;
423
- parameters?: unknown[] | undefined;
424
- plugin: Plugin;
425
- };
426
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
427
- hookName: H;
428
- plugins: Array<Plugin>;
429
- };
430
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
431
- hookName: H;
432
- };
433
557
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
434
558
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
435
559
  result: Result;
@@ -437,19 +561,12 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
437
561
  };
438
562
  type Options$1 = {
439
563
  fabric: Fabric;
440
- logger: Logger;
564
+ events: AsyncEventEmitter<KubbEvents>;
441
565
  /**
442
566
  * @default Number.POSITIVE_INFINITY
443
567
  */
444
568
  concurrency?: number;
445
569
  };
446
- type Events = {
447
- progress_start: [meta: ProgressStartMeta];
448
- progress_stop: [meta: ProgressStopMeta];
449
- executing: [meta: ExecutingMeta];
450
- executed: [meta: ExecutedMeta];
451
- error: [error: Error, meta: ErrorMeta];
452
- };
453
570
  type GetFileProps<TOptions = object> = {
454
571
  name: string;
455
572
  mode?: KubbFile.Mode;
@@ -459,10 +576,10 @@ type GetFileProps<TOptions = object> = {
459
576
  };
460
577
  declare class PluginManager {
461
578
  #private;
462
- readonly events: EventEmitter<Events>;
463
579
  readonly config: Config;
464
580
  readonly options: Options$1;
465
581
  constructor(config: Config, options: Options$1);
582
+ get events(): AsyncEventEmitter<KubbEvents>;
466
583
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
467
584
  get plugins(): Array<Plugin>;
468
585
  getFile<TOptions = object>({
@@ -476,10 +593,6 @@ declare class PluginManager {
476
593
  }>;
477
594
  resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
478
595
  resolveName: (params: ResolveNameParams) => string;
479
- /**
480
- * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
481
- */
482
- on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
483
596
  /**
484
597
  * Run a specific hookName for plugin x.
485
598
  */
@@ -698,7 +811,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
698
811
  override: Array<Override<TOptions>> | undefined;
699
812
  contentType: contentType | undefined;
700
813
  pluginManager: PluginManager;
701
- logger?: Logger;
814
+ events?: AsyncEventEmitter<KubbEvents>;
702
815
  /**
703
816
  * Current plugin
704
817
  */
@@ -942,7 +1055,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
942
1055
  fabric: Fabric;
943
1056
  oas: Oas;
944
1057
  pluginManager: PluginManager;
945
- logger?: Logger;
1058
+ events?: AsyncEventEmitter<KubbEvents>;
946
1059
  /**
947
1060
  * Current plugin
948
1061
  */
@@ -1039,4 +1152,4 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
1039
1152
  };
1040
1153
  //#endregion
1041
1154
  export { OperationSchemas as a, Oas as c, Output as d, PluginFactoryOptions as f, Include as i, contentType as l, UserPluginWithLifeCycle as m, ReactGenerator as n, Override as o, ResolveNameParams as p, Exclude$1 as r, ResolvePathOptions as s, Generator as t, Group as u };
1042
- //# sourceMappingURL=index-CS2SZYLV.d.ts.map
1155
+ //# sourceMappingURL=index-Bg8E5WWf.d.ts.map
@@ -1,6 +1,5 @@
1
1
  import { KubbFile } from "@kubb/fabric-core/types";
2
2
  import { Fabric } from "@kubb/react-fabric";
3
- import { ConsolaInstance, LogLevel } from "consola";
4
3
  import * as OasTypes from "oas/types";
5
4
  import { HttpMethods as HttpMethod, OASDocument, SchemaObject, User } from "oas/types";
6
5
  import { Operation, Operation as Operation$1 } from "oas/operation";
@@ -23,75 +22,229 @@ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
23
22
  abstract build(...params: unknown[]): unknown;
24
23
  }
25
24
  //#endregion
26
- //#region ../core/src/utils/EventEmitter.d.ts
27
- declare class EventEmitter<TEvents extends Record<string, any>> {
28
- #private;
29
- constructor();
30
- emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
31
- on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
32
- off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
33
- removeAll(): void;
34
- }
35
- //#endregion
36
- //#region ../core/src/logger.d.ts
25
+ //#region ../core/src/Kubb.d.ts
37
26
  type DebugEvent = {
38
27
  date: Date;
39
28
  logs: string[];
40
29
  fileName?: string;
30
+ };
31
+ type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
32
+ hookName: H;
33
+ plugins: Array<Plugin>;
34
+ };
35
+ type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
36
+ hookName: H;
37
+ };
38
+ type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
39
+ strategy: Strategy;
40
+ hookName: H;
41
+ plugin: Plugin;
42
+ parameters?: unknown[] | undefined;
43
+ output?: unknown;
44
+ };
45
+ type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
46
+ duration: number;
47
+ strategy: Strategy;
48
+ hookName: H;
49
+ plugin: Plugin;
50
+ parameters?: unknown[] | undefined;
51
+ output?: unknown;
52
+ };
53
+ /**
54
+ * Events emitted during the Kubb code generation lifecycle.
55
+ * These events can be listened to for logging, progress tracking, and custom integrations.
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * import type { AsyncEventEmitter } from '@kubb/core'
60
+ * import type { KubbEvents } from '@kubb/core'
61
+ *
62
+ * const events: AsyncEventEmitter<KubbEvents> = new AsyncEventEmitter()
63
+ *
64
+ * events.on('lifecycle:start', () => {
65
+ * console.log('Starting Kubb generation')
66
+ * })
67
+ *
68
+ * events.on('plugin:end', (plugin, duration) => {
69
+ * console.log(`Plugin ${plugin.name} completed in ${duration}ms`)
70
+ * })
71
+ * ```
72
+ */
73
+ interface KubbEvents {
41
74
  /**
42
- * Category of the debug log, used for GitHub Actions grouping
43
- * - 'setup': Initial configuration and environment setup
44
- * - 'plugin': Plugin installation and execution
45
- * - 'hook': Plugin hook execution details
46
- * - 'schema': Schema parsing and generation
47
- * - 'file': File operations (read/write/generate)
48
- * - 'error': Error details and stack traces
49
- * - undefined: Generic logs (always inline)
75
+ * Emitted at the beginning of the Kubb lifecycle, before any code generation starts.
50
76
  */
51
- category?: 'setup' | 'plugin' | 'hook' | 'schema' | 'file' | 'error';
77
+ 'lifecycle:start': [version: string];
52
78
  /**
53
- * Plugin name for grouping plugin-specific logs together
79
+ * Emitted at the end of the Kubb lifecycle, after all code generation is complete.
54
80
  */
55
- pluginName?: string;
81
+ 'lifecycle:end': [];
56
82
  /**
57
- * Indicates if this is the start or end of a plugin's execution
58
- * - 'start': Start of plugin execution group
59
- * - 'end': End of plugin execution group
83
+ * Emitted when configuration loading starts.
60
84
  */
61
- pluginGroupMarker?: 'start' | 'end';
62
- };
63
- type Events$1 = {
64
- start: [message: string];
65
- success: [message: string];
66
- error: [message: string, error: Error];
67
- warning: [message: string];
68
- debug: [DebugEvent];
69
- verbose: [DebugEvent];
70
- info: [message: string];
71
- progress_start: [{
72
- id: string;
73
- size: number;
74
- message?: string;
75
- }];
76
- progressed: [{
77
- id: string;
78
- message?: string;
85
+ 'config:start': [];
86
+ /**
87
+ * Emitted when configuration loading is complete.
88
+ */
89
+ 'config:end': [configs: Array<Config>];
90
+ /**
91
+ * Emitted when code generation phase starts.
92
+ */
93
+ 'generation:start': [config: Config];
94
+ /**
95
+ * Emitted when code generation phase completes.
96
+ */
97
+ 'generation:end': [Config: Config];
98
+ /**
99
+ * Emitted with a summary of the generation results.
100
+ * Contains summary lines, title, and success status.
101
+ */
102
+ 'generation:summary': [Config: Config, {
103
+ failedPlugins: Set<{
104
+ plugin: Plugin;
105
+ error: Error;
106
+ }>;
107
+ status: 'success' | 'failed';
108
+ hrStart: [number, number];
109
+ filesCreated: number;
110
+ pluginTimings?: Map<string, number>;
79
111
  }];
80
- progress_stop: [{
81
- id: string;
112
+ /**
113
+ * Emitted when code formatting starts (e.g., running Biome or Prettier).
114
+ */
115
+ 'format:start': [];
116
+ /**
117
+ * Emitted when code formatting completes.
118
+ */
119
+ 'format:end': [];
120
+ /**
121
+ * Emitted when linting starts.
122
+ */
123
+ 'lint:start': [];
124
+ /**
125
+ * Emitted when linting completes.
126
+ */
127
+ 'lint:end': [];
128
+ /**
129
+ * Emitted when plugin hooks execution starts.
130
+ */
131
+ 'hooks:start': [];
132
+ /**
133
+ * Emitted when plugin hooks execution completes.
134
+ */
135
+ 'hooks:end': [];
136
+ /**
137
+ * Emitted when a single hook execution starts.
138
+ */
139
+ 'hook:start': [command: string];
140
+ /**
141
+ * Emitted to execute a hook command (e.g., format or lint).
142
+ * The callback should be invoked when the command completes.
143
+ */
144
+ 'hook:execute': [{
145
+ command: string | URL;
146
+ args?: readonly string[];
147
+ }, cb: () => void];
148
+ /**
149
+ * Emitted when a single hook execution completes.
150
+ */
151
+ 'hook:end': [command: string];
152
+ /**
153
+ * Emitted when a new version of Kubb is available.
154
+ */
155
+ 'version:new': [currentVersion: string, latestVersion: string];
156
+ /**
157
+ * Informational message event.
158
+ */
159
+ info: [message: string, info?: string];
160
+ /**
161
+ * Error event. Emitted when an error occurs during code generation.
162
+ */
163
+ error: [error: Error, meta?: Record<string, unknown>];
164
+ /**
165
+ * Success message event.
166
+ */
167
+ success: [message: string, info?: string];
168
+ /**
169
+ * Warning message event.
170
+ */
171
+ warn: [message: string, info?: string];
172
+ /**
173
+ * Debug event for detailed logging.
174
+ * Contains timestamp, log messages, and optional filename.
175
+ */
176
+ debug: [meta: DebugEvent];
177
+ /**
178
+ * Emitted when file processing starts.
179
+ * Contains the list of files to be processed.
180
+ */
181
+ 'files:processing:start': [files: Array<KubbFile.ResolvedFile>];
182
+ /**
183
+ * Emitted for each file being processed, providing progress updates.
184
+ * Contains processed count, total count, percentage, and file details.
185
+ */
186
+ 'file:processing:update': [{
187
+ /** Number of files processed so far */
188
+ processed: number;
189
+ /** Total number of files to process */
190
+ total: number;
191
+ /** Processing percentage (0-100) */
192
+ percentage: number;
193
+ /** Optional source identifier */
194
+ source?: string;
195
+ /** The file being processed */
196
+ file: KubbFile.ResolvedFile;
197
+ /**
198
+ * Kubb configuration (not present in Fabric).
199
+ * Provides access to the current config during file processing.
200
+ */
201
+ config: Config;
82
202
  }];
83
- };
84
- type Logger = {
85
203
  /**
86
- * Optional config name to show in CLI output
204
+ * Emitted when file processing completes.
205
+ * Contains the list of processed files.
87
206
  */
88
- name?: string;
89
- logLevel: LogLevel;
90
- consola?: ConsolaInstance;
91
- on: EventEmitter<Events$1>['on'];
92
- emit: EventEmitter<Events$1>['emit'];
93
- writeLogs: () => Promise<void>;
94
- };
207
+ 'files:processing:end': [files: KubbFile.ResolvedFile[]];
208
+ /**
209
+ * Emitted when a plugin starts executing.
210
+ */
211
+ 'plugin:start': [plugin: Plugin];
212
+ /**
213
+ * Emitted when a plugin completes execution.
214
+ */
215
+ 'plugin:end': [plugin: Plugin, duration: number];
216
+ /**
217
+ * Emitted when plugin hook progress tracking starts.
218
+ * Contains the hook name and list of plugins to execute.
219
+ */
220
+ 'plugins:hook:progress:start': [meta: ProgressStartMeta];
221
+ /**
222
+ * Emitted when plugin hook progress tracking ends.
223
+ * Contains the hook name that completed.
224
+ */
225
+ 'plugins:hook:progress:end': [meta: ProgressStopMeta];
226
+ /**
227
+ * Emitted when a plugin hook starts processing.
228
+ * Contains strategy, hook name, plugin, parameters, and output.
229
+ */
230
+ 'plugins:hook:processing:start': [meta: ExecutingMeta];
231
+ /**
232
+ * Emitted when a plugin hook completes processing.
233
+ * Contains duration, strategy, hook name, plugin, parameters, and output.
234
+ */
235
+ 'plugins:hook:processing:end': [meta: ExecutedMeta];
236
+ }
237
+ //#endregion
238
+ //#region ../core/src/utils/AsyncEventEmitter.d.ts
239
+ declare class AsyncEventEmitter<TEvents extends Record<string, any>> {
240
+ #private;
241
+ constructor(maxListener?: number);
242
+ emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArgs: TEvents[TEventName]): Promise<void>;
243
+ on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
244
+ onOnce<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArgs: TEvents[TEventName]) => void): void;
245
+ off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
246
+ removeAll(): void;
247
+ }
95
248
  //#endregion
96
249
  //#region ../core/src/utils/types.d.ts
97
250
  type PossiblePromise<T> = Promise<T> | T;
@@ -355,7 +508,7 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
355
508
  * merging multiple sources into the same output file
356
509
  */
357
510
  upsertFile: (...file: Array<KubbFile.File>) => Promise<void>;
358
- logger: Logger;
511
+ events: AsyncEventEmitter<KubbEvents>;
359
512
  mode: KubbFile.Mode;
360
513
  /**
361
514
  * Current plugin
@@ -401,35 +554,6 @@ type Group = {
401
554
  //#region ../core/src/PluginManager.d.ts
402
555
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
403
556
  type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
404
- type ExecutingMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
405
- strategy: Strategy;
406
- hookName: H;
407
- plugin: Plugin;
408
- parameters?: unknown[] | undefined;
409
- output?: unknown;
410
- };
411
- type ExecutedMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
412
- duration: number;
413
- strategy: Strategy;
414
- hookName: H;
415
- plugin: Plugin;
416
- parameters?: unknown[] | undefined;
417
- output?: unknown;
418
- };
419
- type ErrorMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
420
- hookName: H;
421
- duration: number;
422
- strategy: Strategy;
423
- parameters?: unknown[] | undefined;
424
- plugin: Plugin;
425
- };
426
- type ProgressStartMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
427
- hookName: H;
428
- plugins: Array<Plugin>;
429
- };
430
- type ProgressStopMeta<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
431
- hookName: H;
432
- };
433
557
  type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
434
558
  type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
435
559
  result: Result;
@@ -437,19 +561,12 @@ type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseRe
437
561
  };
438
562
  type Options$1 = {
439
563
  fabric: Fabric;
440
- logger: Logger;
564
+ events: AsyncEventEmitter<KubbEvents>;
441
565
  /**
442
566
  * @default Number.POSITIVE_INFINITY
443
567
  */
444
568
  concurrency?: number;
445
569
  };
446
- type Events = {
447
- progress_start: [meta: ProgressStartMeta];
448
- progress_stop: [meta: ProgressStopMeta];
449
- executing: [meta: ExecutingMeta];
450
- executed: [meta: ExecutedMeta];
451
- error: [error: Error, meta: ErrorMeta];
452
- };
453
570
  type GetFileProps<TOptions = object> = {
454
571
  name: string;
455
572
  mode?: KubbFile.Mode;
@@ -459,10 +576,10 @@ type GetFileProps<TOptions = object> = {
459
576
  };
460
577
  declare class PluginManager {
461
578
  #private;
462
- readonly events: EventEmitter<Events>;
463
579
  readonly config: Config;
464
580
  readonly options: Options$1;
465
581
  constructor(config: Config, options: Options$1);
582
+ get events(): AsyncEventEmitter<KubbEvents>;
466
583
  getContext<TOptions extends PluginFactoryOptions>(plugin: Plugin<TOptions>): PluginContext<TOptions> & Record<string, any>;
467
584
  get plugins(): Array<Plugin>;
468
585
  getFile<TOptions = object>({
@@ -476,10 +593,6 @@ declare class PluginManager {
476
593
  }>;
477
594
  resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.Path;
478
595
  resolveName: (params: ResolveNameParams) => string;
479
- /**
480
- * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
481
- */
482
- on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
483
596
  /**
484
597
  * Run a specific hookName for plugin x.
485
598
  */
@@ -698,7 +811,7 @@ type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
698
811
  override: Array<Override<TOptions>> | undefined;
699
812
  contentType: contentType | undefined;
700
813
  pluginManager: PluginManager;
701
- logger?: Logger;
814
+ events?: AsyncEventEmitter<KubbEvents>;
702
815
  /**
703
816
  * Current plugin
704
817
  */
@@ -942,7 +1055,7 @@ type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
942
1055
  fabric: Fabric;
943
1056
  oas: Oas;
944
1057
  pluginManager: PluginManager;
945
- logger?: Logger;
1058
+ events?: AsyncEventEmitter<KubbEvents>;
946
1059
  /**
947
1060
  * Current plugin
948
1061
  */
@@ -1039,4 +1152,4 @@ type CoreGenerator<TOptions extends PluginFactoryOptions> = {
1039
1152
  };
1040
1153
  //#endregion
1041
1154
  export { OperationSchemas as a, Oas as c, Output as d, PluginFactoryOptions as f, Include as i, contentType as l, UserPluginWithLifeCycle as m, ReactGenerator as n, Override as o, ResolveNameParams as p, Exclude$1 as r, ResolvePathOptions as s, Generator as t, Group as u };
1042
- //# sourceMappingURL=index-CXth3-Jh.d.cts.map
1155
+ //# sourceMappingURL=index-CkVh6UKa.d.cts.map
package/dist/index.cjs CHANGED
@@ -89,7 +89,7 @@ const pluginMcp = (0, __kubb_core.definePlugin)((options) => {
89
89
  fabric: this.fabric,
90
90
  oas,
91
91
  pluginManager: this.pluginManager,
92
- logger: this.logger,
92
+ events: this.events,
93
93
  plugin: this.plugin,
94
94
  contentType,
95
95
  exclude,
@@ -102,8 +102,7 @@ const pluginMcp = (0, __kubb_core.definePlugin)((options) => {
102
102
  type: output.barrelType ?? "named",
103
103
  root,
104
104
  output,
105
- meta: { pluginKey: this.plugin.key },
106
- logger: this.logger
105
+ meta: { pluginKey: this.plugin.key }
107
106
  });
108
107
  await this.upsertFile(...barrelFiles);
109
108
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n logger: this.logger,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,iCAAcC,mCAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAACC;GAAeC;GAAcC;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAE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,MAAM,QAAQ,MAba,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","pluginClientName","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,iCAAcC,mCAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAACC;GAAeC;GAAcC;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,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AAM,KAAK,QAAQ;IACjB,UAAU;IACV,MAAMA,kBAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,kDAA2B,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,sCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { m as UserPluginWithLifeCycle } from "./index-CXth3-Jh.cjs";
2
- import { n as PluginMcp, t as Options } from "./types-ut1IL45-.cjs";
1
+ import { m as UserPluginWithLifeCycle } from "./index-CkVh6UKa.cjs";
2
+ import { n as PluginMcp, t as Options } from "./types-UMVHNvJx.cjs";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginMcpName = "plugin-mcp";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { m as UserPluginWithLifeCycle } from "./index-CS2SZYLV.js";
2
- import { n as PluginMcp, t as Options } from "./types-CeCRegVI.js";
1
+ import { m as UserPluginWithLifeCycle } from "./index-Bg8E5WWf.js";
2
+ import { n as PluginMcp, t as Options } from "./types-COUCgQPC.js";
3
3
 
4
4
  //#region src/plugin.d.ts
5
5
  declare const pluginMcpName = "plugin-mcp";
package/dist/index.js CHANGED
@@ -88,7 +88,7 @@ const pluginMcp = definePlugin((options) => {
88
88
  fabric: this.fabric,
89
89
  oas,
90
90
  pluginManager: this.pluginManager,
91
- logger: this.logger,
91
+ events: this.events,
92
92
  plugin: this.plugin,
93
93
  contentType,
94
94
  exclude,
@@ -101,8 +101,7 @@ const pluginMcp = definePlugin((options) => {
101
101
  type: output.barrelType ?? "named",
102
102
  root,
103
103
  output,
104
- meta: { pluginKey: this.plugin.key },
105
- logger: this.logger
104
+ meta: { pluginKey: this.plugin.key }
106
105
  });
107
106
  await this.upsertFile(...barrelFiles);
108
107
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n logger: this.logger,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,cAAyB,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAAC,cAAc,gBAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAAC;GAAe;GAAc;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,I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,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
1
+ {"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { resolveModuleSource } from '@kubb/core/utils'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: 'data',\n ...options.client,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: resolveModuleSource(\n this.plugin.options.client.client === 'fetch' ? '@kubb/plugin-client/templates/clients/fetch' : '@kubb/plugin-client/templates/clients/axios',\n ).source,\n isExportable: true,\n isIndexable: true,\n },\n ],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: resolveModuleSource('@kubb/plugin-client/templates/config').source,\n isExportable: false,\n isIndexable: false,\n },\n ],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,cAAyB,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAAC,cAAc,gBAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAAC;GAAe;GAAc;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OA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AQ;IACjB,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP;KACE,MAAM;KACN,OAAO,oBAAoB,uCAAuC,CAAC;KACnE,cAAc;KACd,aAAa;KACd,CACF;IACF,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,MAAM,eAAe,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
@@ -1,4 +1,4 @@
1
- import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-CS2SZYLV.js";
1
+ import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-Bg8E5WWf.js";
2
2
 
3
3
  //#region ../plugin-client/src/types.d.ts
4
4
 
@@ -180,4 +180,4 @@ type ResolvedOptions = {
180
180
  type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
181
181
  //#endregion
182
182
  export { PluginMcp as n, Options as t };
183
- //# sourceMappingURL=types-CeCRegVI.d.ts.map
183
+ //# sourceMappingURL=types-COUCgQPC.d.ts.map
@@ -1,4 +1,4 @@
1
- import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-CXth3-Jh.cjs";
1
+ import { c as Oas, d as Output, f as PluginFactoryOptions, i as Include, l as contentType, o as Override, p as ResolveNameParams, r as Exclude, s as ResolvePathOptions, t as Generator, u as Group } from "./index-CkVh6UKa.cjs";
2
2
 
3
3
  //#region ../plugin-client/src/types.d.ts
4
4
 
@@ -180,4 +180,4 @@ type ResolvedOptions = {
180
180
  type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
181
181
  //#endregion
182
182
  export { PluginMcp as n, Options as t };
183
- //# sourceMappingURL=types-ut1IL45-.d.cts.map
183
+ //# sourceMappingURL=types-UMVHNvJx.d.cts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-mcp",
3
- "version": "4.11.2",
3
+ "version": "4.12.0",
4
4
  "description": "Generator mcp",
5
5
  "keywords": [
6
6
  "typescript",
@@ -69,13 +69,13 @@
69
69
  }
70
70
  ],
71
71
  "dependencies": {
72
- "@kubb/react-fabric": "0.5.4",
73
- "@kubb/core": "4.11.2",
74
- "@kubb/oas": "4.11.2",
75
- "@kubb/plugin-client": "4.11.2",
76
- "@kubb/plugin-oas": "4.11.2",
77
- "@kubb/plugin-ts": "4.11.2",
78
- "@kubb/plugin-zod": "4.11.2"
72
+ "@kubb/react-fabric": "0.7.0",
73
+ "@kubb/core": "4.12.0",
74
+ "@kubb/oas": "4.12.0",
75
+ "@kubb/plugin-client": "4.12.0",
76
+ "@kubb/plugin-oas": "4.12.0",
77
+ "@kubb/plugin-ts": "4.12.0",
78
+ "@kubb/plugin-zod": "4.12.0"
79
79
  },
80
80
  "devDependencies": {},
81
81
  "engines": {
package/src/plugin.ts CHANGED
@@ -135,7 +135,7 @@ export const pluginMcp = definePlugin<PluginMcp>((options) => {
135
135
  fabric: this.fabric,
136
136
  oas,
137
137
  pluginManager: this.pluginManager,
138
- logger: this.logger,
138
+ events: this.events,
139
139
  plugin: this.plugin,
140
140
  contentType,
141
141
  exclude,
@@ -154,7 +154,6 @@ export const pluginMcp = definePlugin<PluginMcp>((options) => {
154
154
  meta: {
155
155
  pluginKey: this.plugin.key,
156
156
  },
157
- logger: this.logger,
158
157
  })
159
158
 
160
159
  await this.upsertFile(...barrelFiles)