mirror of
https://github.com/sveltejs/ai-tools.git
synced 2026-07-04 03:19:38 +08:00
Compare commits
10 Commits
use-includ
...
@sveltejs/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a755a33a5f | ||
|
|
556f96cfaf | ||
|
|
77a3340c2f | ||
|
|
9ac8fd51e7 | ||
|
|
c764308d79 | ||
|
|
01a7e6a8d3 | ||
|
|
d8ed686e3a | ||
|
|
6f0390d0a9 | ||
|
|
c2c1b3e5e7 | ||
|
|
cdfbb907b6 |
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@sveltejs/mcp': patch
|
||||
---
|
||||
|
||||
fix: turn off no-inspect in eslint for mcp
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
'@sveltejs/opencode': minor
|
||||
---
|
||||
|
||||
feat: distribute skills through opencode plugin
|
||||
@@ -10,7 +10,7 @@
|
||||
"description": "A plugin for all things Svelte development, MCP, skills, and more.",
|
||||
"lspServers": {
|
||||
"svelte": {
|
||||
"command": "svelte-language-server",
|
||||
"command": "svelteserver",
|
||||
"args": ["--stdio"],
|
||||
"extensionToLanguage": {
|
||||
".svelte": "svelte"
|
||||
|
||||
71
.github/workflows/sync-agents-md.yml
vendored
Normal file
71
.github/workflows/sync-agents-md.yml
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
name: Sync Agents Documentation
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'instructions/AGENTS.md'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
jobs:
|
||||
sync-agents:
|
||||
# prevents this action from running on forks
|
||||
if: github.repository == 'sveltejs/mcp'
|
||||
name: Sync AGENTS.md to OpenCode Package and Docs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
|
||||
with:
|
||||
node-version: 24
|
||||
package-manager-cache: false # pnpm is not installed yet
|
||||
|
||||
- name: Install pnpm
|
||||
shell: bash
|
||||
run: |
|
||||
PNPM_VER=$(jq -r '.packageManager | if .[0:5] == "pnpm@" then .[5:] else "packageManager in package.json does not start with pnpm@\n" | halt_error(1) end' package.json)
|
||||
echo installing pnpm version $PNPM_VER
|
||||
npm i -g pnpm@$PNPM_VER
|
||||
|
||||
- name: Sync AGENTS.md
|
||||
run: pnpm sync-agents-md
|
||||
|
||||
- name: Check for changes
|
||||
id: git-check
|
||||
run: |
|
||||
git diff --exit-code packages/opencode/instructions/opencode-agents.md documentation/docs/10-introduction/.generated/agents.md || echo "changed=true" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Create Pull Request
|
||||
if: steps.git-check.outputs.changed == 'true'
|
||||
uses: peter-evans/create-pull-request@c0f553fe549906ede9cf27b5156039d195d2ece0 # v8.1.0
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: 'chore: sync AGENTS.md to opencode package and documentation'
|
||||
branch: chore/sync-agents-md
|
||||
delete-branch: true
|
||||
title: 'chore: sync AGENTS.md to opencode package and documentation'
|
||||
body: |
|
||||
## Summary
|
||||
Automatically synced AGENTS.md to the opencode package and documentation.
|
||||
|
||||
This PR was triggered by changes to `instructions/AGENTS.md`.
|
||||
|
||||
## Changes
|
||||
- Synced `packages/opencode/instructions/opencode-agents.md` with latest AGENTS.md
|
||||
- Updated `documentation/docs/10-introduction/.generated/agents.md` with latest content
|
||||
|
||||
## Generated by
|
||||
GitHub Action: Sync Agents Documentation
|
||||
labels: |
|
||||
chore
|
||||
documentation
|
||||
automated
|
||||
23
documentation/docs/10-introduction/.generated/agents.md
Normal file
23
documentation/docs/10-introduction/.generated/agents.md
Normal file
@@ -0,0 +1,23 @@
|
||||
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
|
||||
|
||||
## Available Svelte MCP Tools:
|
||||
|
||||
### 1. list-sections
|
||||
|
||||
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
|
||||
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
|
||||
|
||||
### 2. get-documentation
|
||||
|
||||
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
|
||||
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
|
||||
|
||||
### 3. svelte-autofixer
|
||||
|
||||
Analyzes Svelte code and returns issues and suggestions.
|
||||
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
|
||||
|
||||
### 4. playground-link
|
||||
|
||||
Generates a Svelte Playground link with the provided code.
|
||||
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.
|
||||
@@ -17,30 +17,6 @@ To get the most out of the MCP server we recommend including the following promp
|
||||
|
||||
> [!NOTE] This is already setup for you when using `npx sv add mcp`
|
||||
|
||||
```md
|
||||
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
|
||||
|
||||
## Available MCP Tools:
|
||||
|
||||
### 1. list-sections
|
||||
|
||||
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
|
||||
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
|
||||
|
||||
### 2. get-documentation
|
||||
|
||||
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
|
||||
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
|
||||
|
||||
### 3. svelte-autofixer
|
||||
|
||||
Analyzes Svelte code and returns issues and suggestions.
|
||||
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
|
||||
|
||||
### 4. playground-link
|
||||
|
||||
Generates a Svelte Playground link with the provided code.
|
||||
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.
|
||||
```
|
||||
@include .generated/agents.md
|
||||
|
||||
If your MCP client supports it, we also recommend using the [svelte-task](prompts#svelte-task) prompt to instruct the LLM on the best way to use the MCP server.
|
||||
|
||||
23
instructions/AGENTS.md
Normal file
23
instructions/AGENTS.md
Normal file
@@ -0,0 +1,23 @@
|
||||
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
|
||||
|
||||
## Available Svelte MCP Tools:
|
||||
|
||||
### 1. list-sections
|
||||
|
||||
Use this FIRST to discover all available documentation sections. Returns a structured list with titles, use_cases, and paths.
|
||||
When asked about Svelte or SvelteKit topics, ALWAYS use this tool at the start of the chat to find relevant sections.
|
||||
|
||||
### 2. get-documentation
|
||||
|
||||
Retrieves full documentation content for specific sections. Accepts single or multiple sections.
|
||||
After calling the list-sections tool, you MUST analyze the returned documentation sections (especially the use_cases field) and then use the get-documentation tool to fetch ALL documentation sections that are relevant for the user's task.
|
||||
|
||||
### 3. svelte-autofixer
|
||||
|
||||
Analyzes Svelte code and returns issues and suggestions.
|
||||
You MUST use this tool whenever writing Svelte code before sending it to the user. Keep calling it until no issues or suggestions are returned.
|
||||
|
||||
### 4. playground-link
|
||||
|
||||
Generates a Svelte Playground link with the provided code.
|
||||
After completing the code, ask the user if they want a playground link. Only call this tool after user confirmation and NEVER if code was written to files in their project.
|
||||
@@ -25,7 +25,8 @@
|
||||
"debug:generate-summaries": "pnpm --filter @sveltejs/mcp-server run debug:generate-summaries",
|
||||
"release": "pnpm --filter @sveltejs/mcp run build && changeset publish",
|
||||
"changeset:version": "changeset version && pnpm --filter @sveltejs/mcp run update:version && git add --all",
|
||||
"sync-opencode-skills": "rm -rf packages/opencode/skills && cp -r plugins/svelte/skills packages/opencode/skills"
|
||||
"sync-opencode-skills": "rm -rf packages/opencode/skills && cp -r plugins/svelte/skills packages/opencode/skills",
|
||||
"sync-agents-md": "rm -f packages/opencode/instructions/opencode-agents.md && rm -f documentation/docs/10-introduction/.generated/agents.md && mkdir -p packages/opencode/instructions && mkdir -p documentation/docs/10-introduction/.generated && cp instructions/AGENTS.md packages/opencode/instructions/opencode-agents.md && cp instructions/AGENTS.md documentation/docs/10-introduction/.generated/agents.md"
|
||||
},
|
||||
"keywords": [
|
||||
"svelte",
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
# @sveltejs/mcp
|
||||
|
||||
## 0.1.20
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fix: turn off no-inspect in eslint for mcp ([`2245cb2`](https://github.com/sveltejs/mcp/commit/2245cb2dc9e2d217869b6a800795ce59ffb40c51))
|
||||
|
||||
## 0.1.19
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sveltejs/mcp",
|
||||
"version": "0.1.19",
|
||||
"version": "0.1.20",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"mcpName": "dev.svelte/mcp",
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
"subfolder": "packages/mcp-stdio",
|
||||
"source": "github"
|
||||
},
|
||||
"version": "0.1.19",
|
||||
"version": "0.1.20",
|
||||
"websiteUrl": "https://svelte.dev/docs/mcp/overview",
|
||||
"icons": [
|
||||
{
|
||||
@@ -25,7 +25,7 @@
|
||||
{
|
||||
"registryType": "npm",
|
||||
"identifier": "@sveltejs/mcp",
|
||||
"version": "0.1.19",
|
||||
"version": "0.1.20",
|
||||
"runtimeHint": "npx",
|
||||
"transport": {
|
||||
"type": "stdio"
|
||||
|
||||
@@ -1,5 +1,23 @@
|
||||
# @sveltejs/opencode
|
||||
|
||||
## 0.1.2
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- feat: allow for local opencode config ([#156](https://github.com/sveltejs/mcp/pull/156))
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- fix: actually push skills to right config path ([`c2c1b3e`](https://github.com/sveltejs/mcp/commit/c2c1b3e5e788b14eea17cd37a83ca55433cc4072))
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Minor Changes
|
||||
|
||||
- feat: distribute skills through opencode plugin ([#151](https://github.com/sveltejs/mcp/pull/151))
|
||||
|
||||
## 0.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -71,8 +71,15 @@ function get_config_paths() {
|
||||
}
|
||||
}
|
||||
|
||||
// returning config_dir first so it has higher priority
|
||||
return [config_dir_path, global_path];
|
||||
// Project-local: ./.opencode/svelte.json (cwd)
|
||||
let project_path: string | null = null;
|
||||
const project_config = join(process.cwd(), '.opencode', 'svelte.json');
|
||||
if (existsSync(project_config)) {
|
||||
project_path = project_config;
|
||||
}
|
||||
|
||||
// Lowest priority first, highest priority last (project overrides global)
|
||||
return [global_path, config_dir_path, project_path];
|
||||
}
|
||||
|
||||
function load_config_file(config_path: string): ConfigLoadResult {
|
||||
@@ -121,6 +128,9 @@ function merge_with_defaults(user_config: Partial<McpConfig>): McpConfig {
|
||||
|
||||
export function get_mcp_config(ctx: PluginInput) {
|
||||
const config_paths = get_config_paths();
|
||||
let merged: Partial<McpConfig> = {};
|
||||
|
||||
// Iterate from lowest to highest priority, merging as we go
|
||||
for (const path of config_paths) {
|
||||
if (path && existsSync(path)) {
|
||||
const result = load_config_file(path);
|
||||
@@ -129,23 +139,28 @@ export function get_mcp_config(ctx: PluginInput) {
|
||||
ctx.client.tui.showToast({
|
||||
body: {
|
||||
title: 'Svelte: Invalid opencode plugin config',
|
||||
message: `${result.parse_error}\nUsing default values`,
|
||||
message: `${result.parse_error} (${path})\nSkipping this config file`,
|
||||
variant: 'warning',
|
||||
duration: 7000,
|
||||
},
|
||||
});
|
||||
}, 7000);
|
||||
return default_config;
|
||||
continue;
|
||||
}
|
||||
const parsed = v.safeParse(config_schema, result.data);
|
||||
if (parsed.success) {
|
||||
return merge_with_defaults(parsed.output);
|
||||
merged = {
|
||||
mcp: { ...merged.mcp, ...parsed.output.mcp },
|
||||
subagent: { ...merged.subagent, ...parsed.output.subagent },
|
||||
instructions: { ...merged.instructions, ...parsed.output.instructions },
|
||||
skills: { ...merged.skills, ...parsed.output.skills },
|
||||
};
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
ctx.client.tui.showToast({
|
||||
body: {
|
||||
title: 'Svelte: Invalid opencode plugin config',
|
||||
message: `${result.parse_error}\nUsing default values`,
|
||||
message: `Invalid config schema (${path})\nSkipping this config file`,
|
||||
variant: 'warning',
|
||||
duration: 7000,
|
||||
},
|
||||
@@ -155,5 +170,5 @@ export function get_mcp_config(ctx: PluginInput) {
|
||||
}
|
||||
}
|
||||
|
||||
return default_config;
|
||||
return merge_with_defaults(merged);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,9 @@ export const svelte_plugin: Plugin = async (ctx) => {
|
||||
input.mcp ??= {};
|
||||
input.instructions ??= [];
|
||||
// @ts-expect-error -- types are wrong in the opencode package...will fix there and remove this
|
||||
input.skills ??= [];
|
||||
input.skills ??= {};
|
||||
// @ts-expect-error -- types are wrong in the opencode package...will fix there and remove this
|
||||
input.skills.paths ??= [];
|
||||
// by default we use svelte as the name for the svelte MCP server
|
||||
let svelte_mcp_name = 'svelte';
|
||||
// we loop over every mcp server to see if any of them is already the svelte MCP server
|
||||
@@ -40,7 +42,7 @@ export const svelte_plugin: Plugin = async (ctx) => {
|
||||
if (mcp_config.skills?.enabled !== false) {
|
||||
const skills_dir = join(current_dir, 'skills');
|
||||
// @ts-expect-error -- skills is a new opencode feature
|
||||
input.skills.push(skills_dir);
|
||||
input.skills.paths.push(skills_dir);
|
||||
}
|
||||
|
||||
// if the user doesn't have the MCP server already we add one based on config
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
You are able to use the Svelte MCP server, where you have access to comprehensive Svelte 5 and SvelteKit documentation. Here's how to use the available tools effectively:
|
||||
|
||||
## Available MCP Tools:
|
||||
## Available Svelte MCP Tools:
|
||||
|
||||
### 1. list-sections
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@sveltejs/opencode",
|
||||
"version": "0.0.3",
|
||||
"version": "0.1.2",
|
||||
"type": "module",
|
||||
"license": "MIT",
|
||||
"homepage": "https://github.com/sveltejs/mcp#readme",
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "svelte",
|
||||
"description": "A plugin for all things related to Svelte development, MCP, skills, and more.",
|
||||
"version": "1.0.0",
|
||||
"version": "1.0.1",
|
||||
"author": {
|
||||
"name": "Svelte"
|
||||
},
|
||||
"lspServers": {
|
||||
"svelte": {
|
||||
"command": "svelte-language-server",
|
||||
"command": "svelteserver",
|
||||
"args": ["--stdio"],
|
||||
"extensionToLanguage": {
|
||||
".svelte": "svelte"
|
||||
|
||||
Reference in New Issue
Block a user