@eventcatalog/core 3.32.2 → 3.33.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-JTPCTZLV.js → chunk-DN6F4AAQ.js} +1 -1
- package/dist/{chunk-MR3R4KPQ.js → chunk-GBSBBBF5.js} +1 -1
- package/dist/{chunk-CBKYKCNH.js → chunk-TDRDRXOZ.js} +1 -1
- package/dist/{chunk-APXR6OUM.js → chunk-VRXBFCYB.js} +1 -1
- package/dist/{chunk-U54R4QAA.js → chunk-YKTTWB2P.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 +8 -8
- 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/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 +3 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log_build_default
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-GBSBBBF5.js";
|
|
4
|
+
import "../chunk-TDRDRXOZ.js";
|
|
5
5
|
import "../chunk-4UVFXLPI.js";
|
|
6
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-YKTTWB2P.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.33.0";
|
|
118
118
|
|
|
119
119
|
// src/constants.ts
|
|
120
120
|
var VERSION = version;
|
package/dist/eventcatalog.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
log_build_default
|
|
3
|
+
} from "./chunk-GBSBBBF5.js";
|
|
1
4
|
import {
|
|
2
5
|
resolve_catalog_dependencies_default
|
|
3
6
|
} from "./chunk-WAJIJEI3.js";
|
|
4
7
|
import {
|
|
5
8
|
watch
|
|
6
9
|
} from "./chunk-K3ZVEX2Y.js";
|
|
7
|
-
import {
|
|
8
|
-
log_build_default
|
|
9
|
-
} from "./chunk-MR3R4KPQ.js";
|
|
10
|
-
import "./chunk-CBKYKCNH.js";
|
|
11
|
-
import "./chunk-4UVFXLPI.js";
|
|
12
10
|
import {
|
|
13
11
|
runMigrations
|
|
14
12
|
} from "./chunk-XUAF2H54.js";
|
|
15
13
|
import "./chunk-CA4U2JP7.js";
|
|
14
|
+
import "./chunk-TDRDRXOZ.js";
|
|
15
|
+
import "./chunk-4UVFXLPI.js";
|
|
16
16
|
import {
|
|
17
17
|
catalogToAstro
|
|
18
18
|
} from "./chunk-YDXB3BD2.js";
|
|
@@ -22,13 +22,13 @@ import {
|
|
|
22
22
|
} from "./chunk-3KXCGYET.js";
|
|
23
23
|
import {
|
|
24
24
|
generate
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-VRXBFCYB.js";
|
|
26
26
|
import {
|
|
27
27
|
logger
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-DN6F4AAQ.js";
|
|
29
29
|
import {
|
|
30
30
|
VERSION
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-YKTTWB2P.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-VRXBFCYB.js";
|
|
4
|
+
import "./chunk-DN6F4AAQ.js";
|
|
5
|
+
import "./chunk-YKTTWB2P.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
|
|
|
@@ -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.33.0",
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
@@ -105,9 +105,9 @@
|
|
|
105
105
|
"update-notifier": "^7.3.1",
|
|
106
106
|
"uuid": "^10.0.0",
|
|
107
107
|
"zod": "^4.3.6",
|
|
108
|
+
"@eventcatalog/linter": "1.0.22",
|
|
108
109
|
"@eventcatalog/sdk": "2.21.0",
|
|
109
|
-
"@eventcatalog/visualiser": "^3.20.0"
|
|
110
|
-
"@eventcatalog/linter": "1.0.22"
|
|
110
|
+
"@eventcatalog/visualiser": "^3.20.0"
|
|
111
111
|
},
|
|
112
112
|
"devDependencies": {
|
|
113
113
|
"@astrojs/check": "^0.9.8",
|