@santi020k/lumen-mcp 0.1.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/LICENSE +21 -0
- package/README.md +216 -0
- package/bin/lumen-mcp-local.mjs +56 -0
- package/bin/lumen-mcp.mjs +8 -0
- package/data/lumen-data.json +21480 -0
- package/dist/data.d.ts +99 -0
- package/dist/data.d.ts.map +1 -0
- package/dist/data.js +11 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +215 -0
- package/dist/tools.d.ts +136 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +346 -0
- package/package.json +82 -0
package/dist/data.d.ts
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
export interface LumenComponentSnapshot {
|
|
2
|
+
apiReference: {
|
|
3
|
+
attribute: string;
|
|
4
|
+
defaultValue: string;
|
|
5
|
+
description: string;
|
|
6
|
+
values: string;
|
|
7
|
+
}[];
|
|
8
|
+
astroSource: string;
|
|
9
|
+
category: string;
|
|
10
|
+
collections: string[];
|
|
11
|
+
dependencies: string[];
|
|
12
|
+
description: string;
|
|
13
|
+
files: unknown[];
|
|
14
|
+
frameworkDetails: Record<LumenFramework, LumenFrameworkSnapshot>;
|
|
15
|
+
frameworks: {
|
|
16
|
+
astro: boolean;
|
|
17
|
+
elements: boolean;
|
|
18
|
+
react: boolean;
|
|
19
|
+
};
|
|
20
|
+
guidance: null | {
|
|
21
|
+
distinction?: string;
|
|
22
|
+
when: string;
|
|
23
|
+
};
|
|
24
|
+
kebab: string;
|
|
25
|
+
keyboardInteractions: {
|
|
26
|
+
action: string;
|
|
27
|
+
key: string;
|
|
28
|
+
}[];
|
|
29
|
+
keywords: string[];
|
|
30
|
+
name: string;
|
|
31
|
+
props: {
|
|
32
|
+
name: string;
|
|
33
|
+
optional: boolean;
|
|
34
|
+
type: string;
|
|
35
|
+
}[];
|
|
36
|
+
propsExtends: null | string;
|
|
37
|
+
recipes: {
|
|
38
|
+
name: string;
|
|
39
|
+
type: string;
|
|
40
|
+
}[];
|
|
41
|
+
runtimeEvents: {
|
|
42
|
+
detail: string;
|
|
43
|
+
name: string;
|
|
44
|
+
target: string;
|
|
45
|
+
when: string;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
export interface LumenData {
|
|
49
|
+
components: LumenComponentSnapshot[];
|
|
50
|
+
docs: {
|
|
51
|
+
aiUsage: string;
|
|
52
|
+
readme: string;
|
|
53
|
+
};
|
|
54
|
+
meta: {
|
|
55
|
+
componentCount: number;
|
|
56
|
+
packages: string[];
|
|
57
|
+
registryName: string;
|
|
58
|
+
registryVersion: number;
|
|
59
|
+
serverVersion: string;
|
|
60
|
+
};
|
|
61
|
+
recipes: LumenRecipeSnapshot[];
|
|
62
|
+
rules: string;
|
|
63
|
+
tokens: {
|
|
64
|
+
colors: Record<string, string>;
|
|
65
|
+
glass: Record<string, string>;
|
|
66
|
+
semantic: string[];
|
|
67
|
+
themeAttribute: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export type LumenFramework = 'astro' | 'elements' | 'react';
|
|
71
|
+
export interface LumenFrameworkSnapshot {
|
|
72
|
+
attributes?: string[];
|
|
73
|
+
available: boolean;
|
|
74
|
+
example: string;
|
|
75
|
+
importStatement: string;
|
|
76
|
+
language: 'astro' | 'html' | 'tsx';
|
|
77
|
+
packageName: string;
|
|
78
|
+
props: {
|
|
79
|
+
name: string;
|
|
80
|
+
optional: boolean;
|
|
81
|
+
type: string;
|
|
82
|
+
}[];
|
|
83
|
+
propsExtends: null | string;
|
|
84
|
+
registration?: string;
|
|
85
|
+
source: string;
|
|
86
|
+
styleImport: string;
|
|
87
|
+
tagName?: string;
|
|
88
|
+
}
|
|
89
|
+
export interface LumenRecipeSnapshot {
|
|
90
|
+
categories: string[];
|
|
91
|
+
components?: string[];
|
|
92
|
+
description: string;
|
|
93
|
+
files?: unknown[];
|
|
94
|
+
install: Record<LumenFramework, string>;
|
|
95
|
+
name: string;
|
|
96
|
+
type: string;
|
|
97
|
+
}
|
|
98
|
+
export declare const loadLumenData: () => LumenData;
|
|
99
|
+
//# sourceMappingURL=data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../src/data.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,sBAAsB;IACrC,YAAY,EAAE;QACZ,SAAS,EAAE,MAAM,CAAA;QACjB,YAAY,EAAE,MAAM,CAAA;QACpB,WAAW,EAAE,MAAM,CAAA;QACnB,MAAM,EAAE,MAAM,CAAA;KACf,EAAE,CAAA;IACH,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,EAAE,MAAM,CAAA;IAChB,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,YAAY,EAAE,MAAM,EAAE,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,OAAO,EAAE,CAAA;IAChB,gBAAgB,EAAE,MAAM,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAA;IAChE,UAAU,EAAE;QACV,KAAK,EAAE,OAAO,CAAA;QACd,QAAQ,EAAE,OAAO,CAAA;QACjB,KAAK,EAAE,OAAO,CAAA;KACf,CAAA;IACD,QAAQ,EAAE,IAAI,GAAG;QACf,WAAW,CAAC,EAAE,MAAM,CAAA;QACpB,IAAI,EAAE,MAAM,CAAA;KACb,CAAA;IACD,KAAK,EAAE,MAAM,CAAA;IACb,oBAAoB,EAAE;QACpB,MAAM,EAAE,MAAM,CAAA;QACd,GAAG,EAAE,MAAM,CAAA;KACZ,EAAE,CAAA;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,OAAO,CAAA;QACj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AK,CAAA;IAClC,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE;QACL,IAAI,EAAE,MAAM,CAAA;QACZ,QAAQ,EAAE,OAAO,CAAA;QACjB,IAAI,EAAE,MAAM,CAAA;KACb,EAAE,CAAA;IACH,YAAY,EAAE,IAAI,GAAG,MAAM,CAAA;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,EAAE,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,CAAC,EAAE,OAAO,EAAE,CAAA;IACjB,OAAO,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAAA;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAKD,eAAO,MAAM,aAAa,QAAO,SAQhC,CAAA"}
|
package/dist/data.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readFileSync as readFsFile } from 'node:fs';
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
const dataUrl = new URL('../data/lumen-data.json', import.meta.url);
|
|
4
|
+
let cached;
|
|
5
|
+
export const loadLumenData = () => {
|
|
6
|
+
if (cached)
|
|
7
|
+
return cached;
|
|
8
|
+
const raw = readFsFile(fileURLToPath(dataUrl), 'utf8');
|
|
9
|
+
cached = JSON.parse(raw);
|
|
10
|
+
return cached;
|
|
11
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { loadLumenData } from './data.js';
|
|
2
|
+
export type { LumenData } from './data.js';
|
|
3
|
+
export { createLumenServer } from './server.js';
|
|
4
|
+
export * from './tools.js';
|
|
5
|
+
/** Start the Lumen MCP server over stdio. Called by the `lumen-mcp` bin. */
|
|
6
|
+
export declare const startLumenMcp: () => Promise<void>;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAA;AACzC,YAAY,EAAE,SAAS,EAAE,MAAM,WAAW,CAAA;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC/C,cAAc,YAAY,CAAA;AAE1B,4EAA4E;AAC5E,eAAO,MAAM,aAAa,QAAa,OAAO,CAAC,IAAI,CAKlD,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
2
|
+
import { createLumenServer } from './server.js';
|
|
3
|
+
export { loadLumenData } from './data.js';
|
|
4
|
+
export { createLumenServer } from './server.js';
|
|
5
|
+
export * from './tools.js';
|
|
6
|
+
/** Start the Lumen MCP server over stdio. Called by the `lumen-mcp` bin. */
|
|
7
|
+
export const startLumenMcp = async () => {
|
|
8
|
+
const server = createLumenServer();
|
|
9
|
+
const transport = new StdioServerTransport();
|
|
10
|
+
await server.connect(transport);
|
|
11
|
+
};
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAoB,MAAM,yCAAyC,CAAA;AAmGrF,eAAO,MAAM,iBAAiB,QAAO,SAwNpC,CAAA"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { McpServer, ResourceTemplate } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import * as z from 'zod';
|
|
3
|
+
import { loadLumenData } from './data.js';
|
|
4
|
+
import { getComponent, getRecipe, getRules, getTokens, listComponents, search } from './tools.js';
|
|
5
|
+
const readOnlyAnnotations = {
|
|
6
|
+
idempotentHint: true,
|
|
7
|
+
openWorldHint: false,
|
|
8
|
+
readOnlyHint: true
|
|
9
|
+
};
|
|
10
|
+
const componentSummarySchema = z.strictObject({
|
|
11
|
+
category: z.string().trim(),
|
|
12
|
+
collections: z.array(z.string().trim()),
|
|
13
|
+
description: z.string().trim(),
|
|
14
|
+
frameworks: z.array(z.enum(['astro', 'elements', 'react'])),
|
|
15
|
+
kebab: z.string().trim(),
|
|
16
|
+
name: z.string().trim(),
|
|
17
|
+
recipes: z.array(z.string().trim())
|
|
18
|
+
});
|
|
19
|
+
const listComponentsOutputSchema = z.strictObject({
|
|
20
|
+
components: z.array(componentSummarySchema),
|
|
21
|
+
count: z.int().min(0)
|
|
22
|
+
});
|
|
23
|
+
const componentOutputSchema = z.strictObject({
|
|
24
|
+
component: z.record(z.string(), z.unknown()).optional(),
|
|
25
|
+
found: z.boolean(),
|
|
26
|
+
message: z.string().trim().optional()
|
|
27
|
+
});
|
|
28
|
+
const recipeOutputSchema = z.strictObject({
|
|
29
|
+
found: z.boolean(),
|
|
30
|
+
message: z.string().trim().optional(),
|
|
31
|
+
recipe: z.record(z.string(), z.unknown()).optional()
|
|
32
|
+
});
|
|
33
|
+
const searchResultSchema = z.strictObject({
|
|
34
|
+
category: z.string().trim().optional(),
|
|
35
|
+
description: z.string().trim(),
|
|
36
|
+
frameworks: z.array(z.enum(['astro', 'elements', 'react'])).optional(),
|
|
37
|
+
kind: z.enum(['component', 'recipe', 'rule', 'token']),
|
|
38
|
+
matchedTerms: z.array(z.string().trim()),
|
|
39
|
+
name: z.string().trim(),
|
|
40
|
+
score: z.number()
|
|
41
|
+
});
|
|
42
|
+
const searchOutputSchema = z.strictObject({
|
|
43
|
+
query: z.string().trim(),
|
|
44
|
+
results: z.array(searchResultSchema),
|
|
45
|
+
total: z.int().min(0)
|
|
46
|
+
});
|
|
47
|
+
const tokensOutputSchema = z.strictObject({
|
|
48
|
+
tokens: z.strictObject({
|
|
49
|
+
colors: z.record(z.string(), z.string().trim()),
|
|
50
|
+
glass: z.record(z.string(), z.string().trim()),
|
|
51
|
+
semantic: z.array(z.string().trim()),
|
|
52
|
+
themeAttribute: z.string().trim()
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
const rulesOutputSchema = z.strictObject({
|
|
56
|
+
rules: z.string().trim()
|
|
57
|
+
});
|
|
58
|
+
const structuredData = (data) => typeof data === 'object' && data !== null
|
|
59
|
+
? data
|
|
60
|
+
: { value: data };
|
|
61
|
+
const toMcpResult = (result) => ({
|
|
62
|
+
content: [{ text: result.text, type: 'text' }],
|
|
63
|
+
isError: result.isError ?? false,
|
|
64
|
+
structuredContent: structuredData(result.data)
|
|
65
|
+
});
|
|
66
|
+
const jsonResource = (uri, data, mimeType = 'application/json') => ({
|
|
67
|
+
contents: [{
|
|
68
|
+
mimeType,
|
|
69
|
+
text: JSON.stringify(data, null, 2),
|
|
70
|
+
uri: uri.href
|
|
71
|
+
}]
|
|
72
|
+
});
|
|
73
|
+
export const createLumenServer = () => {
|
|
74
|
+
const data = loadLumenData();
|
|
75
|
+
const server = new McpServer({ name: '@santi020k/lumen-mcp', version: data.meta.serverVersion }, {
|
|
76
|
+
instructions: 'Read lumen://rules before generating Lumen code. Search or list the catalog, then inspect ' +
|
|
77
|
+
'the selected component for the target framework at usage detail before requesting source.'
|
|
78
|
+
});
|
|
79
|
+
server.registerTool('lumen_list_components', {
|
|
80
|
+
annotations: readOnlyAnnotations,
|
|
81
|
+
description: 'List Lumen components with descriptions, categories, framework availability, collections, ' +
|
|
82
|
+
'and recipes. Filter by framework, recipe, or a natural-language query.',
|
|
83
|
+
inputSchema: z.strictObject({
|
|
84
|
+
framework: z.enum(['astro', 'react', 'elements'])
|
|
85
|
+
.optional()
|
|
86
|
+
.meta({ description: 'Only list components available for this framework.' }),
|
|
87
|
+
query: z.string().trim().min(1)
|
|
88
|
+
.optional()
|
|
89
|
+
.meta({ description: 'Natural-language component or use-case query.' }),
|
|
90
|
+
recipe: z.string().trim().min(1)
|
|
91
|
+
.optional()
|
|
92
|
+
.meta({ description: 'Only list components that belong to this recipe.' })
|
|
93
|
+
}),
|
|
94
|
+
outputSchema: listComponentsOutputSchema
|
|
95
|
+
}, (args) => toMcpResult(listComponents(args)));
|
|
96
|
+
server.registerTool('lumen_get_component', {
|
|
97
|
+
annotations: readOnlyAnnotations,
|
|
98
|
+
description: 'Get framework-specific Lumen component usage: description, imports, styles, typed props or ' +
|
|
99
|
+
'attributes, examples, guidance, accessibility, events, and optional reference source.',
|
|
100
|
+
inputSchema: z.strictObject({
|
|
101
|
+
detail: z.enum(['summary', 'usage', 'source'])
|
|
102
|
+
.default('usage')
|
|
103
|
+
.meta({
|
|
104
|
+
description: 'summary is compact; usage adds contracts and examples; source adds implementation.'
|
|
105
|
+
}),
|
|
106
|
+
framework: z.enum(['astro', 'react', 'elements'])
|
|
107
|
+
.default('astro')
|
|
108
|
+
.meta({ description: 'Framework contract to return.' }),
|
|
109
|
+
name: z.string().trim().min(1)
|
|
110
|
+
.meta({ description: 'Component name, for example "Button" or "data-table".' })
|
|
111
|
+
}),
|
|
112
|
+
outputSchema: componentOutputSchema
|
|
113
|
+
}, (args) => toMcpResult(getComponent(args)));
|
|
114
|
+
server.registerTool('lumen_get_recipe', {
|
|
115
|
+
annotations: readOnlyAnnotations,
|
|
116
|
+
description: 'Get a Lumen recipe or component set with its purpose, categories, components, files, and ' +
|
|
117
|
+
'framework-specific install command.',
|
|
118
|
+
inputSchema: z.strictObject({
|
|
119
|
+
framework: z.enum(['astro', 'react', 'elements'])
|
|
120
|
+
.default('astro')
|
|
121
|
+
.meta({ description: 'Framework used for the install command.' }),
|
|
122
|
+
name: z.string().trim().min(1)
|
|
123
|
+
.meta({ description: 'Recipe name, for example "scheduler" or "advanced-fields".' })
|
|
124
|
+
}),
|
|
125
|
+
outputSchema: recipeOutputSchema
|
|
126
|
+
}, (args) => toMcpResult(getRecipe(args)));
|
|
127
|
+
server.registerTool('lumen_search', {
|
|
128
|
+
annotations: readOnlyAnnotations,
|
|
129
|
+
description: 'Rank natural-language matches across descriptions, categories, curated collections, ' +
|
|
130
|
+
'framework contracts, props, attributes, recipes, tokens, and agent rules.',
|
|
131
|
+
inputSchema: z.strictObject({
|
|
132
|
+
limit: z.int().min(1).max(100)
|
|
133
|
+
.optional()
|
|
134
|
+
.meta({ description: 'Maximum results to return (1-100, default 20).' }),
|
|
135
|
+
query: z.string().trim().min(1)
|
|
136
|
+
.meta({ description: 'Keyword or natural-language use-case to search for.' })
|
|
137
|
+
}),
|
|
138
|
+
outputSchema: searchOutputSchema
|
|
139
|
+
}, (args) => toMcpResult(search(args)));
|
|
140
|
+
server.registerTool('lumen_get_tokens', {
|
|
141
|
+
annotations: readOnlyAnnotations,
|
|
142
|
+
description: 'Return structured Lumen semantic tokens, base color values, glass tokens, and theme attribute.',
|
|
143
|
+
inputSchema: z.strictObject({}),
|
|
144
|
+
outputSchema: tokensOutputSchema
|
|
145
|
+
}, () => toMcpResult(getTokens()));
|
|
146
|
+
server.registerTool('lumen_get_rules', {
|
|
147
|
+
annotations: readOnlyAnnotations,
|
|
148
|
+
description: 'Return the Lumen agent rules for generating, reviewing, or migrating apps that use Lumen.',
|
|
149
|
+
inputSchema: z.strictObject({}),
|
|
150
|
+
outputSchema: rulesOutputSchema
|
|
151
|
+
}, () => toMcpResult(getRules()));
|
|
152
|
+
server.registerResource('lumen-rules', 'lumen://rules', {
|
|
153
|
+
description: 'Lumen agent rules (llms.txt).',
|
|
154
|
+
mimeType: 'text/markdown'
|
|
155
|
+
}, (uri) => ({
|
|
156
|
+
contents: [{
|
|
157
|
+
mimeType: 'text/markdown',
|
|
158
|
+
text: getRules().text,
|
|
159
|
+
uri: uri.href
|
|
160
|
+
}]
|
|
161
|
+
}));
|
|
162
|
+
server.registerResource('lumen-tokens', 'lumen://tokens', {
|
|
163
|
+
description: 'Structured Lumen design tokens.',
|
|
164
|
+
mimeType: 'application/json'
|
|
165
|
+
}, (uri) => jsonResource(uri, getTokens().data));
|
|
166
|
+
server.registerResource('lumen-components', 'lumen://components', {
|
|
167
|
+
description: 'Compact structured component catalog.',
|
|
168
|
+
mimeType: 'application/json'
|
|
169
|
+
}, (uri) => jsonResource(uri, listComponents().data));
|
|
170
|
+
server.registerResource('lumen-component', new ResourceTemplate('lumen://components/{name}', {
|
|
171
|
+
complete: {
|
|
172
|
+
name: (value) => data.components
|
|
173
|
+
.map((component) => component.name)
|
|
174
|
+
.filter((name) => name.toLowerCase().includes(value.toLowerCase()))
|
|
175
|
+
.slice(0, 30)
|
|
176
|
+
},
|
|
177
|
+
list: () => ({
|
|
178
|
+
resources: data.components.map((component) => ({
|
|
179
|
+
description: component.description,
|
|
180
|
+
mimeType: 'application/json',
|
|
181
|
+
name: component.name,
|
|
182
|
+
uri: `lumen://components/${component.kebab}`
|
|
183
|
+
}))
|
|
184
|
+
})
|
|
185
|
+
}), {
|
|
186
|
+
description: 'Framework-neutral component metadata and default Astro usage.',
|
|
187
|
+
mimeType: 'application/json'
|
|
188
|
+
}, (uri, variables) => {
|
|
189
|
+
const name = String(variables.name);
|
|
190
|
+
const result = getComponent({ detail: 'usage', framework: 'astro', name });
|
|
191
|
+
return jsonResource(uri, result.data);
|
|
192
|
+
});
|
|
193
|
+
server.registerResource('lumen-recipe', new ResourceTemplate('lumen://recipes/{name}', {
|
|
194
|
+
complete: {
|
|
195
|
+
name: (value) => data.recipes
|
|
196
|
+
.map((recipe) => recipe.name)
|
|
197
|
+
.filter((name) => name.includes(value.toLowerCase()))
|
|
198
|
+
},
|
|
199
|
+
list: () => ({
|
|
200
|
+
resources: data.recipes.map((recipe) => ({
|
|
201
|
+
description: recipe.description,
|
|
202
|
+
mimeType: 'application/json',
|
|
203
|
+
name: recipe.name,
|
|
204
|
+
uri: `lumen://recipes/${recipe.name}`
|
|
205
|
+
}))
|
|
206
|
+
})
|
|
207
|
+
}), {
|
|
208
|
+
description: 'Lumen recipe metadata and install commands.',
|
|
209
|
+
mimeType: 'application/json'
|
|
210
|
+
}, (uri, variables) => {
|
|
211
|
+
const result = getRecipe({ name: String(variables.name) });
|
|
212
|
+
return jsonResource(uri, result.data);
|
|
213
|
+
});
|
|
214
|
+
return server;
|
|
215
|
+
};
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import type { LumenComponentSnapshot, LumenData, LumenFramework, LumenRecipeSnapshot } from './data.js';
|
|
2
|
+
export type ComponentDetailLevel = 'source' | 'summary' | 'usage';
|
|
3
|
+
export interface ComponentSummary {
|
|
4
|
+
category: string;
|
|
5
|
+
collections: string[];
|
|
6
|
+
description: string;
|
|
7
|
+
frameworks: LumenFramework[];
|
|
8
|
+
kebab: string;
|
|
9
|
+
name: string;
|
|
10
|
+
recipes: string[];
|
|
11
|
+
}
|
|
12
|
+
export type FrameworkFilter = LumenFramework;
|
|
13
|
+
export interface LumenToolResult<Data = unknown> {
|
|
14
|
+
data: Data;
|
|
15
|
+
isError?: boolean;
|
|
16
|
+
text: string;
|
|
17
|
+
}
|
|
18
|
+
export interface SearchResult {
|
|
19
|
+
category?: string;
|
|
20
|
+
description: string;
|
|
21
|
+
frameworks?: LumenFramework[];
|
|
22
|
+
kind: 'component' | 'recipe' | 'rule' | 'token';
|
|
23
|
+
matchedTerms: string[];
|
|
24
|
+
name: string;
|
|
25
|
+
score: number;
|
|
26
|
+
}
|
|
27
|
+
export declare const resolveComponent: (name: string, data?: LumenData) => LumenComponentSnapshot | undefined;
|
|
28
|
+
export declare const resolveRecipe: (name: string, data?: LumenData) => LumenRecipeSnapshot | undefined;
|
|
29
|
+
export declare const listComponents: (args?: {
|
|
30
|
+
framework?: FrameworkFilter | undefined;
|
|
31
|
+
query?: string | undefined;
|
|
32
|
+
recipe?: string | undefined;
|
|
33
|
+
}, data?: LumenData) => LumenToolResult<{
|
|
34
|
+
components: ComponentSummary[];
|
|
35
|
+
count: number;
|
|
36
|
+
}>;
|
|
37
|
+
declare const componentDetail: (component: LumenComponentSnapshot, framework: LumenFramework, detail: ComponentDetailLevel) => {
|
|
38
|
+
apiReference: {
|
|
39
|
+
attribute: string;
|
|
40
|
+
defaultValue: string;
|
|
41
|
+
description: string;
|
|
42
|
+
values: string;
|
|
43
|
+
}[];
|
|
44
|
+
dependencies: string[];
|
|
45
|
+
files: unknown[];
|
|
46
|
+
framework: {
|
|
47
|
+
attributes?: string[];
|
|
48
|
+
available: boolean;
|
|
49
|
+
example: string;
|
|
50
|
+
importStatement: string;
|
|
51
|
+
language: "astro" | "html" | "tsx";
|
|
52
|
+
packageName: string;
|
|
53
|
+
props: {
|
|
54
|
+
name: string;
|
|
55
|
+
optional: boolean;
|
|
56
|
+
type: string;
|
|
57
|
+
}[];
|
|
58
|
+
propsExtends: null | string;
|
|
59
|
+
registration?: string;
|
|
60
|
+
styleImport: string;
|
|
61
|
+
tagName?: string;
|
|
62
|
+
};
|
|
63
|
+
guidance: {
|
|
64
|
+
distinction?: string;
|
|
65
|
+
when: string;
|
|
66
|
+
} | null;
|
|
67
|
+
keyboardInteractions: {
|
|
68
|
+
action: string;
|
|
69
|
+
key: string;
|
|
70
|
+
}[];
|
|
71
|
+
runtimeEvents: {
|
|
72
|
+
detail: string;
|
|
73
|
+
name: string;
|
|
74
|
+
target: string;
|
|
75
|
+
when: string;
|
|
76
|
+
}[];
|
|
77
|
+
category: string;
|
|
78
|
+
collections: string[];
|
|
79
|
+
description: string;
|
|
80
|
+
frameworks: LumenFramework[];
|
|
81
|
+
kebab: string;
|
|
82
|
+
name: string;
|
|
83
|
+
recipes: string[];
|
|
84
|
+
} | {
|
|
85
|
+
dependencies: string[];
|
|
86
|
+
framework: {
|
|
87
|
+
available: boolean;
|
|
88
|
+
packageName: string;
|
|
89
|
+
tagName: string | undefined;
|
|
90
|
+
};
|
|
91
|
+
guidance: {
|
|
92
|
+
distinction?: string;
|
|
93
|
+
when: string;
|
|
94
|
+
} | null;
|
|
95
|
+
category: string;
|
|
96
|
+
collections: string[];
|
|
97
|
+
description: string;
|
|
98
|
+
frameworks: LumenFramework[];
|
|
99
|
+
kebab: string;
|
|
100
|
+
name: string;
|
|
101
|
+
recipes: string[];
|
|
102
|
+
};
|
|
103
|
+
export declare const getComponent: (args: {
|
|
104
|
+
detail?: ComponentDetailLevel | undefined;
|
|
105
|
+
framework?: FrameworkFilter | undefined;
|
|
106
|
+
includeSource?: boolean | undefined;
|
|
107
|
+
name: string;
|
|
108
|
+
}, data?: LumenData) => LumenToolResult<{
|
|
109
|
+
component?: ReturnType<typeof componentDetail>;
|
|
110
|
+
found: boolean;
|
|
111
|
+
message?: string;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const getRecipe: (args: {
|
|
114
|
+
framework?: FrameworkFilter | undefined;
|
|
115
|
+
name: string;
|
|
116
|
+
}, data?: LumenData) => LumenToolResult<{
|
|
117
|
+
found: boolean;
|
|
118
|
+
message?: string;
|
|
119
|
+
recipe?: LumenRecipeSnapshot;
|
|
120
|
+
}>;
|
|
121
|
+
export declare const search: (args: {
|
|
122
|
+
limit?: number | undefined;
|
|
123
|
+
query: string;
|
|
124
|
+
}, data?: LumenData) => LumenToolResult<{
|
|
125
|
+
query: string;
|
|
126
|
+
results: SearchResult[];
|
|
127
|
+
total: number;
|
|
128
|
+
}>;
|
|
129
|
+
export declare const getTokens: (data?: LumenData) => LumenToolResult<{
|
|
130
|
+
tokens: LumenData["tokens"];
|
|
131
|
+
}>;
|
|
132
|
+
export declare const getRules: (data?: LumenData) => LumenToolResult<{
|
|
133
|
+
rules: string;
|
|
134
|
+
}>;
|
|
135
|
+
export {};
|
|
136
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,SAAS,EACT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