@eventcatalog/core 3.47.4 → 3.48.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.
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(analytics_exports);
36
36
  var import_os = __toESM(require("os"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.47.4";
39
+ var version = "3.48.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  raiseEvent
3
- } from "../chunk-K2RCQSFM.js";
4
- import "../chunk-ZW5UIHAH.js";
3
+ } from "../chunk-4PAHVB2Y.js";
4
+ import "../chunk-E4TWUZEU.js";
5
5
  export {
6
6
  raiseEvent
7
7
  };
@@ -140,7 +140,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
140
140
  var import_os = __toESM(require("os"), 1);
141
141
 
142
142
  // package.json
143
- var version = "3.47.4";
143
+ var version = "3.48.0";
144
144
 
145
145
  // src/constants.ts
146
146
  var VERSION = version;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  log_build_default
3
- } from "../chunk-DFGDA5Y7.js";
4
- import "../chunk-K2RCQSFM.js";
3
+ } from "../chunk-5WM3KVZ4.js";
5
4
  import "../chunk-DAOXTQVS.js";
6
- import "../chunk-ZW5UIHAH.js";
5
+ import "../chunk-4PAHVB2Y.js";
6
+ import "../chunk-E4TWUZEU.js";
7
7
  import "../chunk-6QENHZZP.js";
8
8
  export {
9
9
  log_build_default as default
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-ZW5UIHAH.js";
3
+ } from "./chunk-E4TWUZEU.js";
4
4
 
5
5
  // src/analytics/analytics.js
6
6
  import os from "os";
@@ -1,10 +1,10 @@
1
- import {
2
- raiseEvent
3
- } from "./chunk-K2RCQSFM.js";
4
1
  import {
5
2
  countResources,
6
3
  serializeCounts
7
4
  } from "./chunk-DAOXTQVS.js";
5
+ import {
6
+ raiseEvent
7
+ } from "./chunk-4PAHVB2Y.js";
8
8
  import {
9
9
  getEventCatalogConfigFile,
10
10
  verifyRequiredFieldsAreInCatalogConfigFile
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-ZW5UIHAH.js";
3
+ } from "./chunk-E4TWUZEU.js";
4
4
 
5
5
  // src/utils/cli-logger.ts
6
6
  import pc from "picocolors";
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "3.47.4";
2
+ var version = "3.48.0";
3
3
 
4
4
  // src/constants.ts
5
5
  var VERSION = version;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  logger
3
- } from "./chunk-XIXRWB3Y.js";
3
+ } from "./chunk-BOOGBLDG.js";
4
4
  import {
5
5
  cleanup,
6
6
  getEventCatalogConfigFile
@@ -25,7 +25,7 @@ __export(constants_exports, {
25
25
  module.exports = __toCommonJS(constants_exports);
26
26
 
27
27
  // package.json
28
- var version = "3.47.4";
28
+ var version = "3.48.0";
29
29
 
30
30
  // src/constants.ts
31
31
  var VERSION = version;
package/dist/constants.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  VERSION
3
- } from "./chunk-ZW5UIHAH.js";
3
+ } from "./chunk-E4TWUZEU.js";
4
4
  export {
5
5
  VERSION
6
6
  };
@@ -144,7 +144,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
144
144
  var import_picocolors = __toESM(require("picocolors"), 1);
145
145
 
146
146
  // package.json
147
- var version = "3.47.4";
147
+ var version = "3.48.0";
148
148
 
149
149
  // src/constants.ts
150
150
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
- runMigrations
3
- } from "./chunk-XUAF2H54.js";
4
- import "./chunk-CA4U2JP7.js";
2
+ log_build_default
3
+ } from "./chunk-5WM3KVZ4.js";
4
+ import "./chunk-DAOXTQVS.js";
5
5
  import {
6
6
  resolve_catalog_dependencies_default
7
7
  } from "./chunk-LHR4G2UO.js";
@@ -12,10 +12,10 @@ import {
12
12
  watch
13
13
  } from "./chunk-O3Y2G6CY.js";
14
14
  import {
15
- log_build_default
16
- } from "./chunk-DFGDA5Y7.js";
17
- import "./chunk-K2RCQSFM.js";
18
- import "./chunk-DAOXTQVS.js";
15
+ runMigrations
16
+ } from "./chunk-XUAF2H54.js";
17
+ import "./chunk-CA4U2JP7.js";
18
+ import "./chunk-4PAHVB2Y.js";
19
19
  import {
20
20
  catalogToAstro
21
21
  } from "./chunk-WQNKHIDM.js";
@@ -28,13 +28,13 @@ import {
28
28
  } from "./chunk-B7HCX5HM.js";
29
29
  import {
30
30
  generate
31
- } from "./chunk-FLHJWTY2.js";
31
+ } from "./chunk-GSDFCY6Q.js";
32
32
  import {
33
33
  logger
34
- } from "./chunk-XIXRWB3Y.js";
34
+ } from "./chunk-BOOGBLDG.js";
35
35
  import {
36
36
  VERSION
37
- } from "./chunk-ZW5UIHAH.js";
37
+ } from "./chunk-E4TWUZEU.js";
38
38
  import {
39
39
  getEventCatalogConfigFile,
40
40
  verifyRequiredFieldsAreInCatalogConfigFile
package/dist/generate.cjs CHANGED
@@ -108,7 +108,7 @@ var getEventCatalogConfigFile = async (projectDirectory) => {
108
108
  var import_picocolors = __toESM(require("picocolors"), 1);
109
109
 
110
110
  // package.json
111
- var version = "3.47.4";
111
+ var version = "3.48.0";
112
112
 
113
113
  // src/constants.ts
114
114
  var VERSION = version;
package/dist/generate.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-FLHJWTY2.js";
4
- import "./chunk-XIXRWB3Y.js";
5
- import "./chunk-ZW5UIHAH.js";
3
+ } from "./chunk-GSDFCY6Q.js";
4
+ import "./chunk-BOOGBLDG.js";
5
+ import "./chunk-E4TWUZEU.js";
6
6
  import "./chunk-6QENHZZP.js";
7
7
  export {
8
8
  generate
@@ -36,7 +36,7 @@ module.exports = __toCommonJS(cli_logger_exports);
36
36
  var import_picocolors = __toESM(require("picocolors"), 1);
37
37
 
38
38
  // package.json
39
- var version = "3.47.4";
39
+ var version = "3.48.0";
40
40
 
41
41
  // src/constants.ts
42
42
  var VERSION = version;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  logger
3
- } from "../chunk-XIXRWB3Y.js";
4
- import "../chunk-ZW5UIHAH.js";
3
+ } from "../chunk-BOOGBLDG.js";
4
+ import "../chunk-E4TWUZEU.js";
5
5
  export {
6
6
  logger
7
7
  };
@@ -30,6 +30,7 @@ import {
30
30
  resourceCollectionSchema,
31
31
  messageCollectionSchema,
32
32
  toolDescriptions,
33
+ getC4Diagram,
33
34
  } from '@enterprise/tools/catalog-tools';
34
35
  import { getCollection } from 'astro:content';
35
36
  import { createMcpAuthErrorResponse, validateMcpRequest } from './mcp-auth';
@@ -181,6 +182,17 @@ function createMcpServer() {
181
182
  createToolHandler(getConsumersOfMessage, 'Failed to get consumers')
182
183
  );
183
184
 
185
+ server.registerTool(
186
+ 'getC4Diagram',
187
+ {
188
+ description: toolDescriptions.getC4Diagram,
189
+ inputSchema: z.object({
190
+ viewId: z.string().describe('The id of the LikeC4 view to return source files for').optional(),
191
+ }),
192
+ },
193
+ createToolHandler(getC4Diagram, 'Failed to get c4 diagram')
194
+ );
195
+
184
196
  server.registerTool(
185
197
  'analyzeChangeImpact',
186
198
  {
@@ -328,7 +340,18 @@ function createMcpServer() {
328
340
  name: 'All Resources in EventCatalog',
329
341
  uri: 'eventcatalog://all',
330
342
  description: 'All messages, agents, domains and services in EventCatalog',
331
- collections: ['events', 'commands', 'queries', 'agents', 'services', 'domains', 'flows', 'channels', 'entities'] as const,
343
+ collections: [
344
+ 'events',
345
+ 'commands',
346
+ 'queries',
347
+ 'agents',
348
+ 'services',
349
+ 'domains',
350
+ 'flows',
351
+ 'channels',
352
+ 'entities',
353
+ 'adrs',
354
+ ] as const,
332
355
  },
333
356
  {
334
357
  name: 'All Events in EventCatalog',
@@ -360,6 +383,12 @@ function createMcpServer() {
360
383
  description: 'All agents in EventCatalog',
361
384
  collections: ['agents'] as const,
362
385
  },
386
+ {
387
+ name: 'All Architecture Decision Records (adrs) in EventCatalog',
388
+ uri: 'eventcatalog://adrs',
389
+ description: 'All architecture decision records in EventCatalog',
390
+ collections: ['adrs'] as const,
391
+ },
363
392
  {
364
393
  name: 'All Domains in EventCatalog',
365
394
  uri: 'eventcatalog://domains',
@@ -378,6 +407,12 @@ function createMcpServer() {
378
407
  description: 'All channels in EventCatalog',
379
408
  collections: ['channels'] as const,
380
409
  },
410
+ {
411
+ name: 'All Entities in EventCatalog',
412
+ uri: 'eventcatalog://entities',
413
+ description: 'All entities in EventCatalog',
414
+ collections: ['entities'] as const,
415
+ },
381
416
  {
382
417
  name: 'All Containers in EventCatalog',
383
418
  uri: 'eventcatalog://containers',
@@ -461,8 +496,10 @@ const mcpResources = [
461
496
  'eventcatalog://commands',
462
497
  'eventcatalog://queries',
463
498
  'eventcatalog://agents',
499
+ 'eventcatalog://adrs',
464
500
  'eventcatalog://services',
465
501
  'eventcatalog://domains',
502
+ 'eventcatalog://entities',
466
503
  'eventcatalog://flows',
467
504
  'eventcatalog://teams',
468
505
  'eventcatalog://users',
@@ -478,7 +515,7 @@ app.get('/', async (c: Context) => {
478
515
 
479
516
  return c.json({
480
517
  name: 'EventCatalog MCP Server',
481
- version: '1.0.0',
518
+ version: '1.1.0',
482
519
  status: 'running',
483
520
  tools: [...builtInTools, ...extendedToolNames],
484
521
  extendedTools: extendedToolNames.length > 0 ? extendedToolNames : undefined,
@@ -27,8 +27,75 @@ import { getNodesAndEdges as getNodesAndEdgesForDataProduct } from '@utils/node-
27
27
  import { getNodesAndEdges as getNodesAndEdgesForContainer } from '@utils/node-graphs/container-node-graph';
28
28
  import { convertToMermaid } from '@utils/node-graphs/export-mermaid';
29
29
  import config from '@config';
30
+ import { glob } from 'glob';
31
+ import path from 'node:path';
30
32
 
31
33
  const MESSAGE_COLLECTIONS = new Set(['events', 'commands', 'queries']);
34
+ const LIKEC4_SOURCE_PATTERN = '**/*.{c4,likec4}';
35
+
36
+ type LikeC4View = {
37
+ id: string;
38
+ kind: 'element' | 'dynamic' | 'deployment';
39
+ filePath: string;
40
+ line: number;
41
+ };
42
+
43
+ type LikeC4SourceFile = {
44
+ path: string;
45
+ content: string;
46
+ views: LikeC4View[];
47
+ };
48
+
49
+ const toPosixPath = (filePath: string) => filePath.split(path.sep).join(path.posix.sep);
50
+
51
+ const lineNumberAtIndex = (content: string, index: number) => content.slice(0, index).split(/\r\n|\r|\n/).length;
52
+
53
+ const stripLikeC4Comments = (content: string) => content.replace(/\/\*[\s\S]*?\*\//g, '').replace(/(^|[^:])\/\/.*$/gm, '$1');
54
+
55
+ const parseLikeC4Views = (content: string, filePath: string): LikeC4View[] => {
56
+ const contentWithoutComments = stripLikeC4Comments(content);
57
+ const viewDeclarationPattern =
58
+ /\b(?:(dynamic|deployment)\s+)?view(?:\s+([A-Za-z_][\w.-]*))?(?:\s+of\s+[A-Za-z_][\w.-]*(?:\.[A-Za-z_][\w.-]*)*)?\s*\{/g;
59
+ const views: LikeC4View[] = [];
60
+ let match: RegExpExecArray | null;
61
+
62
+ while ((match = viewDeclarationPattern.exec(contentWithoutComments)) !== null) {
63
+ const [, kind, id] = match;
64
+
65
+ if (!id) {
66
+ continue;
67
+ }
68
+
69
+ views.push({
70
+ id,
71
+ kind: kind === 'dynamic' || kind === 'deployment' ? kind : 'element',
72
+ filePath,
73
+ line: lineNumberAtIndex(contentWithoutComments, match.index),
74
+ });
75
+ }
76
+
77
+ return views;
78
+ };
79
+
80
+ const discoverLikeC4Sources = async (projectRoot: string): Promise<LikeC4SourceFile[]> => {
81
+ const sourceFiles = await glob(LIKEC4_SOURCE_PATTERN, {
82
+ cwd: projectRoot,
83
+ ignore: ['**/node_modules/**'],
84
+ nodir: true,
85
+ });
86
+
87
+ return sourceFiles
88
+ .map(toPosixPath)
89
+ .sort()
90
+ .map((sourceFile) => {
91
+ const content = fs.readFileSync(path.join(projectRoot, sourceFile), 'utf-8');
92
+ return {
93
+ path: sourceFile,
94
+ content,
95
+ views: parseLikeC4Views(content, sourceFile),
96
+ };
97
+ });
98
+ };
32
99
 
33
100
  // ============================================
34
101
  // Pagination utilities
@@ -105,6 +172,7 @@ export function paginate<T>(
105
172
  export const collectionSchema = z.enum([
106
173
  'events',
107
174
  'agents',
175
+ 'adrs',
108
176
  'services',
109
177
  'commands',
110
178
  'queries',
@@ -122,6 +190,7 @@ export const messageCollectionSchema = z.enum(['events', 'commands', 'queries'])
122
190
  export const resourceCollectionSchema = z.enum([
123
191
  'agents',
124
192
  'services',
193
+ 'adrs',
125
194
  'events',
126
195
  'commands',
127
196
  'queries',
@@ -276,6 +345,9 @@ export async function findResourcesByOwner(params: { ownerId: string }) {
276
345
  'flows',
277
346
  'channels',
278
347
  'entities',
348
+ 'adrs',
349
+ 'containers',
350
+ 'diagrams',
279
351
  'data-products',
280
352
  ] as const;
281
353
 
@@ -345,6 +417,46 @@ export async function getProducersOfMessage(params: { messageId: string; message
345
417
  };
346
418
  }
347
419
 
420
+ export async function getC4Diagram(params: { viewId?: string }) {
421
+ const projectRoot = process.env.PROJECT_DIR || process.cwd();
422
+ const sources = await discoverLikeC4Sources(projectRoot);
423
+ const availableViews = sources.flatMap((source) => source.views);
424
+
425
+ if (sources.length === 0) {
426
+ return {
427
+ message: 'No LikeC4 source files found in this EventCatalog project',
428
+ sources: [],
429
+ totalSourceFiles: 0,
430
+ totalViews: 0,
431
+ };
432
+ }
433
+
434
+ if (!params.viewId) {
435
+ return {
436
+ message: 'LikeC4 source files found',
437
+ sources,
438
+ totalSourceFiles: sources.length,
439
+ totalViews: availableViews.length,
440
+ };
441
+ }
442
+
443
+ const matchingViews = availableViews.filter((view) => view.id === params.viewId);
444
+
445
+ if (matchingViews.length === 0) {
446
+ return {
447
+ error: `LikeC4 view not found: ${params.viewId}`,
448
+ availableViews,
449
+ };
450
+ }
451
+
452
+ return {
453
+ viewId: params.viewId,
454
+ matchingViews,
455
+ sources,
456
+ totalSourceFiles: sources.length,
457
+ };
458
+ }
459
+
348
460
  /**
349
461
  * Get resources that consume (receive) a specific message
350
462
  */
@@ -992,6 +1104,8 @@ export const toolDescriptions = {
992
1104
  'Use this tool to find which agents or services produce (send) a specific message (event, command, or query)',
993
1105
  getConsumersOfMessage:
994
1106
  'Use this tool to find which agents or services consume (receive) a specific message (event, command, or query)',
1107
+ getC4Diagram:
1108
+ 'Use this tool to get the C4 diagram (or likeC4) in EventCatalog. These files usually have a .c4 extension on them',
995
1109
  analyzeChangeImpact:
996
1110
  'Use this tool to analyze the impact of changing a message. Returns all affected agents and services (producers and consumers), the teams that own them, and the blast radius of the change',
997
1111
  explainBusinessFlow:
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  },
8
8
  "license": "SEE LICENSE IN LICENSE",
9
9
  "type": "module",
10
- "version": "3.47.4",
10
+ "version": "3.48.0",
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
@@ -112,8 +112,8 @@
112
112
  "uuid": "^10.0.0",
113
113
  "zod": "^4.3.6",
114
114
  "@eventcatalog/linter": "1.1.0",
115
- "@eventcatalog/sdk": "2.24.1",
116
- "@eventcatalog/visualiser": "^3.22.1"
115
+ "@eventcatalog/visualiser": "^3.22.1",
116
+ "@eventcatalog/sdk": "2.24.1"
117
117
  },
118
118
  "devDependencies": {
119
119
  "@astrojs/check": "^0.9.9",