@jsswift/knowledge-mcp 0.1.2 → 0.1.4
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/server.mjs +10 -2
- package/package.json +1 -1
package/dist/server.mjs
CHANGED
|
@@ -85,7 +85,15 @@ async function loadKnowledge(root = defaultRoot) {
|
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
|
-
const
|
|
88
|
+
const aliases = map.documentAliases ?? {};
|
|
89
|
+
for (const [alias, target] of Object.entries(aliases)) {
|
|
90
|
+
if (!alias.endsWith(".md") || !map.components.some((component) => component.path === target)) {
|
|
91
|
+
throw new Error("Invalid documentation alias");
|
|
92
|
+
}
|
|
93
|
+
await safePath(alias);
|
|
94
|
+
await safePath(target);
|
|
95
|
+
}
|
|
96
|
+
const files = (await readdir(path.join(docsRoot, "components"))).filter((name) => name.endsWith(".md") && name !== "README.md" && !Object.hasOwn(aliases, `components/${name}`));
|
|
89
97
|
const indexed = new Set(map.components.map((component) => component.path));
|
|
90
98
|
if (files.length !== indexed.size || files.some((name) => !indexed.has(`components/${name}`))) {
|
|
91
99
|
throw new Error("Component map coverage mismatch; run npm run knowledge:refresh");
|
|
@@ -154,7 +162,7 @@ var options = parseArgs(process.argv.slice(2));
|
|
|
154
162
|
var context = options.docs ? { project: options.project, version: "development", docsRoot: options.docs } : await resolveProject(options.project);
|
|
155
163
|
var knowledge = await loadKnowledge(context.docsRoot);
|
|
156
164
|
var server = new McpServer({ name: "jsswift-knowledge", version: "0.1.2" }, {
|
|
157
|
-
instructions: `Serving JSswift ${context.version} from project ${context.project}. Prefer _.Button for buttons. Use _.Component
|
|
165
|
+
instructions: `Serving JSswift ${context.version} from project ${context.project}. Prefer _.Button for buttons. Use _.Component; prefer _.rod for bidirectional field models and _.useForm for structured forms. Signals remain supported for getter/setter state. Start with guide:AI for a basic page and its supported examples. Search and read component contracts only for additional APIs; read guide:ui/common-props once when styling. JSswift includes component CSS; read application-rules and prefer documented styling props and theme variables before custom overrides. Fonts and the Tabler catalog are optional; read getting-started for imports. This server covers application development only.`
|
|
158
166
|
});
|
|
159
167
|
var annotations = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
160
168
|
var jsonResult = (value) => ({ content: [{ type: "text", text: JSON.stringify(value) }], structuredContent: value });
|