@eventcatalog/core 3.32.2 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/analytics/analytics.cjs +1 -1
- package/dist/analytics/analytics.js +2 -2
- package/dist/analytics/log-build.cjs +1 -1
- package/dist/analytics/log-build.js +3 -3
- package/dist/{chunk-U54R4QAA.js → chunk-623CFR4T.js} +1 -1
- package/dist/{chunk-MR3R4KPQ.js → chunk-BJWMR3ZH.js} +1 -1
- package/dist/{chunk-CBKYKCNH.js → chunk-IO6EMN5C.js} +1 -1
- package/dist/{chunk-JTPCTZLV.js → chunk-K5AM6PPU.js} +1 -1
- package/dist/{chunk-APXR6OUM.js → chunk-PP7EDIPX.js} +1 -1
- package/dist/constants.cjs +1 -1
- package/dist/constants.js +1 -1
- package/dist/eventcatalog.cjs +1 -1
- package/dist/eventcatalog.js +5 -5
- package/dist/generate.cjs +1 -1
- package/dist/generate.js +3 -3
- package/dist/utils/cli-logger.cjs +1 -1
- package/dist/utils/cli-logger.js +2 -2
- package/eventcatalog/src/components/MDX/Visibility.tsx +12 -0
- package/eventcatalog/src/components/MDX/components.tsx +2 -0
- package/eventcatalog/src/enterprise/custom-documentation/pages/docs/custom/[...path].mdx.ts +7 -3
- package/eventcatalog/src/enterprise/custom-documentation/utils/custom-docs.ts +26 -8
- package/eventcatalog/src/pages/diagrams/[id]/[version].mdx.ts +3 -2
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].md.ts +2 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version]/[docType]/[docId].mdx.ts +2 -1
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].md.ts +22 -13
- package/eventcatalog/src/pages/docs/[type]/[id]/[version].mdx.ts +34 -24
- package/eventcatalog/src/pages/docs/[type]/[id]/language.mdx.ts +9 -2
- package/eventcatalog/src/pages/docs/llm/llms-full.txt.ts +2 -2
- package/eventcatalog/src/pages/docs/teams/[id].md.ts +4 -2
- package/eventcatalog/src/pages/docs/teams/[id].mdx.ts +4 -2
- package/eventcatalog/src/pages/docs/users/[id].md.ts +4 -2
- package/eventcatalog/src/pages/docs/users/[id].mdx.ts +4 -2
- package/eventcatalog/src/utils/llms.ts +22 -0
- package/package.json +12 -12
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-BJWMR3ZH.js";
|
|
4
|
+
import "../chunk-IO6EMN5C.js";
|
|
5
5
|
import "../chunk-4UVFXLPI.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-623CFR4T.js";
|
|
7
7
|
import "../chunk-5T63CXKU.js";
|
|
8
8
|
export {
|
|
9
9
|
log_build_default as default
|
package/dist/constants.cjs
CHANGED
package/dist/constants.js
CHANGED
package/dist/eventcatalog.cjs
CHANGED
|
@@ -114,7 +114,7 @@ var verifyRequiredFieldsAreInCatalogConfigFile = async (projectDirectory) => {
|
|
|
114
114
|
var import_picocolors = __toESM(require("picocolors"), 1);
|
|
115
115
|
|
|
116
116
|
// package.json
|
|
117
|
-
var version = "3.
|
|
117
|
+
var version = "3.34.0";
|
|
118
118
|
|
|
119
119
|
// src/constants.ts
|
|
120
120
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
} from "./chunk-K3ZVEX2Y.js";
|
|
7
7
|
import {
|
|
8
8
|
log_build_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-BJWMR3ZH.js";
|
|
10
|
+
import "./chunk-IO6EMN5C.js";
|
|
11
11
|
import "./chunk-4UVFXLPI.js";
|
|
12
12
|
import {
|
|
13
13
|
runMigrations
|
|
@@ -22,13 +22,13 @@ import {
|
|
|
22
22
|
} from "./chunk-3KXCGYET.js";
|
|
23
23
|
import {
|
|
24
24
|
generate
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-PP7EDIPX.js";
|
|
26
26
|
import {
|
|
27
27
|
logger
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-K5AM6PPU.js";
|
|
29
29
|
import {
|
|
30
30
|
VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-623CFR4T.js";
|
|
32
32
|
import {
|
|
33
33
|
getEventCatalogConfigFile,
|
|
34
34
|
verifyRequiredFieldsAreInCatalogConfigFile
|
package/dist/generate.cjs
CHANGED
package/dist/generate.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generate
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-PP7EDIPX.js";
|
|
4
|
+
import "./chunk-K5AM6PPU.js";
|
|
5
|
+
import "./chunk-623CFR4T.js";
|
|
6
6
|
import "./chunk-5T63CXKU.js";
|
|
7
7
|
export {
|
|
8
8
|
generate
|
package/dist/utils/cli-logger.js
CHANGED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
type VisibilityProps = {
|
|
2
|
+
for: 'agents' | 'humans';
|
|
3
|
+
children?: any;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const Visibility = ({ for: audience, children }: VisibilityProps) => {
|
|
7
|
+
if (audience !== 'humans') return null;
|
|
8
|
+
|
|
9
|
+
return <>{children}</>;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default Visibility;
|
|
@@ -35,6 +35,7 @@ import NodeGraphPortal from '@components/MDX/NodeGraph/NodeGraphPortal';
|
|
|
35
35
|
import SchemaViewerPortal from '@components/MDX/SchemaViewer/SchemaViewerPortal';
|
|
36
36
|
import { jsx } from 'astro/jsx-runtime';
|
|
37
37
|
import RemoteSchema from '@components/MDX/RemoteSchema.astro';
|
|
38
|
+
import Visibility from '@components/MDX/Visibility';
|
|
38
39
|
|
|
39
40
|
const components = (props: any) => {
|
|
40
41
|
return {
|
|
@@ -66,6 +67,7 @@ const components = (props: any) => {
|
|
|
66
67
|
Tabs,
|
|
67
68
|
Tile,
|
|
68
69
|
Tiles,
|
|
70
|
+
Visibility,
|
|
69
71
|
Miro: (mdxProp: any) => jsx(Miro, { ...props, ...mdxProp }),
|
|
70
72
|
Lucid: (mdxProp: any) => jsx(Lucid, { ...props, ...mdxProp }),
|
|
71
73
|
DrawIO: (mdxProp: any) => jsx(DrawIO, { ...props, ...mdxProp }),
|
|
@@ -6,9 +6,11 @@ import type { APIRoute, GetStaticPaths } from 'astro';
|
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
7
|
import fs from 'fs';
|
|
8
8
|
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
9
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
10
|
+
|
|
11
|
+
const docs = await getCollection('customPages');
|
|
9
12
|
|
|
10
13
|
export const getStaticPaths = (async () => {
|
|
11
|
-
const docs = await getCollection('customPages');
|
|
12
14
|
const paths = docs.map((doc) => ({
|
|
13
15
|
params: { path: doc.id.replace('docs/', '') },
|
|
14
16
|
props: doc,
|
|
@@ -23,8 +25,10 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
23
25
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
24
26
|
}
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
const docPath = Array.isArray(params.path) ? params.path.join('/') : params.path;
|
|
29
|
+
const content = props?.filePath ? props : docs.find((doc) => doc.id.replace('docs/', '') === docPath);
|
|
30
|
+
if (content?.filePath) {
|
|
31
|
+
const file = filterMarkdownForAgents(fs.readFileSync(content.filePath, 'utf8'));
|
|
28
32
|
return new Response(file, { status: 200 });
|
|
29
33
|
}
|
|
30
34
|
|
|
@@ -6,9 +6,20 @@
|
|
|
6
6
|
import config from '@config';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
|
-
import {
|
|
9
|
+
import { getCollection } from 'astro:content';
|
|
10
10
|
import matter from 'gray-matter';
|
|
11
11
|
|
|
12
|
+
// Use getCollection (which returns plain entries) instead of getEntry, which installs
|
|
13
|
+
// Astro's `slug` deprecation accessor on every entry it returns. The accessor fires a
|
|
14
|
+
// `console.error` on each access of `entry.data.slug`, even though our schema legitimately
|
|
15
|
+
// defines `slug` as an optional user field. See packages/core/eventcatalog/src/enterprise/collections/custom-pages.ts.
|
|
16
|
+
const getCustomPagesById = async () => {
|
|
17
|
+
const all = await getCollection('customPages');
|
|
18
|
+
const map = new Map<string, (typeof all)[number]>();
|
|
19
|
+
for (const e of all) map.set(e.id, e);
|
|
20
|
+
return map;
|
|
21
|
+
};
|
|
22
|
+
|
|
12
23
|
type Badge = {
|
|
13
24
|
text: string;
|
|
14
25
|
color: string;
|
|
@@ -55,12 +66,16 @@ const DOCS_DIR = 'docs';
|
|
|
55
66
|
* If an index.mdx or index.md file exists in the directory, it will be used as the
|
|
56
67
|
* folder's link target (making the folder clickable) and excluded from the items list.
|
|
57
68
|
*/
|
|
69
|
+
type CustomPagesMap = Awaited<ReturnType<typeof getCustomPagesById>>;
|
|
70
|
+
|
|
58
71
|
const processAutoGeneratedDirectory = async (
|
|
59
72
|
directory: string,
|
|
60
73
|
label: string,
|
|
61
74
|
badge?: Badge,
|
|
62
|
-
collapsed?: boolean
|
|
75
|
+
collapsed?: boolean,
|
|
76
|
+
customPages?: CustomPagesMap
|
|
63
77
|
): Promise<SidebarItem> => {
|
|
78
|
+
customPages ??= await getCustomPagesById();
|
|
64
79
|
// @ts-ignore
|
|
65
80
|
const items = fs.readdirSync(path.join(process.env.PROJECT_DIR || '', DOCS_DIR, directory));
|
|
66
81
|
|
|
@@ -78,7 +93,7 @@ const processAutoGeneratedDirectory = async (
|
|
|
78
93
|
// Normalize path separators for cross-platform compatibility
|
|
79
94
|
// Note: Astro's glob loader strips '/index' from the ID, so docs/foo/index.mdx becomes docs/foo
|
|
80
95
|
const astroId = data.slug || path.join(DOCS_DIR, directory).replace(/\\/g, '/');
|
|
81
|
-
const entry =
|
|
96
|
+
const entry = customPages.get(astroId.toLowerCase());
|
|
82
97
|
|
|
83
98
|
if (entry) {
|
|
84
99
|
// Use the index file's slug as the folder's link target
|
|
@@ -101,7 +116,8 @@ const processAutoGeneratedDirectory = async (
|
|
|
101
116
|
path.join(directory, item),
|
|
102
117
|
item, // Use directory name as label
|
|
103
118
|
undefined, // No badge for subdirectories
|
|
104
|
-
collapsed // Inherit collapsed state
|
|
119
|
+
collapsed, // Inherit collapsed state
|
|
120
|
+
customPages
|
|
105
121
|
);
|
|
106
122
|
// Only add the directory if it contains valid items (mdx/md files) or has a slug (index file)
|
|
107
123
|
if ((subdirResult.items && subdirResult.items.length > 0) || subdirResult.slug) {
|
|
@@ -115,7 +131,7 @@ const processAutoGeneratedDirectory = async (
|
|
|
115
131
|
// Normalize path separators to forward slashes for cross-platform compatibility (Windows uses backslashes)
|
|
116
132
|
const astroId =
|
|
117
133
|
data.slug || path.join(DOCS_DIR, directory, item).replace('.mdx', '').replace('.md', '').replace(/\\/g, '/');
|
|
118
|
-
const entry =
|
|
134
|
+
const entry = customPages.get(astroId.toLowerCase());
|
|
119
135
|
|
|
120
136
|
if (entry) {
|
|
121
137
|
allItems.push({
|
|
@@ -138,7 +154,8 @@ const processAutoGeneratedDirectory = async (
|
|
|
138
154
|
/**
|
|
139
155
|
* Recursively process sidebar items to handle auto-generated content at any nesting level
|
|
140
156
|
*/
|
|
141
|
-
const processSidebarItems = async (items: SideBarConfigurationItem[]): Promise<SidebarItem[]> => {
|
|
157
|
+
const processSidebarItems = async (items: SideBarConfigurationItem[], customPages?: CustomPagesMap): Promise<SidebarItem[]> => {
|
|
158
|
+
customPages ??= await getCustomPagesById();
|
|
142
159
|
const processedItems: SidebarItem[] = [];
|
|
143
160
|
|
|
144
161
|
for (const item of items) {
|
|
@@ -148,13 +165,14 @@ const processSidebarItems = async (items: SideBarConfigurationItem[]): Promise<S
|
|
|
148
165
|
item.autogenerated.directory,
|
|
149
166
|
item.label,
|
|
150
167
|
item.badge,
|
|
151
|
-
item.autogenerated.collapsed !== undefined ? item.autogenerated.collapsed : item.collapsed
|
|
168
|
+
item.autogenerated.collapsed !== undefined ? item.autogenerated.collapsed : item.collapsed,
|
|
169
|
+
customPages
|
|
152
170
|
);
|
|
153
171
|
processedItems.push(processedItem);
|
|
154
172
|
}
|
|
155
173
|
// If item has nested items, process them recursively
|
|
156
174
|
else if (item.items && item.items.length > 0) {
|
|
157
|
-
const processedNestedItems = await processSidebarItems(item.items);
|
|
175
|
+
const processedNestedItems = await processSidebarItems(item.items, customPages);
|
|
158
176
|
processedItems.push({
|
|
159
177
|
label: item.label,
|
|
160
178
|
slug: item.slug,
|
|
@@ -7,6 +7,7 @@ import type { APIRoute } from 'astro';
|
|
|
7
7
|
import { getCollection } from 'astro:content';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import { isLLMSTxtEnabled, isSSR } from '@utils/feature';
|
|
10
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
10
11
|
|
|
11
12
|
const diagrams = await getCollection('diagrams');
|
|
12
13
|
|
|
@@ -34,11 +35,11 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
34
35
|
if (!diagram?.filePath) {
|
|
35
36
|
return new Response('Not found', { status: 404 });
|
|
36
37
|
}
|
|
37
|
-
const file = fs.readFileSync(diagram.filePath, 'utf8');
|
|
38
|
+
const file = filterMarkdownForAgents(fs.readFileSync(diagram.filePath, 'utf8'));
|
|
38
39
|
return new Response(file, { status: 200 });
|
|
39
40
|
} else {
|
|
40
41
|
if (props?.content?.filePath) {
|
|
41
|
-
const file = fs.readFileSync(props.content.filePath, 'utf8');
|
|
42
|
+
const file = filterMarkdownForAgents(fs.readFileSync(props.content.filePath, 'utf8'));
|
|
42
43
|
return new Response(file, { status: 200 });
|
|
43
44
|
}
|
|
44
45
|
}
|
|
@@ -6,6 +6,7 @@ import type { APIRoute } from 'astro';
|
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import { isLLMSTxtEnabled, isResourceDocsEnabled, isSSR } from '@utils/feature';
|
|
8
8
|
import { getResourceDocs, getResourceDocsForResource, type ResourceCollection } from '@utils/collections/resource-docs';
|
|
9
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
9
10
|
|
|
10
11
|
const supportedResourceCollections = new Set<ResourceCollection>([
|
|
11
12
|
'domains',
|
|
@@ -70,6 +71,6 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
70
71
|
return new Response('Not found', { status: 404 });
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
const file = fs.readFileSync(filePath, 'utf8');
|
|
74
|
+
const file = filterMarkdownForAgents(fs.readFileSync(filePath, 'utf8'));
|
|
74
75
|
return new Response(file, { status: 200, headers: { 'Content-Type': 'text/markdown; charset=utf-8' } });
|
|
75
76
|
};
|
|
@@ -6,6 +6,7 @@ import type { APIRoute } from 'astro';
|
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import { isLLMSTxtEnabled, isResourceDocsEnabled, isSSR } from '@utils/feature';
|
|
8
8
|
import { getResourceDocs, getResourceDocsForResource, type ResourceCollection } from '@utils/collections/resource-docs';
|
|
9
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
9
10
|
|
|
10
11
|
const supportedResourceCollections = new Set<ResourceCollection>([
|
|
11
12
|
'domains',
|
|
@@ -70,6 +71,6 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
70
71
|
return new Response('Not found', { status: 404 });
|
|
71
72
|
}
|
|
72
73
|
|
|
73
|
-
const file = fs.readFileSync(filePath, 'utf8');
|
|
74
|
+
const file = filterMarkdownForAgents(fs.readFileSync(filePath, 'utf8'));
|
|
74
75
|
return new Response(file, { status: 200, headers: { 'Content-Type': 'text/markdown; charset=utf-8' } });
|
|
75
76
|
};
|
|
@@ -8,6 +8,7 @@ import { getEntities } from '@utils/collections/entities';
|
|
|
8
8
|
import config from '@config';
|
|
9
9
|
import fs from 'fs';
|
|
10
10
|
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
11
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
11
12
|
|
|
12
13
|
const events = await getCollection('events');
|
|
13
14
|
const commands = await getCollection('commands');
|
|
@@ -18,23 +19,30 @@ const flows = await getCollection('flows');
|
|
|
18
19
|
const channels = await getCollection('channels');
|
|
19
20
|
const containers = await getCollection('containers');
|
|
20
21
|
const entities = await getEntities();
|
|
22
|
+
|
|
23
|
+
const collections = {
|
|
24
|
+
events,
|
|
25
|
+
commands,
|
|
26
|
+
queries,
|
|
27
|
+
services,
|
|
28
|
+
domains,
|
|
29
|
+
flows,
|
|
30
|
+
channels,
|
|
31
|
+
containers,
|
|
32
|
+
entities,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const findContent = (params: Record<string, string | undefined>) => {
|
|
36
|
+
const collection = collections[params.type as keyof typeof collections];
|
|
37
|
+
return collection?.find((item: any) => item.data.id === params.id && item.data.version === params.version);
|
|
38
|
+
};
|
|
39
|
+
|
|
21
40
|
export async function getStaticPaths() {
|
|
22
41
|
// Just return empty array if LLMs are not enabled
|
|
23
42
|
if (!isLLMSTxtEnabled()) {
|
|
24
43
|
return [];
|
|
25
44
|
}
|
|
26
45
|
|
|
27
|
-
const collections = {
|
|
28
|
-
events,
|
|
29
|
-
commands,
|
|
30
|
-
queries,
|
|
31
|
-
services,
|
|
32
|
-
domains,
|
|
33
|
-
flows,
|
|
34
|
-
channels,
|
|
35
|
-
containers,
|
|
36
|
-
entities,
|
|
37
|
-
};
|
|
38
46
|
const paths = Object.keys(collections).map((type) => {
|
|
39
47
|
return collections[type as keyof typeof collections].map((item: { data: { id: string; version: string } }) => ({
|
|
40
48
|
params: { type, id: item.data.id, version: item.data.version },
|
|
@@ -51,8 +59,9 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
51
59
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
52
60
|
}
|
|
53
61
|
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
const content = props?.content ?? findContent(params);
|
|
63
|
+
if (content?.filePath) {
|
|
64
|
+
const file = filterMarkdownForAgents(fs.readFileSync(content.filePath, 'utf8'));
|
|
56
65
|
return new Response(file, { status: 200 });
|
|
57
66
|
}
|
|
58
67
|
|
|
@@ -6,7 +6,7 @@ import type { APIRoute } from 'astro';
|
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
7
|
import config from '@config';
|
|
8
8
|
import fs from 'fs';
|
|
9
|
-
import { addSchemaToMarkdown } from '@utils/llms';
|
|
9
|
+
import { addSchemaToMarkdown, filterMarkdownForAgents } from '@utils/llms';
|
|
10
10
|
import { isLLMSTxtEnabled, isSSR } from '@utils/feature';
|
|
11
11
|
const events = await getCollection('events');
|
|
12
12
|
const commands = await getCollection('commands');
|
|
@@ -15,25 +15,34 @@ const services = await getCollection('services');
|
|
|
15
15
|
const domains = await getCollection('domains');
|
|
16
16
|
const flows = await getCollection('flows');
|
|
17
17
|
const channels = await getCollection('channels');
|
|
18
|
+
const containers = await getCollection('containers');
|
|
18
19
|
const entities = await getCollection('entities');
|
|
19
20
|
|
|
20
21
|
import utils from '@eventcatalog/sdk';
|
|
21
22
|
|
|
23
|
+
const collections = {
|
|
24
|
+
events,
|
|
25
|
+
commands,
|
|
26
|
+
queries,
|
|
27
|
+
services,
|
|
28
|
+
domains,
|
|
29
|
+
flows,
|
|
30
|
+
channels,
|
|
31
|
+
containers,
|
|
32
|
+
entities,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const findContent = (params: Record<string, string | undefined>) => {
|
|
36
|
+
const collection = collections[params.type as keyof typeof collections];
|
|
37
|
+
return collection?.find((item) => item.data.id === params.id && item.data.version === params.version);
|
|
38
|
+
};
|
|
39
|
+
|
|
22
40
|
export async function getStaticPaths() {
|
|
23
41
|
// Just return empty array if LLMs are not enabled
|
|
24
42
|
if (!isLLMSTxtEnabled()) {
|
|
25
43
|
return [];
|
|
26
44
|
}
|
|
27
|
-
|
|
28
|
-
events,
|
|
29
|
-
commands,
|
|
30
|
-
queries,
|
|
31
|
-
services,
|
|
32
|
-
domains,
|
|
33
|
-
flows,
|
|
34
|
-
channels,
|
|
35
|
-
entities,
|
|
36
|
-
};
|
|
45
|
+
|
|
37
46
|
const paths = Object.keys(collections).map((type) => {
|
|
38
47
|
return collections[type as keyof typeof collections].map((item: { data: { id: string; version: string } }) => ({
|
|
39
48
|
params: { type, id: item.data.id, version: item.data.version },
|
|
@@ -50,26 +59,27 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
50
59
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
51
60
|
}
|
|
52
61
|
|
|
62
|
+
const content = props?.content ?? findContent(params);
|
|
63
|
+
if (content?.filePath) {
|
|
64
|
+
let file = fs.readFileSync(content.filePath, 'utf8');
|
|
65
|
+
|
|
66
|
+
try {
|
|
67
|
+
file = addSchemaToMarkdown(content, file);
|
|
68
|
+
} catch (error) {
|
|
69
|
+
console.log('Warning: Cant find the schema for', content.data.id, content.data.version);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return new Response(filterMarkdownForAgents(file), { status: 200 });
|
|
73
|
+
}
|
|
74
|
+
|
|
53
75
|
if (isSSR()) {
|
|
54
76
|
const { getResourcePath } = utils(process.env.PROJECT_DIR ?? '');
|
|
55
77
|
const filePath = await getResourcePath(process.env.PROJECT_DIR ?? '', params.id ?? '', params.version ?? '');
|
|
56
78
|
if (!filePath) {
|
|
57
79
|
return new Response('Not found', { status: 404 });
|
|
58
80
|
}
|
|
59
|
-
const file = fs.readFileSync(filePath.fullPath, 'utf8');
|
|
81
|
+
const file = filterMarkdownForAgents(fs.readFileSync(filePath.fullPath, 'utf8'));
|
|
60
82
|
return new Response(file, { status: 200 });
|
|
61
|
-
} else {
|
|
62
|
-
if (props?.content?.filePath) {
|
|
63
|
-
let file = fs.readFileSync(props.content.filePath, 'utf8');
|
|
64
|
-
|
|
65
|
-
try {
|
|
66
|
-
file = addSchemaToMarkdown(props.content, file);
|
|
67
|
-
} catch (error) {
|
|
68
|
-
console.log('Warning: Cant find the schema for', props.content.data.id, props.content.data.version);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
return new Response(file, { status: 200 });
|
|
72
|
-
}
|
|
73
83
|
}
|
|
74
84
|
|
|
75
85
|
return new Response('Not found', { status: 404 });
|
|
@@ -4,6 +4,7 @@ import type { APIRoute } from 'astro';
|
|
|
4
4
|
import config from '@config';
|
|
5
5
|
import fs from 'fs';
|
|
6
6
|
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
7
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
7
8
|
|
|
8
9
|
export async function getStaticPaths() {
|
|
9
10
|
const domains = await getDomains({ getAllVersions: false });
|
|
@@ -30,11 +31,17 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
30
31
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
const
|
|
34
|
+
const domains = await getDomains({ getAllVersions: false });
|
|
35
|
+
const domain = props?.data ? (props as CollectionEntry<'domains'>) : domains.find((item) => item.data.id === params.id);
|
|
36
|
+
if (!domain) {
|
|
37
|
+
return new Response('Not found', { status: 404 });
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const ubiquitousLanguages = await getUbiquitousLanguage(domain as CollectionEntry<'domains'>);
|
|
34
41
|
const ubiquitousLanguage = ubiquitousLanguages[0];
|
|
35
42
|
|
|
36
43
|
if (ubiquitousLanguage?.filePath) {
|
|
37
|
-
let file = fs.readFileSync(ubiquitousLanguage.filePath, 'utf8');
|
|
44
|
+
let file = filterMarkdownForAgents(fs.readFileSync(ubiquitousLanguage.filePath, 'utf8'));
|
|
38
45
|
|
|
39
46
|
return new Response(file, { status: 200 });
|
|
40
47
|
}
|
|
@@ -2,7 +2,7 @@ import { getCollection, type CollectionEntry } from 'astro:content';
|
|
|
2
2
|
import type { APIRoute } from 'astro';
|
|
3
3
|
import fs from 'fs';
|
|
4
4
|
import { isCustomDocsEnabled, isResourceDocsEnabled, isLLMSTxtEnabled } from '@utils/feature';
|
|
5
|
-
import { addSchemaToMarkdown } from '@utils/llms';
|
|
5
|
+
import { addSchemaToMarkdown, filterMarkdownForAgents } from '@utils/llms';
|
|
6
6
|
|
|
7
7
|
type AllowedCollections =
|
|
8
8
|
| 'events'
|
|
@@ -74,7 +74,7 @@ export const GET: APIRoute = async ({ params, request }) => {
|
|
|
74
74
|
// just skip the resource if it has no schema
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
-
return file;
|
|
77
|
+
return filterMarkdownForAgents(file);
|
|
78
78
|
})
|
|
79
79
|
.join('\n');
|
|
80
80
|
|
|
@@ -7,6 +7,7 @@ import { getCollection } from 'astro:content';
|
|
|
7
7
|
import config from '@config';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
10
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
10
11
|
|
|
11
12
|
const teams = await getCollection('teams');
|
|
12
13
|
|
|
@@ -28,8 +29,9 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
28
29
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const content = props?.content ?? teams.find((team) => team.data.id === params.id);
|
|
33
|
+
if (content?.filePath) {
|
|
34
|
+
const file = filterMarkdownForAgents(fs.readFileSync(content.filePath, 'utf8'));
|
|
33
35
|
return new Response(file, { status: 200 });
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -6,6 +6,7 @@ import type { APIRoute } from 'astro';
|
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
7
|
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
8
8
|
import fs from 'fs';
|
|
9
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
9
10
|
|
|
10
11
|
const teams = await getCollection('teams');
|
|
11
12
|
|
|
@@ -27,8 +28,9 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
27
28
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const content = props?.content ?? teams.find((team) => team.data.id === params.id);
|
|
32
|
+
if (content?.filePath) {
|
|
33
|
+
const file = filterMarkdownForAgents(fs.readFileSync(content.filePath, 'utf8'));
|
|
32
34
|
return new Response(file, { status: 200 });
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -7,6 +7,7 @@ import { getCollection } from 'astro:content';
|
|
|
7
7
|
import config from '@config';
|
|
8
8
|
import fs from 'fs';
|
|
9
9
|
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
10
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
10
11
|
|
|
11
12
|
const users = await getCollection('users');
|
|
12
13
|
|
|
@@ -28,8 +29,9 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
28
29
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
29
30
|
}
|
|
30
31
|
|
|
31
|
-
|
|
32
|
-
|
|
32
|
+
const content = props?.content ?? users.find((user) => user.data.id === params.id);
|
|
33
|
+
if (content?.filePath) {
|
|
34
|
+
const file = filterMarkdownForAgents(fs.readFileSync(content.filePath, 'utf8'));
|
|
33
35
|
return new Response(file, { status: 200 });
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -6,6 +6,7 @@ import type { APIRoute } from 'astro';
|
|
|
6
6
|
import { getCollection } from 'astro:content';
|
|
7
7
|
import { isLLMSTxtEnabled } from '@utils/feature';
|
|
8
8
|
import fs from 'fs';
|
|
9
|
+
import { filterMarkdownForAgents } from '@utils/llms';
|
|
9
10
|
|
|
10
11
|
const users = await getCollection('users');
|
|
11
12
|
|
|
@@ -27,8 +28,9 @@ export const GET: APIRoute = async ({ params, props }) => {
|
|
|
27
28
|
return new Response('llms.txt is not enabled for this Catalog.', { status: 404 });
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
31
|
+
const content = props?.content ?? users.find((user) => user.data.id === params.id);
|
|
32
|
+
if (content?.filePath) {
|
|
33
|
+
const file = filterMarkdownForAgents(fs.readFileSync(content.filePath, 'utf8'));
|
|
32
34
|
return new Response(file, { status: 200 });
|
|
33
35
|
}
|
|
34
36
|
|
|
@@ -33,3 +33,25 @@ export const addSchemaToMarkdown = (collection: CollectionEntry<CollectionTypes>
|
|
|
33
33
|
|
|
34
34
|
return file;
|
|
35
35
|
};
|
|
36
|
+
|
|
37
|
+
type VisibilityAudience = 'agents' | 'humans';
|
|
38
|
+
|
|
39
|
+
const visibilityPattern =
|
|
40
|
+
/(?:\r?\n){0,2}<Visibility\b(?=[^>]*\bfor=(?:"agents"|'agents'|{["']agents["']}|"humans"|'humans'|{["']humans["']}))[^>]*\bfor=(?:"(agents|humans)"|'(agents|humans)'|{["'](agents|humans)["']})[^>]*>\s*([\s\S]*?)\s*<\/Visibility>(?:\r?\n){0,2}/g;
|
|
41
|
+
|
|
42
|
+
export const filterMarkdownForAudience = (file: string, audience: VisibilityAudience) => {
|
|
43
|
+
visibilityPattern.lastIndex = 0;
|
|
44
|
+
if (!visibilityPattern.test(file)) {
|
|
45
|
+
return file;
|
|
46
|
+
}
|
|
47
|
+
visibilityPattern.lastIndex = 0;
|
|
48
|
+
|
|
49
|
+
return file
|
|
50
|
+
.replace(visibilityPattern, (_match, doubleQuoted, singleQuoted, expressionQuoted, content) => {
|
|
51
|
+
const visibilityAudience = doubleQuoted || singleQuoted || expressionQuoted;
|
|
52
|
+
return visibilityAudience === audience ? `\n\n${content.trim()}\n\n` : '\n\n';
|
|
53
|
+
})
|
|
54
|
+
.trim();
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const filterMarkdownForAgents = (file: string) => filterMarkdownForAudience(file, 'agents');
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
},
|
|
8
8
|
"license": "SEE LICENSE IN LICENSE",
|
|
9
9
|
"type": "module",
|
|
10
|
-
"version": "3.
|
|
10
|
+
"version": "3.34.0",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -22,10 +22,10 @@
|
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@ai-sdk/react": "^3.0.17",
|
|
25
|
-
"@astrojs/markdown-remark": "^7.
|
|
26
|
-
"@astrojs/mdx": "^5.0.
|
|
27
|
-
"@astrojs/node": "^10.0
|
|
28
|
-
"@astrojs/react": "^5.0.
|
|
25
|
+
"@astrojs/markdown-remark": "^7.1.1",
|
|
26
|
+
"@astrojs/mdx": "^5.0.4",
|
|
27
|
+
"@astrojs/node": "^10.1.0",
|
|
28
|
+
"@astrojs/react": "^5.0.4",
|
|
29
29
|
"@astrojs/rss": "^4.0.18",
|
|
30
30
|
"@asyncapi/avro-schema-parser": "3.0.24",
|
|
31
31
|
"@asyncapi/parser": "^3.6.0",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"@tanstack/react-table": "^8.17.3",
|
|
52
52
|
"@xyflow/react": "^12.3.6",
|
|
53
53
|
"ai": "^6.0.17",
|
|
54
|
-
"astro": "^6.
|
|
54
|
+
"astro": "^6.3.1",
|
|
55
55
|
"astro-compress": "^2.4.0",
|
|
56
56
|
"astro-expressive-code": "^0.41.7",
|
|
57
57
|
"astro-seo": "^0.8.4",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"elkjs": "^0.10.0",
|
|
69
69
|
"glob": "^13.0.6",
|
|
70
70
|
"gray-matter": "^4.0.3",
|
|
71
|
-
"hono": "4.12.
|
|
71
|
+
"hono": "4.12.16",
|
|
72
72
|
"html-to-image": "^1.11.11",
|
|
73
73
|
"js-yaml": "^4.1.1",
|
|
74
74
|
"jsonpath-plus": "^10.4.0",
|
|
@@ -106,11 +106,11 @@
|
|
|
106
106
|
"uuid": "^10.0.0",
|
|
107
107
|
"zod": "^4.3.6",
|
|
108
108
|
"@eventcatalog/sdk": "2.21.0",
|
|
109
|
-
"@eventcatalog/
|
|
110
|
-
"@eventcatalog/
|
|
109
|
+
"@eventcatalog/linter": "1.0.22",
|
|
110
|
+
"@eventcatalog/visualiser": "^3.20.0"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
|
-
"@astrojs/check": "^0.9.
|
|
113
|
+
"@astrojs/check": "^0.9.9",
|
|
114
114
|
"@types/dagre": "^0.7.52",
|
|
115
115
|
"@types/diff": "^5.2.2",
|
|
116
116
|
"@types/js-yaml": "^4.0.9",
|
|
@@ -119,8 +119,8 @@
|
|
|
119
119
|
"@types/lodash.merge": "4.6.9",
|
|
120
120
|
"@types/node": "^20.14.2",
|
|
121
121
|
"@types/pako": "^2.0.3",
|
|
122
|
-
"@types/react": "^
|
|
123
|
-
"@types/react-dom": "^
|
|
122
|
+
"@types/react": "^19.2.13",
|
|
123
|
+
"@types/react-dom": "^19.2.3",
|
|
124
124
|
"@types/react-syntax-highlighter": "^15.5.13",
|
|
125
125
|
"@types/semver": "^7.5.8",
|
|
126
126
|
"@types/shelljs": "^0.8.15",
|